summaryrefslogtreecommitdiff
path: root/src/mongo/s/chunk_manager_targeter.cpp
diff options
context:
space:
mode:
authorAdi Zaimi <adizaimi@yahoo.com>2022-11-07 01:58:07 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-07 02:29:33 +0000
commitda03719499bac3cfa1888ee1fd517ac30a738cba (patch)
tree85616220a16cf39d717b59b69b7809c7e490eb91 /src/mongo/s/chunk_manager_targeter.cpp
parentfd12dbc77432dd01ee37a9655d6657d9f9f9afa0 (diff)
downloadmongo-da03719499bac3cfa1888ee1fd517ac30a738cba.tar.gz
SERVER-67795: Add serverstatus counters for updateMany, deleteMany calls(v5.0)
Diffstat (limited to 'src/mongo/s/chunk_manager_targeter.cpp')
-rw-r--r--src/mongo/s/chunk_manager_targeter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/s/chunk_manager_targeter.cpp b/src/mongo/s/chunk_manager_targeter.cpp
index bdb386420c6..67d7310075c 100644
--- a/src/mongo/s/chunk_manager_targeter.cpp
+++ b/src/mongo/s/chunk_manager_targeter.cpp
@@ -43,6 +43,7 @@
#include "mongo/db/query/canonical_query.h"
#include "mongo/db/query/collation/collation_index_key.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
+#include "mongo/db/stats/counters.h"
#include "mongo/db/timeseries/timeseries_constants.h"
#include "mongo/db/timeseries/timeseries_options.h"
#include "mongo/db/timeseries/timeseries_update_delete_util.h"
@@ -386,6 +387,10 @@ std::vector<ShardEndpoint> ChunkManagerTargeter::targetUpdate(OperationContext*
const auto& updateOp = itemRef.getUpdate();
+ if (updateOp.getMulti()) {
+ updateManyCount.increment(1);
+ }
+
// If the collection is not sharded, forward the update to the primary shard.
if (!_cm.isSharded()) {
// TODO (SERVER-51070): Remove the boost::none when the config server can support
@@ -502,6 +507,10 @@ std::vector<ShardEndpoint> ChunkManagerTargeter::targetDelete(OperationContext*
itemRef.getLet(),
itemRef.getLegacyRuntimeConstants());
+ if (deleteOp.getMulti()) {
+ deleteManyCount.increment(1);
+ }
+
BSONObj deleteQuery = deleteOp.getQ();
BSONObj shardKey;
if (_cm.isSharded()) {