mirror of
https://github.com/facebook/rocksdb.git
synced 2025-05-14 08:53:08 +08:00
Verify Iterator/Get() against expected state in only no_batched_ops_test
(#10590)
Summary:
https://github.com/facebook/rocksdb/issues/10538 added `TestIterateAgainstExpected()` in `no_batched_ops_test` to verify iterator correctness against the in memory expected state. It is not compatible when run after some other stress tests, e.g. `TestPut()` in `batched_op_stress`, that either do not set expected state when writing to DB or use keys that cannot be parsed by `GetIntVal()`. The assert [here](d17be55aab/db_stress_tool/db_stress_common.h (L520)
) could fail. This PR fixed this issue by setting iterator upperbound to `max_key` when `destroy_db_initially=0` to avoid the key space that `batched_op_stress` touches.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/10590
Test Plan:
```
# set up DB with batched_op_stress
./db_stress --test_batches_snapshots=1 --verify_iterator_with_expected_state_one_in=1 --max_key_len=3 --max_key=100000000 --skip_verifydb=1 --continuous_verification_interval=0 --writepercent=85 --delpercent=3 --delrangepercent=0 --iterpercent=10 --nooverwritepercent=1 --prefixpercent=0 --readpercent=2 --key_len_percent_dist=1,30,69
# Before this PR, the following test will fail the asserts with error msg like the following
# Assertion failed: (size_key <= key_gen_ctx.weights.size() * sizeof(uint64_t)), function GetIntVal, file db_stress_common.h, line 524.
./db_stress --verify_iterator_with_expected_state_one_in=1 --max_key_len=3 --max_key=100000000 --skip_verifydb=1 --continuous_verification_interval=0 --writepercent=0 --delpercent=3 --delrangepercent=0 --iterpercent=95 --nooverwritepercent=1 --prefixpercent=0 --readpercent=2 --key_len_percent_dist=1,30,69 --destroy_db_initially=0
```
Reviewed By: ajkr
Differential Revision: D39085243
Pulled By: cbi42
fbshipit-source-id: a7dfee2320c330773b623b442d730fd014ec7056
This commit is contained in:
parent
64e74723f7
commit
5532b462c4
@ -1032,7 +1032,24 @@ class NonBatchedOpsStressTest : public StressTest {
|
||||
int64_t ub = lb + FLAGS_num_iterations;
|
||||
// Locks acquired for [lb, ub)
|
||||
ReadOptions readoptscopy(read_opts);
|
||||
std::string read_ts_str;
|
||||
Slice read_ts;
|
||||
if (FLAGS_user_timestamp_size > 0) {
|
||||
read_ts_str = GetNowNanos();
|
||||
read_ts = read_ts_str;
|
||||
readoptscopy.timestamp = &read_ts;
|
||||
}
|
||||
readoptscopy.total_order_seek = true;
|
||||
std::string max_key_str;
|
||||
Slice max_key_slice;
|
||||
if (!FLAGS_destroy_db_initially) {
|
||||
max_key_str = Key(max_key);
|
||||
max_key_slice = max_key_str;
|
||||
// to restrict iterator from reading keys written in batched_op_stress
|
||||
// that do not have expected state updated and may not be parseable by
|
||||
// GetIntVal().
|
||||
readoptscopy.iterate_upper_bound = &max_key_slice;
|
||||
}
|
||||
auto cfh = column_families_[rand_column_family];
|
||||
std::string op_logs;
|
||||
std::unique_ptr<Iterator> iter(db_->NewIterator(readoptscopy, cfh));
|
||||
|
Loading…
x
Reference in New Issue
Block a user