summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/kv/storage_engine_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/kv/storage_engine_test.cpp')
-rw-r--r--src/mongo/db/storage/kv/storage_engine_test.cpp46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/mongo/db/storage/kv/storage_engine_test.cpp b/src/mongo/db/storage/kv/storage_engine_test.cpp
index 0a7fb957003..1fbdc65188d 100644
--- a/src/mongo/db/storage/kv/storage_engine_test.cpp
+++ b/src/mongo/db/storage/kv/storage_engine_test.cpp
@@ -190,9 +190,8 @@ public:
using TimestampType = StorageEngineImpl::TimestampMonitor::TimestampType;
using TimestampListener = StorageEngineImpl::TimestampMonitor::TimestampListener;
auto pf = makePromiseFuture<void>();
- auto listener = TimestampListener(
- TimestampType::kOldest,
- [promise = &pf.promise](OperationContext* opCtx, Timestamp t) mutable {
+ auto listener =
+ TimestampListener(TimestampType::kOldest, [promise = &pf.promise](Timestamp t) mutable {
promise->emplaceValue();
});
timestampMonitor->addListener(&listener);
@@ -388,7 +387,6 @@ TEST_F(StorageEngineTest, ReconcileTwoPhaseIndexBuilds) {
ASSERT_EQUALS(0UL, reconcileResult.indexBuildsToResume.size());
}
-#ifndef _WIN32 // WiredTiger does not support orphan file recovery on Windows.
TEST_F(StorageEngineRepairTest, LoadCatalogRecoversOrphans) {
auto opCtx = cc().makeOperationContext();
@@ -396,8 +394,7 @@ TEST_F(StorageEngineRepairTest, LoadCatalogRecoversOrphans) {
auto swCollInfo = createCollection(opCtx.get(), collNs);
ASSERT_OK(swCollInfo.getStatus());
- // Drop the ident from the storage engine but keep the underlying files.
- _storageEngine->getEngine()->dropIdentForImport(opCtx.get(), swCollInfo.getValue().ident);
+ ASSERT_OK(dropIdent(opCtx.get()->recoveryUnit(), swCollInfo.getValue().ident));
ASSERT(collectionExists(opCtx.get(), collNs));
// After the catalog is reloaded, we expect that the ident has been recovered because the
@@ -413,7 +410,6 @@ TEST_F(StorageEngineRepairTest, LoadCatalogRecoversOrphans) {
StorageRepairObserver::get(getGlobalServiceContext())->onRepairDone(opCtx.get());
ASSERT_EQ(1U, StorageRepairObserver::get(getGlobalServiceContext())->getModifications().size());
}
-#endif
TEST_F(StorageEngineRepairTest, ReconcileSucceeds) {
auto opCtx = cc().makeOperationContext();
@@ -588,9 +584,9 @@ TEST_F(TimestampKVEngineTest, TimestampMonitorRunning) {
}
TEST_F(TimestampKVEngineTest, TimestampListeners) {
- TimestampListener first(stable, [](OperationContext* opCtx, Timestamp timestamp) {});
- TimestampListener second(oldest, [](OperationContext* opCtx, Timestamp timestamp) {});
- TimestampListener third(stable, [](OperationContext* opCtx, Timestamp timestamp) {});
+ TimestampListener first(stable, [](Timestamp timestamp) {});
+ TimestampListener second(oldest, [](Timestamp timestamp) {});
+ TimestampListener third(stable, [](Timestamp timestamp) {});
// Can only register the listener once.
_storageEngine->getTimestampMonitor()->addListener(&first);
@@ -611,7 +607,7 @@ TEST_F(TimestampKVEngineTest, TimestampMonitorNotifiesListeners) {
bool changes[4] = {false, false, false, false};
- TimestampListener first(checkpoint, [&](OperationContext* opCtx, Timestamp timestamp) {
+ TimestampListener first(checkpoint, [&](Timestamp timestamp) {
stdx::lock_guard<Latch> lock(mutex);
if (!changes[0]) {
changes[0] = true;
@@ -619,7 +615,7 @@ TEST_F(TimestampKVEngineTest, TimestampMonitorNotifiesListeners) {
}
});
- TimestampListener second(oldest, [&](OperationContext* opCtx, Timestamp timestamp) {
+ TimestampListener second(oldest, [&](Timestamp timestamp) {
stdx::lock_guard<Latch> lock(mutex);
if (!changes[1]) {
changes[1] = true;
@@ -627,7 +623,7 @@ TEST_F(TimestampKVEngineTest, TimestampMonitorNotifiesListeners) {
}
});
- TimestampListener third(stable, [&](OperationContext* opCtx, Timestamp timestamp) {
+ TimestampListener third(stable, [&](Timestamp timestamp) {
stdx::lock_guard<Latch> lock(mutex);
if (!changes[2]) {
changes[2] = true;
@@ -635,7 +631,7 @@ TEST_F(TimestampKVEngineTest, TimestampMonitorNotifiesListeners) {
}
});
- TimestampListener fourth(stable, [&](OperationContext* opCtx, Timestamp timestamp) {
+ TimestampListener fourth(stable, [&](Timestamp timestamp) {
stdx::lock_guard<Latch> lock(mutex);
if (!changes[3]) {
changes[3] = true;
@@ -649,17 +645,15 @@ TEST_F(TimestampKVEngineTest, TimestampMonitorNotifiesListeners) {
_storageEngine->getTimestampMonitor()->addListener(&fourth);
// Wait until all 4 listeners get notified at least once.
- {
- stdx::unique_lock<Latch> lk(mutex);
- cv.wait(lk, [&] {
- for (auto const& change : changes) {
- if (!change) {
- return false;
- }
+ stdx::unique_lock<Latch> lk(mutex);
+ cv.wait(lk, [&] {
+ for (auto const& change : changes) {
+ if (!change) {
+ return false;
}
- return true;
- });
- };
+ }
+ return true;
+ });
_storageEngine->getTimestampMonitor()->clearListeners();
}
@@ -668,7 +662,7 @@ TEST_F(TimestampKVEngineTest, TimestampAdvancesOnNotification) {
Timestamp previous = Timestamp();
AtomicWord<int> timesNotified{0};
- TimestampListener listener(stable, [&](OperationContext* opCtx, Timestamp timestamp) {
+ TimestampListener listener(stable, [&](Timestamp timestamp) {
ASSERT_TRUE(previous < timestamp);
previous = timestamp;
timesNotified.fetchAndAdd(1);
@@ -684,7 +678,7 @@ TEST_F(TimestampKVEngineTest, TimestampAdvancesOnNotification) {
_storageEngine->getTimestampMonitor()->clearListeners();
}
-TEST_F(StorageEngineTestNotEphemeral, UseAlternateStorageLocation) {
+TEST_F(StorageEngineTest, UseAlternateStorageLocation) {
auto opCtx = cc().makeOperationContext();
const NamespaceString coll1Ns("db.coll1");