0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00

SERVER-57775 add EFTAlwaysThrowWCEOnWrite fail point

This serves a similar purpose to WTWriteConflictException for the WiredTiger storage engine.
This commit is contained in:
Benety Goh 2021-06-17 13:01:58 -04:00 committed by Evergreen Agent
parent c865688f19
commit 9753384b0d
3 changed files with 13 additions and 3 deletions

View File

@ -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',
],
)

View File

@ -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<void()> 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;

View File

@ -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