@@ -389,9 +389,7 @@ cb::engine_errc EventuallyPersistentEngine::get_prometheus_stats(
389389 const std::shared_ptr<ConnHandler>& tc) {
390390 ++aggregator.totalConns ;
391391 if (auto tp = std::dynamic_pointer_cast<DcpProducer>(tc); tp) {
392- // Do not use the potentially slower "accurate" items
393- // remaining. MB-57400
394- tp->aggregateQueueStats (aggregator, false );
392+ tp->aggregateQueueStats (aggregator);
395393 }
396394 });
397395 addAggregatedProducerStats (collector, aggregator);
@@ -409,7 +407,7 @@ cb::engine_errc EventuallyPersistentEngine::get_prometheus_stats(
409407
410408 // do dcp aggregated stats, using ":" as the separator to split
411409 // connection names to find the connection type.
412- if (status = doConnAggStatsInner (collector, " :" , false );
410+ if (status = doConnAggStatsInner (collector, " :" );
413411 status != cb::engine_errc::success) {
414412 return status;
415413 }
@@ -4043,7 +4041,7 @@ struct ConnStatBuilder {
40434041 tc->addStats (add_stat, cookie);
40444042 auto tp = std::dynamic_pointer_cast<DcpProducer>(tc);
40454043 if (tp) {
4046- tp->aggregateQueueStats (aggregator, true );
4044+ tp->aggregateQueueStats (aggregator);
40474045 }
40484046 }
40494047 }
@@ -4060,17 +4058,11 @@ struct ConnStatBuilder {
40604058
40614059struct ConnAggStatBuilder {
40624060 /* *
4063- * Construct with the separator and a configuration bool .
4061+ * Construct with the separator.
40644062 * @param sep The separator used for determining "type" of DCP connection
40654063 * by splitting the connection name with sep.
4066- * @param alwaysUseAccurateItemsRemaining if true the aggregated stats will
4067- * include an "accurate" items-remaining. If false only connections
4068- * labelled as "replication" will use an accurate value. See MB-57400
40694064 */
4070- ConnAggStatBuilder (std::string_view sep,
4071- bool alwaysUseAccurateItemsRemaining)
4072- : sep(sep),
4073- alwaysUseAccurateItemsRemaining (alwaysUseAccurateItemsRemaining) {
4065+ ConnAggStatBuilder (std::string_view sep) : sep(sep) {
40744066 }
40754067
40764068 /* *
@@ -4088,23 +4080,22 @@ struct ConnAggStatBuilder {
40884080 * returns nullptr.
40894081 *
40904082 * @param tc connection
4091- * @return pair of counter for the given connection, or nullptr and true
4092- * if the connection is considered a replication stream
4083+ * @return counter for the given connection, or nullptr
40934084 */
4094- std::pair< ConnCounter*, bool > getCounterForConnType (std::string_view name) {
4085+ ConnCounter* getCounterForConnType (std::string_view name) {
40954086 // strip everything upto and including the first colon,
40964087 // e.g., "eq_dcpq:"
40974088 size_t pos1 = name.find (' :' );
40984089 if (pos1 == std::string_view::npos) {
4099- return { nullptr , false } ;
4090+ return nullptr ;
41004091 }
41014092
41024093 name.remove_prefix (pos1 + 1 );
41034094
41044095 // find the given separator
41054096 size_t pos2 = name.find (sep);
41064097 if (pos2 == std::string_view::npos) {
4107- return { nullptr , false } ;
4098+ return nullptr ;
41084099 }
41094100
41104101 // extract upto given separator e.g.,
@@ -4115,18 +4106,14 @@ struct ConnAggStatBuilder {
41154106 // prefix is "replication"
41164107 std::string prefix (name.substr (0 , pos2));
41174108
4118- // class is created with the itemsRemaining "policy" - which if not true
4119- // replication will always use the accurate items remaining - all
4120- // other connection types use a faster estimate.
4121- return {&counters[prefix],
4122- alwaysUseAccurateItemsRemaining || prefix == " replication" };
4109+ return &counters[prefix];
41234110 }
41244111
4125- void aggregate (ConnHandler& conn, ConnCounter* tc, bool isReplication ) {
4112+ void aggregate (ConnHandler& conn, ConnCounter* tc) {
41264113 ConnCounter counter;
41274114 ++counter.totalConns ;
41284115
4129- conn.aggregateQueueStats (counter, isReplication );
4116+ conn.aggregateQueueStats (counter);
41304117
41314118 ConnCounter& total = getTotalCounter ();
41324119 total += counter;
@@ -4142,8 +4129,8 @@ struct ConnAggStatBuilder {
41424129
41434130 void operator ()(std::shared_ptr<ConnHandler> tc) {
41444131 if (tc) {
4145- auto aggregator = getCounterForConnType (tc->getName ());
4146- aggregate (*tc, aggregator. first , aggregator. second );
4132+ ConnCounter* aggregator = getCounterForConnType (tc->getName ());
4133+ aggregate (*tc, aggregator);
41474134 }
41484135 }
41494136
@@ -4153,7 +4140,6 @@ struct ConnAggStatBuilder {
41534140
41544141 std::map<std::string, ConnCounter> counters;
41554142 std::string_view sep;
4156- const bool alwaysUseAccurateItemsRemaining{false };
41574143};
41584144
41594145// / @endcond
@@ -4250,8 +4236,8 @@ cb::engine_errc EventuallyPersistentEngine::doConnAggStats(
42504236 // write them as responses (which would be racy).
42514237 // a later call to maybeWriteResponse will do that.
42524238 CBStatCollector col (deferredAddStat, cookie);
4253- ep->doConnAggStatsInner (
4254- col. forBucket (ep-> getName ()), separator, true );
4239+ ep->doConnAggStatsInner (col. forBucket (ep-> getName ()),
4240+ separator );
42554241 return cb::engine_errc::success;
42564242 });
42574243 ExecutorPool::get ()->schedule (task);
@@ -4263,15 +4249,13 @@ cb::engine_errc EventuallyPersistentEngine::doConnAggStats(
42634249}
42644250
42654251cb::engine_errc EventuallyPersistentEngine::doConnAggStatsInner (
4266- const BucketStatCollector& collector,
4267- std::string_view sep,
4268- bool cmdStat) {
4252+ const BucketStatCollector& collector, std::string_view sep) {
42694253 // The separator is, in all current usage, ":" so the length will
42704254 // normally be 1
42714255 const size_t max_sep_len (8 );
42724256 sep = sep.substr (0 , max_sep_len);
42734257
4274- ConnAggStatBuilder visitor (sep, cmdStat );
4258+ ConnAggStatBuilder visitor (sep);
42754259 dcpConnMap_->each (visitor);
42764260
42774261 for (const auto & [connType, counter] : visitor.getCounters ()) {
0 commit comments