Bug #110163 IPTOS_THROUGHPUT enabling code is bypassed on Linux
Submitted: 22 Feb 2023 7:22 Modified: 22 Feb 2023 7:55
Reporter: Cai Yibo (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S5 (Performance)
Version:8.0 OS:Linux
Assigned to: CPU Architecture:Any
Tags: tcpip, vio

[22 Feb 2023 7:22] Cai Yibo
Description:
vio_fastsend() tris to enable IPTOS_THROUGHPUT option, copied from below code.
https://github.com/mysql/mysql-server/blob/mysql-8.0.32/vio/viosocket.cc#L372-L378

#if defined(IPTOS_THROUGHPUT)
  {
    int tos = IPTOS_THROUGHPUT;
    r = mysql_socket_setsockopt(vio->mysql_socket, IPPROTO_IP, IP_TOS,
                                (void *)&tos, sizeof(tos));
  }
#endif

This code is not compiled on Linux as the macro IPTOS_THROUGHPUT is defined in <netinet/ip.h>, but this file is not included in the source code. Only <netinet/in.h> is included, which doesn't contain the macro.

Run "man 7 ip" to see related info.

How to repeat:
NA

Suggested fix:
Include <netinet/ip.h> to viosocket.cc.
[22 Feb 2023 7:25] Cai Yibo
Test environment:
- mysql-8.0.32 tag
- ubuntu-20.04
- gcc-10.3, libc6
[22 Feb 2023 7:55] MySQL Verification Team
Hello Cai Yibo,

Thank you for the report and feedback.

regards,
Umesh