summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Nawrocki <brett.nawrocki@mongodb.com>2021-12-20 21:33:28 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-09 21:02:16 +0000
commita3675d1fd04bd8985f88ecf128ed336e59c53e6c (patch)
tree45ab44671b1db583733b7c8a1d1f456827310467
parent4bc6d8f8a4b08d2ff848c4f56a905703453f9324 (diff)
downloadmongo-a3675d1fd04bd8985f88ecf128ed336e59c53e6c.tar.gz
SERVER-62072 Reshard command waits for cleanup to be majority committed
The _configsvrReshardCollection command waits on the completion future returned by the ReshardingCoordinator. This completion future becomes ready after the local replica set transaction to delete the config.reshardingOperations document and unset the reshardingFields from the config.collections entry commits with w:majority. However, if there is a step down and the new primary has already replicated these deletes, the command will return despite those deletes not necessarily being majority committed. If a rollback occurs, the command could then return without fully cleaning up the resharding operation by leaving the reshardingFields in the config.collections entry. Now, _configsvrReshardCollection will wait on the last system op time to ensure the cleanup has been majority committed. (cherry picked from commit 997bade5afb420cdf369d7fc66d7cb9498230635)
-rw-r--r--src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp2
1 files changed, 2 insertions, 0 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 d01565329f4..da6fcccf8db 100644
--- a/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp
+++ b/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/commands/feature_compatibility_version.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
#include "mongo/db/repl/primary_only_service.h"
+#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/s/resharding/coordinator_document_gen.h"
#include "mongo/db/s/resharding/resharding_coordinator_service.h"
#include "mongo/db/s/resharding/resharding_server_parameters_gen.h"
@@ -222,6 +223,7 @@ public:
// requested shard key. Wait until the work is complete.
instance.get()->getCompletionFuture().get(opCtx);
}
+ repl::ReplClientInfo::forClient(opCtx->getClient()).setLastOpToSystemLastOpTime(opCtx);
}
private: