nhancdt2602 commented on code in PR #3557:
URL: https://github.com/apache/kvrocks/pull/3557#discussion_r3571410534
##########
src/server/server.h:
##########
@@ -444,6 +450,13 @@ class Server {
std::map<std::string, DBScanInfo> db_scan_infos_;
+ // Per-namespace command statistics (keyed by namespace name), guarded by
ns_stats_mu_. The global
+ // `stats` keeps the non-namespaced counters (net bytes, replication) and
the sampled aggregate ops/sec.
+ std::unordered_map<std::string, std::shared_ptr<Stats>> ns_stats_;
Review Comment:
The use of shared pointer here is intentional. As the stats object is held
in the connection cache field, the on going connection might have referred to
the stats object when it is removed from the map, i.e: deleted by remove
namespace operation. The shared pointer simplify the cleanup process.
--
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]