diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-07-17 15:10:45 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-07-18 16:51:59 -0400 |
commit | 8cd40debb70c269710eebdb5bdfc3e70e0b935f9 (patch) | |
tree | 96c175ff556119c826335635d014c9e573d55f41 /src | |
parent | 4140c9b64962ecc4c1520f608e3c3085ec4529f8 (diff) | |
download | mongo-8cd40debb70c269710eebdb5bdfc3e70e0b935f9.tar.gz |
SERVER-29834 make every moveChunk request set the last opTime to wait for writeConcern for
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/s/move_chunk_command.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mongo/db/s/move_chunk_command.cpp b/src/mongo/db/s/move_chunk_command.cpp index eb14fb36943..3fdbe86909b 100644 --- a/src/mongo/db/s/move_chunk_command.cpp +++ b/src/mongo/db/s/move_chunk_command.cpp @@ -162,6 +162,17 @@ public: } uassertStatusOK(status); + + if (moveChunkRequest.getWaitForDelete()) { + // Ensure we capture the latest opTime in the system, since range deletion happens + // asynchronously with a different OperationContext. This must be done after the above + // join, because each caller must set the opTime to wait for writeConcern for on its own + // OperationContext. + // TODO (SERVER-30183): If this moveChunk joined an active moveChunk that did not have + // waitForDelete=true, the captured opTime may not reflect all the deletes. + repl::ReplClientInfo::forClient(opCtx->getClient()).setLastOpToSystemLastOpTime(opCtx); + } + return true; } @@ -268,10 +279,6 @@ private: } else if (moveChunkRequest.getWaitForDelete()) { log() << "Waiting for cleanup of " << nss.ns() << " range " << redact(range.toString()); uassertStatusOK(notification.waitStatus(opCtx)); - - // Ensure that wait for write concern for the chunk cleanup will include the deletes - // performed by the range deleter thread. - repl::ReplClientInfo::forClient(opCtx->getClient()).setLastOpToSystemLastOpTime(opCtx); } else { log() << "Leaving cleanup of " << nss.ns() << " range " << redact(range.toString()) << " to complete in background"; |