summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Pe <erwin.pe@mongodb.com>2022-08-23 20:49:55 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-23 21:22:28 +0000
commitbd958b2eb85837e8460d257fe7f34c12d2a55789 (patch)
tree1f97f537f333e39c41daca7e088de2b0573e628a
parent68f7db659a68b0cdb90e73715dfd2c821a9854a6 (diff)
downloadmongo-bd958b2eb85837e8460d257fe7f34c12d2a55789.tar.gz
SERVER-67909 Skip dropping a non-existent temp ECOC collection in the compact coordinator
(cherry picked from commit 3d49923b38176803e5c9e62edd8889137b3ac18f)
-rw-r--r--src/mongo/db/s/compact_structured_encryption_data_coordinator.cpp56
1 files changed, 37 insertions, 19 deletions
diff --git a/src/mongo/db/s/compact_structured_encryption_data_coordinator.cpp b/src/mongo/db/s/compact_structured_encryption_data_coordinator.cpp
index 377a186eec4..3a1e04c017b 100644
--- a/src/mongo/db/s/compact_structured_encryption_data_coordinator.cpp
+++ b/src/mongo/db/s/compact_structured_encryption_data_coordinator.cpp
@@ -46,6 +46,8 @@
namespace mongo {
namespace {
+MONGO_FAIL_POINT_DEFINE(fleCompactHangAfterDropTempCollection);
+
const auto kMajorityWriteConcern = BSON("writeConcern" << BSON("w"
<< "majority"));
/**
@@ -173,10 +175,21 @@ void doDropOperation(const CompactStructuredEncryptionDataState& state) {
"Cannot drop temporary encrypted compaction collection due to missing collection UUID",
state.getEcocRenameUuid().has_value());
+ auto opCtx = cc().makeOperationContext();
+ auto catalog = CollectionCatalog::get(opCtx.get());
auto ecocNss = state.getEcocRenameNss();
+ auto ecocUuid = catalog->lookupUUIDByNSS(opCtx.get(), ecocNss);
+
+ if (!ecocUuid) {
+ LOGV2_DEBUG(
+ 6790901,
+ 1,
+ "Skipping drop operation as temporary encrypted compaction collection does not exist");
+ return;
+ }
+
Drop cmd(ecocNss);
cmd.setCollectionUUID(state.getEcocRenameUuid().value());
- auto opCtx = cc().makeOperationContext();
doRunCommand(opCtx.get(), ecocNss.db(), cmd);
}
@@ -282,24 +295,29 @@ ExecutorFuture<void> CompactStructuredEncryptionDataCoordinator::_runImpl(
[this, anchor = shared_from_this()](const auto& state) {
_response = doCompactOperation(state);
}))
- .then(_executePhase(Phase::kDropTempCollection,
- [this, anchor = shared_from_this()](const auto& state) {
- try {
- // restore the response that was stored in the compactionTokens
- // field
- IDLParserErrorContext ctxt("response");
- _response = CompactStructuredEncryptionDataCommandReply::parse(
- ctxt, state.getCompactionTokens());
- } catch (...) {
- LOGV2_ERROR(6846101,
- "Failed to parse response from "
- "CompactStructuredEncryptionDataState document",
- "response"_attr = state.getCompactionTokens());
- // ignore for compatibility with 6.0.0
- }
-
- doDropOperation(state);
- }));
+ .then(_executePhase(
+ Phase::kDropTempCollection, [this, anchor = shared_from_this()](const auto& state) {
+ try {
+ // restore the response that was stored in the compactionTokens
+ // field
+ IDLParserErrorContext ctxt("response");
+ _response = CompactStructuredEncryptionDataCommandReply::parse(
+ ctxt, state.getCompactionTokens());
+ } catch (...) {
+ LOGV2_ERROR(6846101,
+ "Failed to parse response from "
+ "CompactStructuredEncryptionDataState document",
+ "response"_attr = state.getCompactionTokens());
+ // ignore for compatibility with 6.0.0
+ }
+
+ doDropOperation(state);
+ if (MONGO_unlikely(fleCompactHangAfterDropTempCollection.shouldFail())) {
+ LOGV2(6790902,
+ "Hanging due to fleCompactHangAfterDropTempCollection fail point");
+ fleCompactHangAfterDropTempCollection.pauseWhileSet();
+ }
+ }));
}
} // namespace mongo