Description:
In https://bugs.mysql.com/bug.php?id=46103 mysqldump implemented --network-timeout.
Turns out we need this also when dumping large binary logs using the --read-from-remote-server option, especially when piping them via scripts or importing them.
Workaround: on server configure larger net_write_timeout
How to repeat:
read a large binlog from a live server.
the binlog dump connection dies after ~30 seconds (net_write_timeout).
Suggested fix:
Similar as what we have in 8.0 mysqldump.cc : this, although I have idea why 700 was hardcoded...
if (opt_network_timeout)
{
uint timeout= 700;
ulong max_packet_allowed= 1024L*1024L*1024L;
mysql_options(&mysql_connection,MYSQL_OPT_READ_TIMEOUT,(char*)&timeout);
mysql_options(&mysql_connection,MYSQL_OPT_WRITE_TIMEOUT,(char*)&timeout);
/* set to maximum value which is 1GB */
mysql_options(&mysql_connection,MYSQL_OPT_MAX_ALLOWED_PACKET,
(char*)&max_packet_allowed);
}