diff options
author | Benety Goh <benety@mongodb.com> | 2018-04-04 20:18:59 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2018-04-04 20:18:59 -0400 |
commit | 8e5794077bd5bbaa0e43d39082659493567a3f62 (patch) | |
tree | 435641599c456b0e5642629269bd924bc62f9db9 /src | |
parent | 2e31167d0e2cf179a228afeec71853cfb0f0683f (diff) | |
download | mongo-8e5794077bd5bbaa0e43d39082659493567a3f62.tar.gz |
SERVER-34290 rollback via refetch handles missing dropTarget field
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/repl/rs_rollback.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/repl/rs_rollback_test.cpp | 2 |
2 files changed, 2 insertions, 5 deletions
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index a9c632834b0..46597cf6671 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -429,11 +429,10 @@ Status rollback_internal::updateFixUpInfoFromLocalOplogEntry(FixUpInfo& fixUpInf return Status(ErrorCodes::UnrecoverableRollbackError, message); } - // Checks if dropTarget is false. If it has a UUID value, we need to + // Checks if dropTarget is present. If it has a UUID value, we need to // make sure to un-drop the collection that was dropped in the process // of renaming. - auto dropTarget = obj.getField("dropTarget"); - if (dropTarget.type() != Bool) { + if (auto dropTarget = obj.getField("dropTarget")) { auto status = fixUpInfo.recordDropTargetInfo(dropTarget, obj, oplogEntry.getOpTime()); if (!status.isOK()) { diff --git a/src/mongo/db/repl/rs_rollback_test.cpp b/src/mongo/db/repl/rs_rollback_test.cpp index 258b88d8305..863332d571b 100644 --- a/src/mongo/db/repl/rs_rollback_test.cpp +++ b/src/mongo/db/repl/rs_rollback_test.cpp @@ -152,8 +152,6 @@ OplogInterfaceMock::Operation makeRenameCollectionOplogEntry(const NamespaceStri if (dropTarget) { obj = obj.addField(BSON("dropTarget" << *dropTarget).firstElement()); - } else { - obj = obj.addField(BSON("dropTarget" << false).firstElement()); } return std::make_pair( BSON("ts" << opTime.getTimestamp() << "t" << opTime.getTerm() << "h" << 1LL << "op" |