Skip to content

Commit 50fae0b

Browse files
committed
Current check on file descriptors (fd) is not reliable or necessary
1 parent 1c3c429 commit 50fae0b

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

lib/MySQL_Monitor.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -267,22 +267,10 @@ class MySQL_Monitor_Connection_Pool {
267267
MYSQL *my1 = (MYSQL *)conns->index(i);
268268
// 'my1' can be NULL due to connection cleanup
269269
if (my1 == nullptr) continue;
270-
271270
assert(my!=my1);
272-
//assert(my->net.fd!=my1->net.fd); // FIXME: we changed this with the next section of code
273-
if (my->net.fd == my1->net.fd) {
274-
// FIXME: we need to identify still why a connection with error 2013 is here
275-
if (my1->net.last_errno == 2013) {
276-
// we remove the connection
277-
conns->remove_index_fast(i);
278-
goto __conn_register_label; // we return to the loop
279-
} else {
280-
// we crash again, as in the old logic
281-
assert(my->net.fd!=my1->net.fd);
282-
}
283-
}
284271
}
285-
//proxy_info("Registering MYSQL with FD %d from mmsd %p and MYSQL %p\n", my->net.fd, mmsd, mmsd->mysql);
272+
proxy_debug(PROXY_DEBUG_MONITOR, 7,
273+
"Registering MYSQL with FD %d from mmsd %p and MYSQL %p\n", my->net.fd, mmsd, mmsd->mysql);
286274
conns->add(my);
287275
pthread_mutex_unlock(&m2);
288276
#endif // DEBUG
@@ -311,7 +299,8 @@ class MySQL_Monitor_Connection_Pool {
311299
MYSQL *my1 = (MYSQL *)conns->index(i);
312300
if (my1 == my) {
313301
conns->remove_index_fast(i);
314-
//proxy_info("Un-registering MYSQL with FD %d\n", my->net.fd);
302+
proxy_debug(PROXY_DEBUG_MONITOR, 7,
303+
"Un-registering MYSQL with FD %d from mmsd %p and MYSQL %p\n", my->net.fd, mmsd, mmsd->mysql);
315304
pthread_mutex_unlock(&m2);
316305
return;
317306
}
@@ -364,7 +353,6 @@ MYSQL * MySQL_Monitor_Connection_Pool::get_connection(char *hostname, int port,
364353
if (k!=j) {
365354
MYSQL *my2 = (MYSQL *)srv->conns->index(k);
366355
assert(my1!=my2);
367-
assert(my1->net.fd!=my2->net.fd);
368356
}
369357
}
370358
}
@@ -396,7 +384,6 @@ MYSQL * MySQL_Monitor_Connection_Pool::get_connection(char *hostname, int port,
396384
if (!my1) continue;
397385

398386
assert(my!=my1);
399-
assert(my->net.fd!=my1->net.fd);
400387
}
401388
//proxy_info("Registering MYSQL with FD %d from mmsd %p and MYSQL %p\n", my->net.fd, mmsd, my);
402389

0 commit comments

Comments
 (0)