summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmirsaman Memaripour <amirsaman.memaripour@mongodb.com>2020-06-08 20:34:13 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-19 02:10:48 +0000
commit4a4f6d705d2ba6b71a17e43634b12cb807025e66 (patch)
tree6e865f0af200e3b3526ff46e6f98eb9f84377a08
parent3ec2dadba19f0c31924cffed020ed884bbe1d034 (diff)
downloadmongo-4a4f6d705d2ba6b71a17e43634b12cb807025e66.tar.gz
SERVER-46726 Using testing proctor to control diagnostics in "db/storage"
(cherry picked from commit ac9c07e1014ec0ab28ec90522c8d5043c4bacbc8)
-rw-r--r--src/mongo/db/storage/wiredtiger/SConscript1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp5
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp5
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp6
4 files changed, 9 insertions, 8 deletions
diff --git a/src/mongo/db/storage/wiredtiger/SConscript b/src/mongo/db/storage/wiredtiger/SConscript
index 73eeed396c7..0f073876635 100644
--- a/src/mongo/db/storage/wiredtiger/SConscript
+++ b/src/mongo/db/storage/wiredtiger/SConscript
@@ -54,7 +54,6 @@ if wiredtiger:
LIBDEPS= [
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/bson/dotted_path_support',
- '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
'$BUILD_DIR/mongo/db/catalog/collection',
'$BUILD_DIR/mongo/db/catalog/collection_options',
'$BUILD_DIR/mongo/db/concurrency/lock_manager',
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
index a2b51811df8..6a6d49031a4 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
@@ -57,6 +57,7 @@
#include "mongo/util/fail_point.h"
#include "mongo/util/hex.h"
#include "mongo/util/str.h"
+#include "mongo/util/testing_proctor.h"
#define TRACING_ENABLED 0
@@ -1149,8 +1150,8 @@ protected:
"newKey"_attr = redact(toHex(item.data, item.size)),
"prevKey"_attr = redact(_key.toString()));
- // Crash when test commands are enabled.
- invariant(!getTestCommandsEnabled());
+ // Crash when testing diagnostics are enabled.
+ invariant(!TestingProctor::instance().isEnabled());
// Force a retry of the operation from our last known position by acting as-if
// we received a WT_ROLLBACK error.
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index 3df894b1d79..83403534624 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -95,6 +95,7 @@
#include "mongo/util/processinfo.h"
#include "mongo/util/quick_exit.h"
#include "mongo/util/scopeguard.h"
+#include "mongo/util/testing_proctor.h"
#include "mongo/util/time_support.h"
#if !defined(__has_feature)
@@ -971,7 +972,7 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName,
}
}
- if (_ephemeral && !getTestCommandsEnabled()) {
+ if (_ephemeral && !TestingProctor::instance().isEnabled()) {
// We do not maintain any snapshot history for the ephemeral storage engine in production
// because replication and sharded transactions do not currently run on the inMemory engine.
// It is live in testing, however.
@@ -2171,7 +2172,7 @@ Timestamp WiredTigerKVEngine::_calculateHistoryLagFromStableTimestamp(Timestamp
// The oldest_timestamp should lag behind the stable_timestamp by
// 'targetSnapshotHistoryWindowInSeconds' seconds.
- if (_ephemeral && !getTestCommandsEnabled()) {
+ if (_ephemeral && !TestingProctor::instance().isEnabled()) {
// No history should be maintained for the inMemory engine because it is not used yet.
invariant(snapshotWindowParams.targetSnapshotHistoryWindowInSeconds.load() == 0);
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index 4348156ade7..f1d127e7744 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -43,7 +43,6 @@
#include "mongo/base/checked_cast.h"
#include "mongo/base/static_assert.h"
#include "mongo/bson/util/builder.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/concurrency/locker.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/global_settings.h"
@@ -69,6 +68,7 @@
#include "mongo/util/fail_point.h"
#include "mongo/util/scopeguard.h"
#include "mongo/util/str.h"
+#include "mongo/util/testing_proctor.h"
#include "mongo/util/time_support.h"
#include "mongo/util/timer.h"
@@ -2157,8 +2157,8 @@ boost::optional<Record> WiredTigerRecordStoreCursorBase::next() {
"next"_attr = id,
"last"_attr = _lastReturnedId);
- // Crash when test commands are enabled.
- invariant(!getTestCommandsEnabled());
+ // Crash when testing diagnostics are enabled.
+ invariant(!TestingProctor::instance().isEnabled());
// Force a retry of the operation from our last known position by acting as-if
// we received a WT_ROLLBACK error.