diff options
author | Jay Huh <jewoongh@meta.com> | 2023-05-25 17:25:51 -0700 |
---|---|---|
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | 2023-05-25 17:25:51 -0700 |
commit | 81aeb15988e43c49952c795e32e5c8b224793589 (patch) | |
tree | ab2acdc984ff6f50ca945d7d75b4f956043d9e1a /microbench | |
parent | d1ae7f6c41f78f6e2ea1f4775a029f5724ad59a0 (diff) |
Add WaitForCompact with WaitForCompactOptions to public API (#11436)
Summary:
Context:
This is the first PR for WaitForCompact() Implementation with WaitForCompactOptions. In this PR, we are introducing `Status WaitForCompact(const WaitForCompactOptions& wait_for_compact_options)` in the public API. This currently utilizes the existing internal `WaitForCompact()` implementation (with default abort_on_pause = false). `abort_on_pause` has been moved to `WaitForCompactOptions&`. In the later PRs, we will introduce the following two options in `WaitForCompactOptions`
1. `bool flush = false` by default - If true, flush before waiting for compactions to finish. Must be set to true to ensure no immediate compactions (except perhaps periodic compactions) after closing and re-opening the DB.
2. `bool close_db = false` by default - If true, will also close the DB upon compactions finishing.
1. struct `WaitForCompactOptions` added to options.h and `abort_on_pause` in the internal API moved to the option struct.
2. `Status WaitForCompact(const WaitForCompactOptions& wait_for_compact_options)` introduced in `db.h`
3. Changed the internal WaitForCompact() to `WaitForCompact(const WaitForCompactOptions& wait_for_compact_options)` and checks for the `abort_on_pause` inside the option.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/11436
Test Plan:
Following tests added
- `DBCompactionTest::WaitForCompactWaitsOnCompactionToFinish`
- `DBCompactionTest::WaitForCompactAbortOnPauseAborted`
- `DBCompactionTest::WaitForCompactContinueAfterPauseNotAborted`
- `DBCompactionTest::WaitForCompactShutdownWhileWaiting`
- `TransactionTest::WaitForCompactAbortOnPause`
NOTE: `TransactionTest::WaitForCompactAbortOnPause` was added to use `StackableDB` to ensure the wrapper function is in place.
Reviewed By: pdillinger
Differential Revision: D45799659
Pulled By: jaykorean
fbshipit-source-id: b5b58f95957f2ab47d1221dee32a61d6cdc4685b
Diffstat (limited to 'microbench')
-rw-r--r-- | microbench/db_basic_bench.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/microbench/db_basic_bench.cc b/microbench/db_basic_bench.cc index 31df024b9..6fefddb38 100644 --- a/microbench/db_basic_bench.cc +++ b/microbench/db_basic_bench.cc @@ -303,7 +303,7 @@ static void DBPut(benchmark::State& state) { if (state.thread_index() == 0) { auto db_full = static_cast_with_check<DBImpl>(db.get()); - Status s = db_full->WaitForCompact(); + Status s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; @@ -410,7 +410,7 @@ static void ManualCompaction(benchmark::State& state) { if (state.thread_index() == 0) { auto db_full = static_cast_with_check<DBImpl>(db.get()); - s = db_full->WaitForCompact(); + s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; @@ -510,7 +510,7 @@ static void ManualFlush(benchmark::State& state) { if (state.thread_index() == 0) { auto db_full = static_cast_with_check<DBImpl>(db.get()); - Status s = db_full->WaitForCompact(); + Status s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; @@ -594,7 +594,7 @@ static void DBGet(benchmark::State& state) { } auto db_full = static_cast_with_check<DBImpl>(db.get()); - s = db_full->WaitForCompact(); + s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; @@ -707,7 +707,7 @@ static void SimpleGetWithPerfContext(benchmark::State& state) { } } auto db_full = static_cast_with_check<DBImpl>(db.get()); - s = db_full->WaitForCompact(); + s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; @@ -1115,7 +1115,7 @@ static void IteratorSeek(benchmark::State& state) { } auto db_full = static_cast_with_check<DBImpl>(db.get()); - s = db_full->WaitForCompact(); + s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; @@ -1206,7 +1206,7 @@ static void IteratorNext(benchmark::State& state) { } auto db_full = static_cast_with_check<DBImpl>(db.get()); - s = db_full->WaitForCompact(); + s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; @@ -1270,7 +1270,7 @@ static void IteratorNextWithPerfContext(benchmark::State& state) { } } auto db_full = static_cast_with_check<DBImpl>(db.get()); - Status s = db_full->WaitForCompact(); + Status s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; @@ -1368,7 +1368,7 @@ static void IteratorPrev(benchmark::State& state) { } auto db_full = static_cast_with_check<DBImpl>(db.get()); - s = db_full->WaitForCompact(); + s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; @@ -1460,7 +1460,7 @@ static void PrefixSeek(benchmark::State& state) { } auto db_full = static_cast_with_check<DBImpl>(db.get()); - s = db_full->WaitForCompact(); + s = db_full->WaitForCompact(WaitForCompactOptions()); if (!s.ok()) { state.SkipWithError(s.ToString().c_str()); return; |