summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorEric Milkie <milkie@mongodb.com>2019-12-30 15:12:48 +0000
committerevergreen <evergreen@mongodb.com>2019-12-30 15:12:48 +0000
commit04bbe5f2abf8945330a26d50257eb0a550f32af1 (patch)
tree9917ccec21b8cee1124ae55e0c0732dc59fc6d72 /src/mongo
parentede1a05cab81580150ac19579b09bd154af9f7f1 (diff)
downloadmongo-04bbe5f2abf8945330a26d50257eb0a550f32af1.tar.gz
Revert "SERVER-45288 switch Idempotency tests to use WiredTiger instead of ephemeralForTest"
This reverts commit 185facf0acf9c22e09893051a28040e8ee39292b.
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/repl/SConscript1
-rw-r--r--src/mongo/db/repl/idempotency_test_fixture.h3
-rw-r--r--src/mongo/db/repl/oplog_applier_impl_test.cpp29
-rw-r--r--src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp5
-rw-r--r--src/mongo/db/repl/oplog_applier_impl_test_fixture.h5
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp12
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp16
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h5
-rw-r--r--src/mongo/idl/server_parameter.cpp4
-rw-r--r--src/mongo/idl/server_parameter.h1
10 files changed, 44 insertions, 37 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 6ae0868a017..7794870345c 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -581,7 +581,6 @@ env.Library(
'$BUILD_DIR/mongo/db/catalog/document_validation',
'$BUILD_DIR/mongo/db/s/op_observer_sharding_impl',
'$BUILD_DIR/mongo/db/service_context_d_test_fixture',
- '$BUILD_DIR/mongo/db/storage/wiredtiger/storage_wiredtiger',
],
)
diff --git a/src/mongo/db/repl/idempotency_test_fixture.h b/src/mongo/db/repl/idempotency_test_fixture.h
index 6b188a0e9ba..f3f990cb8da 100644
--- a/src/mongo/db/repl/idempotency_test_fixture.h
+++ b/src/mongo/db/repl/idempotency_test_fixture.h
@@ -88,9 +88,6 @@ StringBuilderImpl<SharedBufferAllocator>& operator<<(StringBuilderImpl<SharedBuf
const CollectionState& state);
class IdempotencyTest : public OplogApplierImplTest {
-public:
- IdempotencyTest() : OplogApplierImplTest("wiredTiger"){};
-
protected:
enum class SequenceType : int { kEntireSequence, kAnyPrefix, kAnySuffix, kAnyPrefixOrSuffix };
OplogEntry createCollection(CollectionUUID uuid = UUID::gen());
diff --git a/src/mongo/db/repl/oplog_applier_impl_test.cpp b/src/mongo/db/repl/oplog_applier_impl_test.cpp
index a851ee49917..29dacb12728 100644
--- a/src/mongo/db/repl/oplog_applier_impl_test.cpp
+++ b/src/mongo/db/repl/oplog_applier_impl_test.cpp
@@ -2113,6 +2113,35 @@ TEST_F(IdempotencyTest, CreateCollectionWithCollation) {
ASSERT_EQUALS(state1, state2);
}
+TEST_F(IdempotencyTest, CreateCollectionWithIdIndex) {
+ ASSERT_OK(ReplicationCoordinator::get(getGlobalServiceContext())
+ ->setFollowerMode(MemberState::RS_RECOVERING));
+ CollectionUUID uuid = kUuid;
+
+ auto options1 = BSON("idIndex" << BSON("key" << fromjson("{_id: 1}") << "name"
+ << "_id_"
+ << "v" << 2)
+ << "uuid" << uuid);
+ auto createColl1 = makeCreateCollectionOplogEntry(nextOpTime(), nss, options1);
+ ASSERT_OK(runOpInitialSync(createColl1));
+
+ auto runOpsAndValidate = [this, uuid]() {
+ auto insertOp = insert(BSON("_id" << Decimal128(1)));
+ auto dropColl = makeCommandOplogEntry(nextOpTime(), nss, BSON("drop" << nss.coll()));
+ auto createColl2 = createCollection(uuid);
+
+ auto ops = {insertOp, dropColl, createColl2};
+ ASSERT_OK(runOpsInitialSync(ops));
+ auto state = validate();
+
+ return state;
+ };
+
+ auto state1 = runOpsAndValidate();
+ auto state2 = runOpsAndValidate();
+ ASSERT_EQUALS(state1, state2);
+}
+
TEST_F(IdempotencyTest, CreateCollectionWithView) {
ASSERT_OK(ReplicationCoordinator::get(getGlobalServiceContext())
->setFollowerMode(MemberState::RS_RECOVERING));
diff --git a/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp b/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp
index 7e3f8d89040..523bb93f1a1 100644
--- a/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp
+++ b/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp
@@ -35,7 +35,6 @@
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
-#include "mongo/db/logical_clock.h"
#include "mongo/db/op_observer_registry.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/repl/drop_pending_collection_reaper.h"
@@ -120,10 +119,6 @@ void OplogApplierImplTest::setUp() {
// the server parameter.
serverGlobalParams.featureCompatibility.setVersion(
ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44);
-
- // This is necessary to generate ghost timestamps for index builds that are not 0, since 0 is an
- // invalid timestamp.
- ASSERT_OK(LogicalClock::get(_opCtx.get())->advanceClusterTime(LogicalTime(Timestamp(1, 0))));
}
void OplogApplierImplTest::tearDown() {
diff --git a/src/mongo/db/repl/oplog_applier_impl_test_fixture.h b/src/mongo/db/repl/oplog_applier_impl_test_fixture.h
index 10aa03fea65..204fa7b3a08 100644
--- a/src/mongo/db/repl/oplog_applier_impl_test_fixture.h
+++ b/src/mongo/db/repl/oplog_applier_impl_test_fixture.h
@@ -122,11 +122,6 @@ public:
};
class OplogApplierImplTest : public ServiceContextMongoDTest {
-public:
- OplogApplierImplTest(){};
- OplogApplierImplTest(std::string storageEngine)
- : ServiceContextMongoDTest(std::move(storageEngine)){};
-
protected:
void _testApplyOplogEntryOrGroupedInsertsCrudOperation(ErrorCodes::Error expectedError,
const OplogEntry& op,
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
index ec034eccc34..ee9c8ea6027 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
@@ -130,9 +130,21 @@ public:
MONGO_COMPILER_VARIABLE_UNUSED auto leakedSection =
new WiredTigerServerStatusSection(kv);
+ auto* param = new WiredTigerEngineRuntimeConfigParameter(
+ "wiredTigerEngineRuntimeConfig", ServerParameterType::kRuntimeOnly);
+ param->_data.second = kv;
+
+ auto* maxCacheOverflowParam = new WiredTigerMaxCacheOverflowSizeGBParameter(
+ "wiredTigerMaxCacheOverflowSizeGB", ServerParameterType::kRuntimeOnly);
+ maxCacheOverflowParam->_data = {wiredTigerGlobalOptions.maxCacheOverflowFileSizeGB, kv};
+
// This allows unit tests to run this code without encountering memory leaks
+ // TODO (SERVER-43063): to fix the global server parameter registry memory leak. The
+ // server status section leak will still exist after SERVER-43063.
#if __has_feature(address_sanitizer)
__lsan_ignore_object(leakedSection);
+ __lsan_ignore_object(param);
+ __lsan_ignore_object(maxCacheOverflowParam);
#endif
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index dd63aad920a..2013e2fed91 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -797,22 +797,12 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName,
_sizeStorer = std::make_unique<WiredTigerSizeStorer>(_conn, _sizeStorerUri, _readOnly);
Locker::setGlobalThrottling(&openReadTransaction, &openWriteTransaction);
-
- _runTimeConfigParam.reset(new WiredTigerEngineRuntimeConfigParameter(
- "wiredTigerEngineRuntimeConfig", ServerParameterType::kRuntimeOnly));
- _runTimeConfigParam->_data.second = this;
- _maxCacheOverflowParam.reset(new WiredTigerMaxCacheOverflowSizeGBParameter(
- "wiredTigerMaxCacheOverflowSizeGB", ServerParameterType::kRuntimeOnly));
- _maxCacheOverflowParam->_data = {maxCacheOverflowFileSizeMB / 1024, this};
}
WiredTigerKVEngine::~WiredTigerKVEngine() {
- // Remove server parameters that we added in the constructor, to enable unit tests to reload the
- // storage engine again in this same process.
- ServerParameterSet::getGlobal()->remove("wiredTigerEngineRuntimeConfig");
- ServerParameterSet::getGlobal()->remove("wiredTigerMaxCacheOverflowSizeGB");
-
- cleanShutdown();
+ if (_conn) {
+ cleanShutdown();
+ }
_sessionCache.reset(nullptr);
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
index ca4c51c1ccd..8c0eb10d8f8 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
@@ -55,8 +55,6 @@ class JournalListener;
class WiredTigerRecordStore;
class WiredTigerSessionCache;
class WiredTigerSizeStorer;
-class WiredTigerEngineRuntimeConfigParameter;
-class WiredTigerMaxCacheOverflowSizeGBParameter;
struct WiredTigerFileVersion {
enum class StartupVersion { IS_34, IS_36, IS_40, IS_42, IS_44 };
@@ -492,8 +490,5 @@ private:
//
// Access must be protected by the CheckpointLock.
std::list<std::string> _checkpointedIndexes;
-
- std::unique_ptr<WiredTigerEngineRuntimeConfigParameter> _runTimeConfigParam;
- std::unique_ptr<WiredTigerMaxCacheOverflowSizeGBParameter> _maxCacheOverflowParam;
};
} // namespace mongo
diff --git a/src/mongo/idl/server_parameter.cpp b/src/mongo/idl/server_parameter.cpp
index 3f9d2c50d3c..975f2b515e6 100644
--- a/src/mongo/idl/server_parameter.cpp
+++ b/src/mongo/idl/server_parameter.cpp
@@ -113,10 +113,6 @@ StatusWith<std::string> ServerParameter::coerceToString(const BSONElement& eleme
}
}
-void ServerParameterSet::remove(const std::string& name) {
- invariant(1 == _map.erase(name));
-}
-
IDLServerParameterDeprecatedAlias::IDLServerParameterDeprecatedAlias(StringData name,
ServerParameter* sp)
: ServerParameter(ServerParameterSet::getGlobal(),
diff --git a/src/mongo/idl/server_parameter.h b/src/mongo/idl/server_parameter.h
index 74a1971053c..4fa5ba6b6f7 100644
--- a/src/mongo/idl/server_parameter.h
+++ b/src/mongo/idl/server_parameter.h
@@ -138,7 +138,6 @@ public:
using Map = ServerParameter::Map;
void add(ServerParameter* sp);
- void remove(const std::string& name);
const Map& getMap() const {
return _map;