Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Testing: Expose the disallow_trivial_move flag in the MoveFilesToLevel testing utility. #678

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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));
}
}
}
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 @@ -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);

Expand Down
Loading