summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2021-06-09 21:46:58 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-10 21:28:17 +0000
commit6e6bfdaa1bfa5653d4f389d0a32e84ebe27c2376 (patch)
tree127cc2899fac6bb2123d44f12e33eb806c874979
parent6ebb5f9dfb1c3f6a2be267cd533c54fdfefbc993 (diff)
downloadmongo-6e6bfdaa1bfa5653d4f389d0a32e84ebe27c2376.tar.gz
SERVER-57266 Create IDL representations for resharding recipient and coordinator time intervals
-rw-r--r--src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp5
-rw-r--r--src/mongo/db/s/resharding/coordinator_document.idl13
-rw-r--r--src/mongo/db/s/resharding/recipient_document.idl23
-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.cpp3
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h6
-rw-r--r--src/mongo/db/s/resharding/resharding_recipient_service_test.cpp3
8 files changed, 51 insertions, 8 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 9830b44c5db..35dfb903ae2 100644
--- a/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp
+++ b/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp
@@ -178,8 +178,9 @@ public:
auto coordinatorDoc =
ReshardingCoordinatorDocument(std::move(CoordinatorStateEnum::kUnused),
- {}, // donorShards
- {}); // recipientShards
+ {}, // donorShards
+ {}, // recipientShards
+ ReshardingCoordinatorMetrics());
// 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 543c3216222..2ef63689293 100644
--- a/src/mongo/db/s/resharding/coordinator_document.idl
+++ b/src/mongo/db/s/resharding/coordinator_document.idl
@@ -64,6 +64,16 @@ structs:
# overwrite with a single $set.
mutableState: RecipientShardContext
+ ReshardingCoordinatorMetrics:
+ description: "Contains metrics about the resharding operation on the coordinator."
+ strict: false
+ fields:
+ operationRuntime:
+ type: ReshardingMetricsTimeInterval
+ description: >-
+ The time interval of the entire resharding operation on the coordinator.
+ optional: true
+
ReshardingCoordinatorDocument:
description: "Represents a resharding operation on the coordinator."
inline_chained_structs: true
@@ -109,3 +119,6 @@ structs:
index on in order to prevent multiple resharding operations from being active at
the same time.
default: true
+ metrics:
+ type: ReshardingCoordinatorMetrics
+ description: "Metrics related to the coordinator."
diff --git a/src/mongo/db/s/resharding/recipient_document.idl b/src/mongo/db/s/resharding/recipient_document.idl
index 41103d0c3cf..d0d3b9d18ae 100644
--- a/src/mongo/db/s/resharding/recipient_document.idl
+++ b/src/mongo/db/s/resharding/recipient_document.idl
@@ -36,6 +36,26 @@ imports:
- "mongo/s/resharding/common_types.idl"
structs:
+ ReshardingRecipientMetrics:
+ description: "Contains metrics about the resharding operation on a recipient."
+ strict: false
+ fields:
+ operationRuntime:
+ type: ReshardingMetricsTimeInterval
+ description: >-
+ The time interval of the entire resharding operation on this recipient.
+ optional: true
+ documentCopy:
+ type: ReshardingMetricsTimeInterval
+ description: >-
+ The time interval that it takes to clone documents on this recipient.
+ optional: true
+ oplogApplication:
+ type: ReshardingMetricsTimeInterval
+ description: >-
+ The time interval that it takes to apply oplog entries on this recipient.
+ optional: true
+
ReshardingRecipientDocument:
description: "Represents a resharding operation on the recipient shard."
inline_chained_structs: true
@@ -62,3 +82,6 @@ structs:
startConfigTxnCloneTime:
type: date
optional: true
+ metrics:
+ type: ReshardingRecipientMetrics
+ description: "Metrics related to this recipient."
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 f816e805262..5bb026932fd 100644
--- a/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp
@@ -277,7 +277,8 @@ public:
_reshardingUUID, _originalNss, UUID::gen(), _tempNss, _newShardKey.toBSON());
ReshardingCoordinatorDocument doc(state,
{DonorShardEntry(ShardId("shard0000"), {})},
- {RecipientShardEntry(ShardId("shard0001"), {})});
+ {RecipientShardEntry(ShardId("shard0001"), {})},
+ ReshardingCoordinatorMetrics());
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 5eb46cc7044..58de1d6d76b 100644
--- a/src/mongo/db/s/resharding/resharding_coordinator_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_coordinator_test.cpp
@@ -90,7 +90,8 @@ protected:
_reshardingUUID, _originalNss, UUID::gen(), _tempNss, _newShardKey.toBSON());
ReshardingCoordinatorDocument doc(state,
{DonorShardEntry(ShardId("shard0000"), {})},
- {RecipientShardEntry(ShardId("shard0001"), {})});
+ {RecipientShardEntry(ShardId("shard0001"), {})},
+ ReshardingCoordinatorMetrics());
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 540ee2ff1b1..997368c3adb 100644
--- a/src/mongo/db/s/resharding/resharding_donor_recipient_common.cpp
+++ b/src/mongo/db/s/resharding/resharding_donor_recipient_common.cpp
@@ -267,7 +267,8 @@ ReshardingRecipientDocument constructRecipientDocumentFromReshardingFields(
auto recipientDoc = ReshardingRecipientDocument{
std::move(recipientCtx),
reshardingFields.getRecipientFields()->getDonorShards(),
- reshardingFields.getRecipientFields()->getMinimumOperationDurationMillis()};
+ reshardingFields.getRecipientFields()->getMinimumOperationDurationMillis(),
+ ReshardingRecipientMetrics()};
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 324cf62bd42..ed192bfb311 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
@@ -154,8 +154,10 @@ protected:
RecipientShardContext recipCtx;
recipCtx.setState(RecipientStateEnum::kCloning);
- ReshardingRecipientDocument doc(
- std::move(recipCtx), {kThisShard.getShardId(), kOtherShard.getShardId()}, 1000);
+ ReshardingRecipientDocument doc(std::move(recipCtx),
+ {kThisShard.getShardId(), kOtherShard.getShardId()},
+ 1000,
+ ReshardingRecipientMetrics());
NamespaceString sourceNss = kOriginalNss;
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 8b659257a30..2527bd79986 100644
--- a/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp
@@ -228,7 +228,8 @@ public:
{ShardId{"donor1"},
isAlsoDonor ? recipientShardId : ShardId{"donor2"},
ShardId{"donor3"}},
- durationCount<Milliseconds>(Milliseconds{5}));
+ durationCount<Milliseconds>(Milliseconds{5}),
+ ReshardingRecipientMetrics());
NamespaceString sourceNss("sourcedb", "sourcecollection");
auto sourceUUID = UUID::gen();