summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-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