Details
-
Improvement
-
Resolution: Fixed
-
Major
-
7.1.4
-
0
-
KV 2023-4
Description
As observed in MB-56770 - during a rebalance when a client (query) was disconnecting and reconnecting to KV-Engine ~30 times per second, front-end threads which are trying to remove a closed connection can be blocked by STAT commands running on other connections - specifically "dcp" and "dcpagg" stat commands - e.g:
This is because both "dcp" and "dcpagg" call DcpConnMap::each to print stats for every connection, and DcpConnMap::each currently takes a write (exclusive) lock on the cookieToConnMap for the duration of the call.
We can reduce this cost by not locking the cookieToConnMap for the entire call; instead just copy a reference to each element in cookieToConnMap into a temp container, then unlock the cookieToConnMap before actually invoking the callback.