Skip to content

Commit

Permalink
test checking write_thread_wait_nanos for a concurrent write thread
Browse files Browse the repository at this point in the history
  • Loading branch information
jowlyzhang committed Dec 19, 2024
1 parent 2cf4597 commit 560d254
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions db/external_sst_file_basic_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,23 @@ TEST_F(ExternalSSTFileBasicTest, Basic) {
ASSERT_NOK(s) << s.ToString();

DestroyAndReopen(options);

SyncPoint::GetInstance()->LoadDependency({
{"DBImpl::IngestExternalFile:AfterIncIngestFileCounter",
"ExternalSSTFileBasicTest.LiveWriteStart"},
{"ExternalSSTFileBasicTest.LiveWriteStart",
"DBImpl::IngestExternalFiles:InstallSVForFirstCF:0"},
});
SyncPoint::GetInstance()->EnableProcessing();
std::thread write_thread([&] {
TEST_SYNC_POINT("ExternalSSTFileBasicTest.LiveWriteStart");
SetPerfLevel(kEnableWait);
PerfContext* write_thread_perf_context = get_perf_context();
write_thread_perf_context->Reset();
ASSERT_OK(db_->Put(WriteOptions(), "bar", "v2"));
ASSERT_GT(write_thread_perf_context->write_thread_wait_nanos, 0);
});

// Add file using file path
SetPerfLevel(kEnableTimeExceptForMutex);
PerfContext* perf_ctx = get_perf_context();
Expand All @@ -273,6 +290,8 @@ TEST_F(ExternalSSTFileBasicTest, Basic) {
for (int k = 0; k < 100; k++) {
ASSERT_EQ(Get(Key(k)), Key(k) + "_val");
}
write_thread.join();
SyncPoint::GetInstance()->DisableProcessing();

// Re-ingest the file just to check the perf context not enabled at and below
// kEnableWait.
Expand Down

0 comments on commit 560d254

Please sign in to comment.