mapleFU commented on code in PR #2461:
URL: https://github.com/apache/kvrocks/pull/2461#discussion_r1701987171
##########
src/server/worker.h:
##########
@@ -88,9 +91,10 @@ class Worker : EventCallbackBase<Worker>,
EvconnlistenerBase<Worker> {
UniqueEvent timer_;
std::thread::id tid_;
std::vector<evconnlistener *> listen_events_;
- std::mutex conns_mu_;
- std::map<int, redis::Connection *> conns_;
- std::map<int, redis::Connection *> monitor_conns_;
+ mutable std::mutex conns_mu_; // refer to
https://github.com/oneapi-src/oneTBB/issues/183, traverse and erase should
Review Comment:
> Maybe a simple read-write shared_mutex have a better performance and
cleaner logic.
read-write lock is a tricky thing, usally it would bring up higher cost in
checking the locks, and it's suitable for the cases that are merely updated. If
we're sure the read is much more than write operations we can use that,
otherwise just simple lock would be ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]