diff options
author | Randolph Tan <randolph@10gen.com> | 2017-10-03 16:44:56 -0400 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2017-10-07 20:09:35 -0400 |
commit | 155db509a8e376211095cec062f7aa5be1b7707e (patch) | |
tree | 9ef6f0130061db25fad109ab275c982eab79af5a /src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp | |
parent | 3d42a318626e059b2669356bb5d39056b8fa1b76 (diff) | |
download | mongo-155db509a8e376211095cec062f7aa5be1b7707e.tar.gz |
SERVER-31030 Make sure that _getNextSessionMods will only contain oplog entries that are majority committed
Diffstat (limited to 'src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp')
-rw-r--r-- | src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp index d42c6bdaa99..a6f0f5c7f18 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp @@ -41,6 +41,7 @@ #include "mongo/db/s/migration_chunk_cloner_source_legacy.h" #include "mongo/db/s/migration_source_manager.h" #include "mongo/db/s/sharding_state.h" +#include "mongo/db/write_concern.h" /** * This file contains commands, which are specific to the legacy chunk cloner source. @@ -259,8 +260,17 @@ public: BSONArrayBuilder arrBuilder; - AutoGetActiveCloner autoCloner(opCtx, migrationSessionId); - autoCloner.getCloner()->nextSessionMigrationBatch(opCtx, &arrBuilder); + repl::OpTime opTime; + + { + AutoGetActiveCloner autoCloner(opCtx, migrationSessionId); + opTime = autoCloner.getCloner()->nextSessionMigrationBatch(opCtx, &arrBuilder); + } + + WriteConcernResult wcResult; + WriteConcernOptions majorityWC( + WriteConcernOptions::kMajority, WriteConcernOptions::SyncMode::UNSET, 0); + uassertStatusOK(waitForWriteConcern(opCtx, opTime, majorityWC, &wcResult)); result.appendArray("oplog", arrBuilder.arr()); return true; |