From 08e77b4de49537a48674e44b73ea79d83c5148ee Mon Sep 17 00:00:00 2001 From: udi-speedb <106253580+udi-speedb@users.noreply.github.com> Date: Thu, 21 Sep 2023 12:44:58 +0300 Subject: [PATCH] Unit tests: Expose the disallow_trivial_move flag in MoveFilesToLevel utility (#678) --- HISTORY.md | 1 + db/db_test_util.cc | 9 ++++++--- db/db_test_util.h | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index b4cf5fc0b8..0fa8d50c5d 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -8,6 +8,7 @@ Fix RepeatableThread to work properly with on thread start callback feature (htt * Non-Blocking Manual Compaction (CompactRange()) - Support non-blocking manual compactions by setting a new CompactRangeOptions option (async_completion_cb). When set, the CompactRange() call will return control to the caller immediately. The manual compaction iteslf will be performed in an internally created thread. The manual compaction will ALWAYS call the specified callback upon completion and provide the completion status (#597). ### Enhancements +* Unit Testing: Expose the disallow_trivial_move flag in the MoveFilesToLevel testing utility (#677). ### Bug Fixes * db_bench: fix SeekRandomWriteRandom valid check. Use key and value only after checking iterator is valid. diff --git a/db/db_test_util.cc b/db/db_test_util.cc index 425f66c534..43046a605a 100644 --- a/db/db_test_util.cc +++ b/db/db_test_util.cc @@ -1291,12 +1291,15 @@ void DBTestBase::FillLevels(const std::string& smallest, MakeTables(db_->NumberLevels(handles_[cf]), smallest, largest, cf); } -void DBTestBase::MoveFilesToLevel(int level, int cf) { +void DBTestBase::MoveFilesToLevel(int level, int cf, + bool disallow_trivial_move) { for (int l = 0; l < level; ++l) { if (cf > 0) { - EXPECT_OK(dbfull()->TEST_CompactRange(l, nullptr, nullptr, handles_[cf])); + EXPECT_OK(dbfull()->TEST_CompactRange(l, nullptr, nullptr, handles_[cf], + disallow_trivial_move)); } else { - EXPECT_OK(dbfull()->TEST_CompactRange(l, nullptr, nullptr)); + EXPECT_OK(dbfull()->TEST_CompactRange(l, nullptr, nullptr, nullptr, + disallow_trivial_move)); } } } diff --git a/db/db_test_util.h b/db/db_test_util.h index ec31400c5d..259cb3601d 100644 --- a/db/db_test_util.h +++ b/db/db_test_util.h @@ -1252,7 +1252,8 @@ class DBTestBase : public testing::Test { void FillLevels(const std::string& smallest, const std::string& largest, int cf); - void MoveFilesToLevel(int level, int cf = 0); + void MoveFilesToLevel(int level, int cf = 0, + bool disallow_trivial_move = false); void DumpFileCounts(const char* label);