From a1785b2eb501634b0ca8e5dc848316d8b52b6184 Mon Sep 17 00:00:00 2001 From: Udi Date: Tue, 19 Sep 2023 17:32:25 +0300 Subject: [PATCH] Unit Testing: Expose the disallow_trivial_move flag in the MoveFilesToLevel testing utility (#677) --- 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 d1fdb8b947..8b5696272c 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 5f1aab8a31..6315801a38 100644 --- a/db/db_test_util.cc +++ b/db/db_test_util.cc @@ -1264,12 +1264,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 a24433b67e..d13fedf038 100644 --- a/db/db_test_util.h +++ b/db/db_test_util.h @@ -1244,7 +1244,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);