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.
Attachments
Issue Links
For Gerrit Dashboard: MB-56891 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
191090,8 | MB-56891: DcpConnMap::each(): unlock map before calling func | neo | kv_engine | Status: MERGED | +2 | +1 |
192449,3 | MB-56891: DcpConnMap::each(): use shared lock during copy | neo | kv_engine | Status: MERGED | +2 | +1 |
196265,1 | Merge commit '02ef7ccf5' into 'couchbase/master' | master | kv_engine | Status: MERGED | +2 | +1 |
196372,1 | Merge commit '758817af4' into 'couchbase/master' | master | kv_engine | Status: MERGED | +2 | +1 |