diff options
author | Dianna Hohensee <dianna.hohensee@mongodb.com> | 2021-05-03 14:33:37 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-04 14:17:22 +0000 |
commit | 3d0d4c4229eb83ac5b2c03dce049c36b0cc736d3 (patch) | |
tree | 56eb6c9d2eee15225db852b753368971be40035e | |
parent | 94fe70d1028241084c6b1b78a99c9464b8c1d1a9 (diff) | |
download | mongo-3d0d4c4229eb83ac5b2c03dce049c36b0cc736d3.tar.gz |
SERVER-49752 Remove redundant ident reaper 'nss' logging
-rw-r--r-- | jstests/replsets/directoryperdb_remove_empty_dirs.js | 3 | ||||
-rw-r--r-- | src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.h | 4 | ||||
-rw-r--r-- | src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp | 39 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_engine.h | 1 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_engine_impl.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_engine_impl.h | 1 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_engine_mock.h | 1 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_util.cpp | 4 |
9 files changed, 19 insertions, 43 deletions
diff --git a/jstests/replsets/directoryperdb_remove_empty_dirs.js b/jstests/replsets/directoryperdb_remove_empty_dirs.js index 1b110f9bc61..0b444c713ae 100644 --- a/jstests/replsets/directoryperdb_remove_empty_dirs.js +++ b/jstests/replsets/directoryperdb_remove_empty_dirs.js @@ -45,7 +45,6 @@ const runTest = function(dropDatabase) { assert.commandWorked(primary.adminCommand({fsync: 1})); // Ensure that the empty database directory was removed. - checkLog.containsJson(primary, 22237, {namespace: dbToDropName + "." + collToDrop.getName()}); checkLog.containsJson(primary, 4888200, {db: dbToDropName}); const files = listFiles(rst.getDbPath(primary)); assert(!files.some(file => file.baseName === dbToDropName), @@ -57,4 +56,4 @@ runTest(false); runTest(true); rst.stopSet(); -})();
\ No newline at end of file +})(); diff --git a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.cpp b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.cpp index f7ab3ec27c1..c39ac904bbb 100644 --- a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.cpp +++ b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.cpp @@ -45,7 +45,6 @@ namespace mongo { KVDropPendingIdentReaper::KVDropPendingIdentReaper(KVEngine* engine) : _engine(engine) {} void KVDropPendingIdentReaper::addDropPendingIdent(const Timestamp& dropTimestamp, - const NamespaceString& nss, std::shared_ptr<Ident> ident, StorageEngine::DropIdentCallback&& onDrop) { stdx::lock_guard<Latch> lock(_mutex); @@ -55,7 +54,6 @@ void KVDropPendingIdentReaper::addDropPendingIdent(const Timestamp& dropTimestam auto matcher = [ident](const auto& pair) { return pair.second.identName == ident->getIdent(); }; if (std::find_if(lowerBound, upperBound, matcher) == upperBound) { IdentInfo info; - info.nss = nss; info.identName = ident->getIdent(); info.dropToken = ident; info.onDrop = std::move(onDrop); @@ -64,7 +62,6 @@ void KVDropPendingIdentReaper::addDropPendingIdent(const Timestamp& dropTimestam LOGV2_FATAL_NOTRACE(51023, "Failed to add drop-pending ident, duplicate timestamp and ident pair", "ident"_attr = ident->getIdent(), - logAttrs(nss), "dropTimestamp"_attr = dropTimestamp); } } @@ -116,12 +113,10 @@ void KVDropPendingIdentReaper::dropIdentsOlderThan(OperationContext* opCtx, cons const auto& dropTimestamp = timestampAndIdentInfo.first; auto& identInfo = timestampAndIdentInfo.second; - const auto& nss = identInfo.nss; const auto& identName = identInfo.identName; LOGV2(22237, "Completing drop for ident", "ident"_attr = identName, - logAttrs(nss), "dropTimestamp"_attr = dropTimestamp); WriteUnitOfWork wuow(opCtx); auto status = @@ -130,7 +125,6 @@ void KVDropPendingIdentReaper::dropIdentsOlderThan(OperationContext* opCtx, cons LOGV2_FATAL_NOTRACE(51022, "Failed to remove drop-pending ident", "ident"_attr = identName, - logAttrs(nss), "dropTimestamp"_attr = dropTimestamp, "error"_attr = status); } diff --git a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.h b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.h index 320bbfda213..eda67957e9a 100644 --- a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.h +++ b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper.h @@ -80,7 +80,6 @@ public: * index/collection data will be safe to drop unversioned. */ void addDropPendingIdent(const Timestamp& dropTimestamp, - const NamespaceString& nss, std::shared_ptr<Ident> ident, StorageEngine::DropIdentCallback&& onDrop = nullptr); @@ -113,9 +112,6 @@ private: // Contains information identifying what collection/index data to drop as well as determining // when to do so. using IdentInfo = struct { - // Used for logging purposes. - NamespaceString nss; - // Identifier for the storage to drop the associated collection or index data. std::string identName; diff --git a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp index cda8abbd0b2..82c085f7a90 100644 --- a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp +++ b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp @@ -194,7 +194,6 @@ TEST_F(KVDropPendingIdentReaperTest, GetEarliestDropTimestampReturnsBoostNoneOnE TEST_F(KVDropPendingIdentReaperTest, AddDropPendingIdentAcceptsNullDropTimestamp) { Timestamp nullDropTimestamp; - NamespaceString nss("test.foo"); const std::string identName = "myident"; auto engine = getEngine(); @@ -202,7 +201,7 @@ TEST_F(KVDropPendingIdentReaperTest, AddDropPendingIdentAcceptsNullDropTimestamp { // The reaper must have the only reference to the ident before it will drop it. std::shared_ptr<Ident> ident = std::make_shared<Ident>(identName); - reaper.addDropPendingIdent(nullDropTimestamp, nss, ident); + reaper.addDropPendingIdent(nullDropTimestamp, ident); } ASSERT_EQUALS(nullDropTimestamp, *reaper.getEarliestDropTimestamp()); @@ -218,17 +217,15 @@ TEST_F(KVDropPendingIdentReaperTest, KVDropPendingIdentReaper reaper(engine); Timestamp dropTimestamp{Seconds(100), 0}; - NamespaceString nss1("test.foo"); std::string identName1 = "ident1"; - NamespaceString nss2("test.bar"); std::string identName2 = "ident2"; { // The reaper must have the only references to the idents before it will drop them. std::shared_ptr<Ident> ident1 = std::make_shared<Ident>(identName1); std::shared_ptr<Ident> ident2 = std::make_shared<Ident>(identName2); - reaper.addDropPendingIdent(dropTimestamp, nss1, ident1); - reaper.addDropPendingIdent(dropTimestamp, nss2, ident2); + reaper.addDropPendingIdent(dropTimestamp, ident1); + reaper.addDropPendingIdent(dropTimestamp, ident2); } // getAllIdentNames() returns a set of drop-pending idents known to the reaper. @@ -256,14 +253,13 @@ DEATH_TEST_F(KVDropPendingIdentReaperTest, AddDropPendingIdentTerminatesOnDuplicateDropTimestampAndIdent, "Failed to add drop-pending ident") { Timestamp dropTimestamp{Seconds(100), 0}; - NamespaceString nss("test.foo"); KVDropPendingIdentReaper reaper(getEngine()); { std::shared_ptr<Ident> ident = std::make_shared<Ident>("myident"); - reaper.addDropPendingIdent(dropTimestamp, nss, ident); - reaper.addDropPendingIdent(dropTimestamp, nss, ident); + reaper.addDropPendingIdent(dropTimestamp, ident); + reaper.addDropPendingIdent(dropTimestamp, ident); } } @@ -274,11 +270,9 @@ TEST_F(KVDropPendingIdentReaperTest, // Generate timestamps with secs: 10, 20, ..., 50. const int n = 5U; Timestamp ts[n]; - NamespaceString nss[n]; std::string identName[n]; for (int i = 0; i < n; ++i) { ts[i] = {Seconds((i + 1) * 10), 0}; - nss[i] = NamespaceString("test", str::stream() << "coll" << i); identName[i] = str::stream() << "ident" << i; } @@ -294,11 +288,11 @@ TEST_F(KVDropPendingIdentReaperTest, ident[i] = std::make_shared<Ident>(identName[i]); } - reaper.addDropPendingIdent(ts[1], nss[1], ident[1]); - reaper.addDropPendingIdent(ts[0], nss[0], ident[0]); - reaper.addDropPendingIdent(ts[2], nss[2], ident[2]); - reaper.addDropPendingIdent(ts[3], nss[3], ident[3]); - reaper.addDropPendingIdent(ts[4], nss[4], ident[4]); + reaper.addDropPendingIdent(ts[1], ident[1]); + reaper.addDropPendingIdent(ts[0], ident[0]); + reaper.addDropPendingIdent(ts[2], ident[2]); + reaper.addDropPendingIdent(ts[3], ident[3]); + reaper.addDropPendingIdent(ts[4], ident[4]); } ASSERT_EQUALS(ts[0], *reaper.getEarliestDropTimestamp()); @@ -334,8 +328,6 @@ TEST_F(KVDropPendingIdentReaperTest, DropIdentsOlderThanSkipsIdentsStillReferenc auto engine = getEngine(); const Timestamp dropTimestamp{Seconds(100), 0}; const Timestamp laterThanDropTimestamp{Seconds(200), 0}; - NamespaceString nss1("test.foo"); - NamespaceString nss2("test.bar"); std::string identNames[4] = {"ident1", "ident2", "ident3", "ident4"}; KVDropPendingIdentReaper reaper(engine); @@ -351,10 +343,10 @@ TEST_F(KVDropPendingIdentReaperTest, DropIdentsOlderThanSkipsIdentsStillReferenc std::shared_ptr<Ident> ident3 = std::make_shared<Ident>(identNames[3]); // The reaper must have the only references to the idents before it will drop them. - reaper.addDropPendingIdent(dropTimestamp, nss1, ident0); - reaper.addDropPendingIdent(dropTimestamp, nss2, ident1); - reaper.addDropPendingIdent(dropTimestamp, nss1, ident2); - reaper.addDropPendingIdent(dropTimestamp, nss2, ident3); + reaper.addDropPendingIdent(dropTimestamp, ident0); + reaper.addDropPendingIdent(dropTimestamp, ident1); + reaper.addDropPendingIdent(dropTimestamp, ident2); + reaper.addDropPendingIdent(dropTimestamp, ident3); } // All the idents have dropTimestamps old enough to drop, but only ident2 and ident3 should @@ -379,7 +371,6 @@ DEATH_TEST_F(KVDropPendingIdentReaperTest, DropIdentsOlderThanTerminatesIfKVEngineFailsToDropIdent, "Failed to remove drop-pending ident") { Timestamp dropTimestamp{Seconds{1}, 0}; - NamespaceString nss("test.foo"); std::string identName = "myident"; auto engine = getEngine(); @@ -387,7 +378,7 @@ DEATH_TEST_F(KVDropPendingIdentReaperTest, { // The reaper must have the only reference to the ident before it will drop it. std::shared_ptr<Ident> ident = std::make_shared<Ident>(identName); - reaper.addDropPendingIdent(dropTimestamp, nss, ident); + reaper.addDropPendingIdent(dropTimestamp, ident); } ASSERT_EQUALS(dropTimestamp, *reaper.getEarliestDropTimestamp()); diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h index 991a58284c6..02b782d422e 100644 --- a/src/mongo/db/storage/storage_engine.h +++ b/src/mongo/db/storage/storage_engine.h @@ -474,7 +474,6 @@ public: * - and no holders of 'ident' remain (the index/collection is no longer in active use) */ virtual void addDropPendingIdent(const Timestamp& dropTimestamp, - const NamespaceString& nss, std::shared_ptr<Ident> ident, DropIdentCallback&& onDrop = nullptr) = 0; diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp index bf6f6b87800..6475f344984 100644 --- a/src/mongo/db/storage/storage_engine_impl.cpp +++ b/src/mongo/db/storage/storage_engine_impl.cpp @@ -1079,10 +1079,9 @@ void StorageEngineImpl::_dumpCatalog(OperationContext* opCtx) { } void StorageEngineImpl::addDropPendingIdent(const Timestamp& dropTimestamp, - const NamespaceString& nss, std::shared_ptr<Ident> ident, DropIdentCallback&& onDrop) { - _dropPendingIdentReaper.addDropPendingIdent(dropTimestamp, nss, ident, std::move(onDrop)); + _dropPendingIdentReaper.addDropPendingIdent(dropTimestamp, ident, std::move(onDrop)); } void StorageEngineImpl::checkpoint() { diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h index c8d60ddfbec..cadc07cd436 100644 --- a/src/mongo/db/storage/storage_engine_impl.h +++ b/src/mongo/db/storage/storage_engine_impl.h @@ -317,7 +317,6 @@ public: } void addDropPendingIdent(const Timestamp& dropTimestamp, - const NamespaceString& nss, std::shared_ptr<Ident> ident, DropIdentCallback&& onDrop) override; diff --git a/src/mongo/db/storage/storage_engine_mock.h b/src/mongo/db/storage/storage_engine_mock.h index a600ee1c6ad..6cacdacea03 100644 --- a/src/mongo/db/storage/storage_engine_mock.h +++ b/src/mongo/db/storage/storage_engine_mock.h @@ -170,7 +170,6 @@ public: return {}; } void addDropPendingIdent(const Timestamp& dropTimestamp, - const NamespaceString& nss, std::shared_ptr<Ident> ident, DropIdentCallback&& onDrop) final {} void checkpoint() final {} diff --git a/src/mongo/db/storage/storage_util.cpp b/src/mongo/db/storage/storage_util.cpp index 25223009c77..f4d5b8ae8ee 100644 --- a/src/mongo/db/storage/storage_util.cpp +++ b/src/mongo/db/storage/storage_util.cpp @@ -134,7 +134,7 @@ void removeIndex(OperationContext* opCtx, "uuid"_attr = collectionUUID, "ident"_attr = ident->getIdent(), "commitTimestamp"_attr = commitTimestamp); - storageEngine->addDropPendingIdent(*commitTimestamp, nss, ident, std::move(onDrop)); + storageEngine->addDropPendingIdent(*commitTimestamp, ident, std::move(onDrop)); } else { // Intentionally ignoring failure here. Since we've removed the metadata pointing to // the collection, we should never see it again anyway. @@ -186,7 +186,7 @@ Status dropCollection(OperationContext* opCtx, logAttrs(nss), "ident"_attr = ident->getIdent(), "commitTimestamp"_attr = commitTimestamp); - storageEngine->addDropPendingIdent(*commitTimestamp, nss, ident, std::move(onDrop)); + storageEngine->addDropPendingIdent(*commitTimestamp, ident, std::move(onDrop)); } else { // Intentionally ignoring failure here. Since we've removed the metadata pointing to // the collection, we should never see it again anyway. |