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:
parent
c865688f19
commit
9753384b0d
@ -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',
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user