Add CoalescingIterator to TestIterateAgainstExpected (#12721)

Summary:
Continuing from https://github.com/facebook/rocksdb/pull/12706. Adding the CoalescingIterator to `TestIterateAgainstExpected` as well when `use_multi_cf_iterator` is set True

Pull Request resolved: https://github.com/facebook/rocksdb/pull/12721

Test Plan:
```
python3 tools/db_crashtest.py blackbox --simple --max_key=25000000 --write_buffer_size=4194304 --use_attribute_group=0 --use_put_entity_one_in=1 --use_multi_get=1 --use_multi_cf_iterator=1 --verify_iterator_with_expected_state_one_in=2
```

Reviewed By: ltamasi

Differential Revision: D58033811

Pulled By: jaykorean

fbshipit-source-id: 7caf39883e277e695b653e295ad72b1004169ca0
This commit is contained in:
Jay Huh 2024-05-31 15:17:06 -07:00 committed by Facebook GitHub Bot
parent 6f17056e40
commit f3b7e959b3
1 changed files with 13 additions and 1 deletions

View File

@ -1914,7 +1914,19 @@ class NonBatchedOpsStressTest : public StressTest {
pre_read_expected_values.push_back( pre_read_expected_values.push_back(
shared->Get(rand_column_family, i + lb)); shared->Get(rand_column_family, i + lb));
} }
std::unique_ptr<Iterator> iter(db_->NewIterator(ro, cfh)); std::unique_ptr<Iterator> iter;
if (FLAGS_use_multi_cf_iterator) {
std::vector<ColumnFamilyHandle*> cfhs;
cfhs.reserve(rand_column_families.size());
for (auto cf_index : rand_column_families) {
cfhs.emplace_back(column_families_[cf_index]);
}
assert(!cfhs.empty());
iter = db_->NewCoalescingIterator(ro, cfhs);
} else {
iter = std::unique_ptr<Iterator>(db_->NewIterator(ro, cfh));
}
for (int64_t i = 0; i < static_cast<int64_t>(expected_values_size); ++i) { for (int64_t i = 0; i < static_cast<int64_t>(expected_values_size); ++i) {
post_read_expected_values.push_back( post_read_expected_values.push_back(
shared->Get(rand_column_family, i + lb)); shared->Get(rand_column_family, i + lb));