一、一个半同步BUG
这个BUG比较老了,主要是5.7.17以下的版本可能会遇到。这个BUG主要是主库ACK receiver线程需要将半同步从库的连接的fd注册到其中,然后监控连接的fd是否有数据到达,其实就是ACK 信息,如果有ACK信息到达,则需要读取信息同时解析ACK包,然后决定唤醒哪个或者哪些事务。但是这里使用的是select 函数,其原型如下,
int select(int nfds, fd_set *restrict readfds,
fd_set *restrict writefds, fd_set *restrict exceptfds,
struct timeval *restrict timeout);
其中第一个参数nfds有如下限制(来自 linux man page)
POSIX allows an implementation to define an upper limit,
advertised via the constant **FD_SETSIZE**, on the range of file
descriptors that can be specified in a file descriptor set. The
Linux kernel imposes no fixed limit, but the glibc implementation
makes *fd_set* a fixed-size type, with **FD_SETSIZE** defined as 1024,
and the **FD_***() macros operating according to that limit. To
monitor file descriptors greater than 1023,