diff options
author | nandinibhartiyaMDB <nandini.bhartiya@mongodb.com> | 2022-06-08 15:54:11 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-09 15:13:46 +0000 |
commit | 2f1e8dc34c7ddfa1c9dccab011759a12532c8219 (patch) | |
tree | f247ce5a740a5ba1ed3e0334f4d73176b8bf3bbe /src | |
parent | b0aeed9445ff41af07449fa757e1f231bce990b3 (diff) | |
download | mongo-2f1e8dc34c7ddfa1c9dccab011759a12532c8219.tar.gz |
SERVER-62272 : Migration OK for chunks existing before schema validator
(cherry picked from commit bc1ac6fb2eb66202d1acc08d158b102c57beabbd)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/s/migration_destination_manager.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp index 35f945bccd9..49c2d1dcf76 100644 --- a/src/mongo/db/s/migration_destination_manager.cpp +++ b/src/mongo/db/s/migration_destination_manager.cpp @@ -841,15 +841,20 @@ void MigrationDestinationManager::_migrateDriver(OperationContext* opCtx) { } return toInsert; }()); + { + // Disable the schema validation for opCtx for performInserts() + DisableDocumentValidation documentValidationDisabler(opCtx); - const WriteResult reply = performInserts(opCtx, insertOp, true); + const WriteResult reply = performInserts(opCtx, insertOp, true); - for (unsigned long i = 0; i < reply.results.size(); ++i) { - uassertStatusOKWithContext( - reply.results[i], - str::stream() << "Insert of " << insertOp.getDocuments()[i] << " failed."); + for (unsigned long i = 0; i < reply.results.size(); ++i) { + uassertStatusOKWithContext(reply.results[i], + str::stream() + << "Insert of " << insertOp.getDocuments()[i] + << " failed."); + } + // Revert to the original validation settings for opCtx } - { stdx::lock_guard<Latch> statsLock(_mutex); _numCloned += batchNumCloned; @@ -1058,6 +1063,8 @@ bool MigrationDestinationManager::_applyMigrateOp(OperationContext* opCtx, bool didAnything = false; + DisableDocumentValidation documentValidationDisabler(opCtx); + // Deleted documents if (xfer["deleted"].isABSONObj()) { boost::optional<RemoveSaver> rs; |