diff --git a/HISTORY.md b/HISTORY.md index b71f2a44b..b1d295a78 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,7 @@ # Rocksdb Change Log ## Unreleased +### Behavior Change +* Updated `TestGet()` in `no_batched_op_stress` (default stress test) to check the result of Get() operations against expected state. ## 7.6.0 (08/19/2022) ### New Features diff --git a/db_stress_tool/no_batched_ops_stress.cc b/db_stress_tool/no_batched_ops_stress.cc index 377749f81..de4b69642 100644 --- a/db_stress_tool/no_batched_ops_stress.cc +++ b/db_stress_tool/no_batched_ops_stress.cc @@ -360,9 +360,31 @@ class NonBatchedOpsStressTest : public StressTest { } // found case thread->stats.AddGets(1, 1); + // we only have the latest expected state + if (!read_opts_copy.timestamp && + thread->shared->Get(rand_column_families[0], rand_keys[0]) == + SharedState::DELETION_SENTINEL) { + thread->shared->SetVerificationFailure(); + fprintf(stderr, + "error : inconsistent values for key %s: Get returns %s, " + "expected state does not have the key.\n", + key.ToString(true).c_str(), StringToHex(from_db).c_str()); + } } else if (s.IsNotFound()) { // not found case thread->stats.AddGets(1, 0); + if (!read_opts_copy.timestamp) { + auto expected = + thread->shared->Get(rand_column_families[0], rand_keys[0]); + if (expected != SharedState::DELETION_SENTINEL && + expected != SharedState::UNKNOWN_SENTINEL) { + thread->shared->SetVerificationFailure(); + fprintf(stderr, + "error : inconsistent values for key %s: expected state has " + "the key, Get() returns NotFound.\n", + key.ToString(true).c_str()); + } + } } else { if (error_count == 0) { // errors case