summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp5
-rw-r--r--src/mongo/db/s/resharding/coordinator_document.idl1
-rw-r--r--src/mongo/db/s/resharding/donor_document.idl1
-rw-r--r--src/mongo/db/s/resharding/recipient_document.idl1
-rw-r--r--src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp3
-rw-r--r--src/mongo/db/s/resharding/resharding_coordinator_test.cpp3
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_recipient_common.cpp9
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h9
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_service.cpp3
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_service_test.cpp3
-rw-r--r--src/mongo/db/s/resharding/resharding_recipient_service_test.cpp3
11 files changed, 17 insertions, 24 deletions
diff --git a/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp b/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp
index 35dfb903ae2..9830b44c5db 100644
--- a/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp
+++ b/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp
@@ -178,9 +178,8 @@ public:
auto coordinatorDoc =
ReshardingCoordinatorDocument(std::move(CoordinatorStateEnum::kUnused),
- {}, // donorShards
- {}, // recipientShards
- ReshardingCoordinatorMetrics());
+ {}, // donorShards
+ {}); // recipientShards
// Generate the resharding metadata for the ReshardingCoordinatorDocument.
auto reshardingUUID = UUID::gen();
diff --git a/src/mongo/db/s/resharding/coordinator_document.idl b/src/mongo/db/s/resharding/coordinator_document.idl
index 2ef63689293..49f1cf8186c 100644
--- a/src/mongo/db/s/resharding/coordinator_document.idl
+++ b/src/mongo/db/s/resharding/coordinator_document.idl
@@ -122,3 +122,4 @@ structs:
metrics:
type: ReshardingCoordinatorMetrics
description: "Metrics related to the coordinator."
+ optional: true
diff --git a/src/mongo/db/s/resharding/donor_document.idl b/src/mongo/db/s/resharding/donor_document.idl
index b43c9c0c1f7..75a292823e6 100644
--- a/src/mongo/db/s/resharding/donor_document.idl
+++ b/src/mongo/db/s/resharding/donor_document.idl
@@ -73,3 +73,4 @@ structs:
metrics:
type: ReshardingDonorMetrics
description: "Metrics related to this donor."
+ optional: true
diff --git a/src/mongo/db/s/resharding/recipient_document.idl b/src/mongo/db/s/resharding/recipient_document.idl
index d0d3b9d18ae..e3128de0db5 100644
--- a/src/mongo/db/s/resharding/recipient_document.idl
+++ b/src/mongo/db/s/resharding/recipient_document.idl
@@ -85,3 +85,4 @@ structs:
metrics:
type: ReshardingRecipientMetrics
description: "Metrics related to this recipient."
+ optional: true
diff --git a/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp b/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp
index 4f7cfde3f64..071ec5c94ae 100644
--- a/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp
@@ -198,8 +198,7 @@ public:
_reshardingUUID, _originalNss, UUID::gen(), _tempNss, _newShardKey.toBSON());
ReshardingCoordinatorDocument doc(state,
{DonorShardEntry(ShardId("shard0000"), {})},
- {RecipientShardEntry(ShardId("shard0001"), {})},
- ReshardingCoordinatorMetrics());
+ {RecipientShardEntry(ShardId("shard0001"), {})});
doc.setCommonReshardingMetadata(meta);
emplaceCloneTimestampIfExists(doc, cloneTimestamp);
return doc;
diff --git a/src/mongo/db/s/resharding/resharding_coordinator_test.cpp b/src/mongo/db/s/resharding/resharding_coordinator_test.cpp
index b6598cef5aa..76e9753fc44 100644
--- a/src/mongo/db/s/resharding/resharding_coordinator_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_coordinator_test.cpp
@@ -91,8 +91,7 @@ protected:
_reshardingUUID, _originalNss, UUID::gen(), _tempNss, _newShardKey.toBSON());
ReshardingCoordinatorDocument doc(state,
{DonorShardEntry(ShardId("shard0000"), {})},
- {RecipientShardEntry(ShardId("shard0001"), {})},
- ReshardingCoordinatorMetrics());
+ {RecipientShardEntry(ShardId("shard0001"), {})});
doc.setCommonReshardingMetadata(meta);
emplaceCloneTimestampIfExists(doc, std::move(fetchTimestamp));
return doc;
diff --git a/src/mongo/db/s/resharding/resharding_donor_recipient_common.cpp b/src/mongo/db/s/resharding/resharding_donor_recipient_common.cpp
index 875a69894d0..2e9358925a7 100644
--- a/src/mongo/db/s/resharding/resharding_donor_recipient_common.cpp
+++ b/src/mongo/db/s/resharding/resharding_donor_recipient_common.cpp
@@ -238,10 +238,8 @@ ReshardingDonorDocument constructDonorDocumentFromReshardingFields(
DonorShardContext donorCtx;
donorCtx.setState(DonorStateEnum::kPreparingToDonate);
- auto donorDoc =
- ReshardingDonorDocument{std::move(donorCtx),
- reshardingFields.getDonorFields()->getRecipientShardIds(),
- ReshardingDonorMetrics()};
+ auto donorDoc = ReshardingDonorDocument{
+ std::move(donorCtx), reshardingFields.getDonorFields()->getRecipientShardIds()};
auto sourceUUID = getCollectionUUIDFromChunkManger(nss, *metadata.getChunkManager());
auto commonMetadata =
@@ -270,8 +268,7 @@ ReshardingRecipientDocument constructRecipientDocumentFromReshardingFields(
auto recipientDoc = ReshardingRecipientDocument{
std::move(recipientCtx),
reshardingFields.getRecipientFields()->getDonorShards(),
- reshardingFields.getRecipientFields()->getMinimumOperationDurationMillis(),
- ReshardingRecipientMetrics()};
+ reshardingFields.getRecipientFields()->getMinimumOperationDurationMillis()};
auto sourceNss = reshardingFields.getRecipientFields()->getSourceNss();
auto sourceUUID = reshardingFields.getRecipientFields()->getSourceUUID();
diff --git a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h
index ed192bfb311..bc0e4888e43 100644
--- a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h
+++ b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h
@@ -138,8 +138,7 @@ protected:
donorCtx.setState(DonorStateEnum::kPreparingToDonate);
ReshardingDonorDocument doc(std::move(donorCtx),
- {kThisShard.getShardId(), kOtherShard.getShardId()},
- ReshardingDonorMetrics());
+ {kThisShard.getShardId(), kOtherShard.getShardId()});
NamespaceString sourceNss = kOriginalNss;
auto sourceUUID = UUID::gen();
@@ -154,10 +153,8 @@ protected:
RecipientShardContext recipCtx;
recipCtx.setState(RecipientStateEnum::kCloning);
- ReshardingRecipientDocument doc(std::move(recipCtx),
- {kThisShard.getShardId(), kOtherShard.getShardId()},
- 1000,
- ReshardingRecipientMetrics());
+ ReshardingRecipientDocument doc(
+ std::move(recipCtx), {kThisShard.getShardId(), kOtherShard.getShardId()}, 1000);
NamespaceString sourceNss = kOriginalNss;
auto sourceUUID = UUID::gen();
diff --git a/src/mongo/db/s/resharding/resharding_donor_service.cpp b/src/mongo/db/s/resharding/resharding_donor_service.cpp
index 653fedb29cd..f9d6fd7e3ed 100644
--- a/src/mongo/db/s/resharding/resharding_donor_service.cpp
+++ b/src/mongo/db/s/resharding/resharding_donor_service.cpp
@@ -202,7 +202,8 @@ ReshardingDonorService::DonorStateMachine::DonorStateMachine(
_metadata{donorDoc.getCommonReshardingMetadata()},
_recipientShardIds{donorDoc.getRecipientShards()},
_donorCtx{donorDoc.getMutableState()},
- _donorMetricsToRestore{donorDoc.getMetrics()},
+ _donorMetricsToRestore{donorDoc.getMetrics() ? donorDoc.getMetrics().get()
+ : ReshardingDonorMetrics()},
_externalState{std::move(externalState)},
_markKilledExecutor(std::make_shared<ThreadPool>([] {
ThreadPool::Options options;
diff --git a/src/mongo/db/s/resharding/resharding_donor_service_test.cpp b/src/mongo/db/s/resharding/resharding_donor_service_test.cpp
index bdece738d71..549b99e3a74 100644
--- a/src/mongo/db/s/resharding/resharding_donor_service_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_donor_service_test.cpp
@@ -143,8 +143,7 @@ public:
ReshardingDonorDocument doc(std::move(donorCtx),
{ShardId{"recipient1"},
isAlsoRecipient ? donorShardId : ShardId{"recipient2"},
- ShardId{"recipient3"}},
- ReshardingDonorMetrics());
+ ShardId{"recipient3"}});
NamespaceString sourceNss("sourcedb.sourcecollection");
auto sourceUUID = UUID::gen();
diff --git a/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp b/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp
index 2880b12e18a..866d582cd7e 100644
--- a/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp
@@ -239,8 +239,7 @@ public:
{ShardId{"donor1"},
isAlsoDonor ? recipientShardId : ShardId{"donor2"},
ShardId{"donor3"}},
- durationCount<Milliseconds>(Milliseconds{5}),
- ReshardingRecipientMetrics());
+ durationCount<Milliseconds>(Milliseconds{5}));
NamespaceString sourceNss("sourcedb", "sourcecollection");
auto sourceUUID = UUID::gen();