Bug #106591 net_set_read_timeout、net_set_write_timeout value set
Submitted: 28 Feb 2022 4:10 Modified: 28 Feb 2022 7:05
Reporter: bin wang (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Options Severity:S5 (Performance)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[28 Feb 2022 4:10] bin wang
Description:
when set read_timeout  and write_timeout 
If default value is equal to user option 
It is not necessary to call  function may cost few time.
 

How to repeat:
just add if  default value is equal to user option then  return

Suggested fix:
suggest add 
void my_net_set_read_timeout(NET *net, uint timeout) {
  DBUG_TRACE;
  DBUG_PRINT("enter", ("timeout: %d", timeout));
 ++  if (net->read_timeout == timeout) return;
  net->read_timeout = timeout;
  if (net->vio) vio_timeout(net->vio, 0, timeout);
}

void my_net_set_write_timeout(NET *net, uint timeout) {
  DBUG_TRACE;
  DBUG_PRINT("enter", ("timeout: %d", timeout));
++   if (net->write_timeout == timeout) return;
  net->write_timeout = timeout;
  if (net->vio) vio_timeout(net->vio, 1, timeout);
}
[28 Feb 2022 4:10] bin wang
suggested add  patch

Attachment: net_serv.patch (application/octet-stream, text), 769 bytes.

[28 Feb 2022 7:05] MySQL Verification Team
Hello bin wang,

Thank you for the report and feedback.

regards,
Umesh