summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/resharding/resharding_collection_cloner.h
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2021-02-22 03:17:14 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-02 09:37:04 +0000
commitfdaf29180e2c4218c99544bf377fc05dcc378fc5 (patch)
tree085ae898e699d84b3214e8a359fdeaeb007bcfbc /src/mongo/db/s/resharding/resharding_collection_cloner.h
parent8cfccd21f2f06bf93345ad25b3ca0a9af489b0e2 (diff)
downloadmongo-fdaf29180e2c4218c99544bf377fc05dcc378fc5.tar.gz
SERVER-53909 increment resharding metrics in ReshardingCollectionCloner
- Remove incorrect metrics invariant (donors call setDocumentsToCopy) - create metrics in setUp - extend metrics increment test to check for cloner stats
Diffstat (limited to 'src/mongo/db/s/resharding/resharding_collection_cloner.h')
-rw-r--r--src/mongo/db/s/resharding/resharding_collection_cloner.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mongo/db/s/resharding/resharding_collection_cloner.h b/src/mongo/db/s/resharding/resharding_collection_cloner.h
index 0c33b8736bd..2029ee40fbc 100644
--- a/src/mongo/db/s/resharding/resharding_collection_cloner.h
+++ b/src/mongo/db/s/resharding/resharding_collection_cloner.h
@@ -39,6 +39,7 @@
#include "mongo/db/pipeline/expression_context.h"
#include "mongo/db/pipeline/pipeline.h"
#include "mongo/db/repl/oplog.h"
+#include "mongo/db/s/resharding/resharding_metrics.h"
#include "mongo/s/shard_key_pattern.h"
#include "mongo/util/future.h"
@@ -59,7 +60,19 @@ class ServiceContext;
*/
class ReshardingCollectionCloner {
public:
- ReshardingCollectionCloner(ShardKeyPattern newShardKeyPattern,
+ class Env {
+ public:
+ explicit Env(ReshardingMetrics* metrics) : _metrics(metrics) {}
+ ReshardingMetrics* metrics() const {
+ return _metrics;
+ }
+
+ private:
+ ReshardingMetrics* _metrics;
+ };
+
+ ReshardingCollectionCloner(std::unique_ptr<Env> env,
+ ShardKeyPattern newShardKeyPattern,
NamespaceString sourceNss,
CollectionUUID sourceUUID,
ShardId recipientShard,
@@ -84,6 +97,7 @@ private:
template <typename Callable>
auto _withTemporaryOperationContext(Callable&& callable);
+ std::unique_ptr<Env> _env;
const ShardKeyPattern _newShardKeyPattern;
const NamespaceString _sourceNss;
const CollectionUUID _sourceUUID;