Skip to content

Commit

Permalink
Unit tests: Expose the disallow_trivial_move flag in MoveFilesToLevel…
Browse files Browse the repository at this point in the history
… utility (#678)
  • Loading branch information
udi-speedb committed Nov 22, 2023
1 parent 044df14 commit 08e77b4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions db/db_test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion db/db_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 08e77b4

Please sign in to comment.