diff --git a/src/mongo/db/storage/ephemeral_for_test/SConscript b/src/mongo/db/storage/ephemeral_for_test/SConscript index d876aa0b96d..2779d423dc2 100644 --- a/src/mongo/db/storage/ephemeral_for_test/SConscript +++ b/src/mongo/db/storage/ephemeral_for_test/SConscript @@ -26,6 +26,7 @@ env.Library( '$BUILD_DIR/mongo/db/storage/key_string', '$BUILD_DIR/mongo/db/storage/storage_options', '$BUILD_DIR/mongo/db/storage/write_unit_of_work', + '$BUILD_DIR/mongo/util/fail_point', ], ) diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.cpp index f3726d1ace6..78c79223fc3 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.cpp @@ -36,9 +36,13 @@ #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/record_id_helpers.h" #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h" +#include "mongo/util/fail_point.h" namespace mongo { namespace ephemeral_for_test { +namespace { +MONGO_FAIL_POINT_DEFINE(EFTAlwaysThrowWCEOnWrite); +} // namespace RecoveryUnit::RecoveryUnit(KVEngine* parentKVEngine, std::function cb) : _waitUntilDurableCallback(cb), _KVEngine(parentKVEngine) {} @@ -115,6 +119,13 @@ void RecoveryUnit::doAbandonSnapshot() { _setMergeNull(); } +void RecoveryUnit::makeDirty() { + if (MONGO_unlikely(EFTAlwaysThrowWCEOnWrite.shouldFail())) { + throw WriteConflictException(); + } + _dirty = true; +} + bool RecoveryUnit::forkIfNeeded() { if (_forked) return false; diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h index 0352382c864..c58ce201f42 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h @@ -92,9 +92,7 @@ public: return &_workingCopy; } - inline void makeDirty() { - _dirty = true; - } + void makeDirty(); /** * Checks if there already exists a current working copy and merge base; if not fetches