summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@mongodb.com>2021-07-26 17:35:15 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-27 19:55:55 +0000
commite21a59d53ffb6ebd0fe3194057d4850ff7f6c3f3 (patch)
tree1f933a0d5a70dd26edacf93a9ec399f8cc99def6 /src
parent85938f0ae7c81ecca90bdfd6addd2d9446cf0d3d (diff)
downloadmongo-e21a59d53ffb6ebd0fe3194057d4850ff7f6c3f3.tar.gz
SERVER-49714 Specially support only a single oplog collection, local.oplog.rs, rather than local.oplog.*
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/storage/record_store_test_oplog.cpp2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp10
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h3
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp3
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp12
5 files changed, 12 insertions, 18 deletions
diff --git a/src/mongo/db/storage/record_store_test_oplog.cpp b/src/mongo/db/storage/record_store_test_oplog.cpp
index 1957ae409cb..31d11d09307 100644
--- a/src/mongo/db/storage/record_store_test_oplog.cpp
+++ b/src/mongo/db/storage/record_store_test_oplog.cpp
@@ -72,7 +72,7 @@ TEST(RecordStoreTestHarness, OplogHack) {
// the test itself.
const int64_t cappedMaxSize = 10 * 1024; // 10KB
std::unique_ptr<RecordStore> rs(
- harnessHelper->newCappedRecordStore("local.oplog.foo", cappedMaxSize, -1));
+ harnessHelper->newCappedRecordStore("local.oplog.rs", cappedMaxSize, -1));
{
ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index cffeef5e474..ca750c49f1b 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -2309,18 +2309,12 @@ bool WiredTigerKVEngine::supportsOplogStones() const {
void WiredTigerKVEngine::startOplogManager(OperationContext* opCtx,
WiredTigerRecordStore* oplogRecordStore) {
stdx::lock_guard<Latch> lock(_oplogManagerMutex);
- if (_oplogManagerCount == 0)
- _oplogManager->startVisibilityThread(opCtx, oplogRecordStore);
- _oplogManagerCount++;
+ _oplogManager->startVisibilityThread(opCtx, oplogRecordStore);
}
void WiredTigerKVEngine::haltOplogManager() {
stdx::unique_lock<Latch> lock(_oplogManagerMutex);
- invariant(_oplogManagerCount > 0);
- _oplogManagerCount--;
- if (_oplogManagerCount == 0) {
- _oplogManager->haltVisibilityThread();
- }
+ _oplogManager->haltVisibilityThread();
}
bool WiredTigerKVEngine::isCacheUnderPressure(OperationContext* opCtx) const {
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
index e438b37fd95..2c7093a2f41 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
@@ -419,9 +419,8 @@ private:
std::unique_ptr<WiredTigerSessionCache> _sessionCache;
ClockSource* const _clockSource;
- // Mutex to protect use of _oplogManagerCount by this instance of KV engine.
+ // Mutex to protect use of _oplogManager by this instance of KV engine.
mutable Mutex _oplogManagerMutex = MONGO_MAKE_LATCH("::_oplogManagerMutex");
- std::size_t _oplogManagerCount = 0;
std::unique_ptr<WiredTigerOplogManager> _oplogManager;
std::string _canonicalName;
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index a60c6b15009..acf3ce2cce1 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -823,7 +823,8 @@ WiredTigerRecordStore::WiredTigerRecordStore(WiredTigerKVEngine* kvEngine,
NamespaceString(ns()),
getGlobalReplSettings().usingReplSets() ||
repl::ReplSettings::shouldRecoverFromOplogAsStandalone())),
- _isOplog(NamespaceString::oplog(params.ns)),
+ // We will only provide special support to the local.oplog.rs collection.
+ _isOplog(NamespaceString::kRsOplogNamespace.toString() == params.ns),
_cappedMaxSize(params.cappedMaxSize),
_cappedMaxSizeSlack(std::min(params.cappedMaxSize / 10, int64_t(16 * 1024 * 1024))),
_cappedMaxDocs(params.cappedMaxDocs),
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
index cd914b61f68..b5449daa827 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
@@ -440,7 +440,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_CreateNewStone) {
const int64_t cappedMaxSize = 10 * 1024; // 10KB
unique_ptr<RecordStore> rs(
- harnessHelper->newCappedRecordStore("local.oplog.stones", cappedMaxSize, -1));
+ harnessHelper->newCappedRecordStore("local.oplog.rs", cappedMaxSize, -1));
WiredTigerRecordStore* wtrs = static_cast<WiredTigerRecordStore*>(rs.get());
WiredTigerRecordStore::OplogStones* oplogStones = wtrs->oplogStones();
@@ -496,7 +496,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_UpdateRecord) {
const int64_t cappedMaxSize = 10 * 1024; // 10KB
unique_ptr<RecordStore> rs(
- harnessHelper->newCappedRecordStore("local.oplog.stones", cappedMaxSize, -1));
+ harnessHelper->newCappedRecordStore("local.oplog.rs", cappedMaxSize, -1));
WiredTigerRecordStore* wtrs = static_cast<WiredTigerRecordStore*>(rs.get());
WiredTigerRecordStore::OplogStones* oplogStones = wtrs->oplogStones();
@@ -571,7 +571,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_Truncate) {
const int64_t cappedMaxSize = 10 * 1024; // 10KB
unique_ptr<RecordStore> rs(
- harnessHelper->newCappedRecordStore("local.oplog.stones", cappedMaxSize, -1));
+ harnessHelper->newCappedRecordStore("local.oplog.rs", cappedMaxSize, -1));
WiredTigerRecordStore* wtrs = static_cast<WiredTigerRecordStore*>(rs.get());
WiredTigerRecordStore::OplogStones* oplogStones = wtrs->oplogStones();
@@ -616,7 +616,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_CappedTruncateAfter) {
const int64_t cappedMaxSize = 10 * 1024; // 10KB
unique_ptr<RecordStore> rs(
- harnessHelper->newCappedRecordStore("local.oplog.stones", cappedMaxSize, -1));
+ harnessHelper->newCappedRecordStore("local.oplog.rs", cappedMaxSize, -1));
WiredTigerRecordStore* wtrs = static_cast<WiredTigerRecordStore*>(rs.get());
WiredTigerRecordStore::OplogStones* oplogStones = wtrs->oplogStones();
@@ -725,7 +725,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_ReclaimStones) {
const int64_t cappedMaxSize = 10 * 1024; // 10KB
unique_ptr<RecordStore> rs(
- harnessHelper->newCappedRecordStore("local.oplog.stones", cappedMaxSize, -1));
+ harnessHelper->newCappedRecordStore("local.oplog.rs", cappedMaxSize, -1));
WiredTigerRecordStore* wtrs = static_cast<WiredTigerRecordStore*>(rs.get());
WiredTigerRecordStore::OplogStones* oplogStones = wtrs->oplogStones();
@@ -826,7 +826,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_AscendingOrder) {
const int64_t cappedMaxSize = 10 * 1024; // 10KB
unique_ptr<RecordStore> rs(
- harnessHelper->newCappedRecordStore("local.oplog.stones", cappedMaxSize, -1));
+ harnessHelper->newCappedRecordStore("local.oplog.rs", cappedMaxSize, -1));
WiredTigerRecordStore* wtrs = static_cast<WiredTigerRecordStore*>(rs.get());
WiredTigerRecordStore::OplogStones* oplogStones = wtrs->oplogStones();