summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Huh <jewoongh@meta.com>2024-01-10 16:35:54 -0800
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2024-01-10 16:35:54 -0800
commit0758271d519bcc5d7266fec26ae1f3ab887aa130 (patch)
treec4e59a0ccc95ce536c77aeed86151800944b69e5
parent513aae1a319886bb81b3ee6ef9b5459d71e6818c (diff)
Fix TestGetEntity in stress test when UDT is enabled (#12222)
Summary: Similar to https://github.com/facebook/rocksdb/issues/11249 , we started to get failures from `TestGetEntity` when the User-defined-timestamp was enabled. Applying the same fix as the `TestGet` _Scenario copied from #11249_ <table> <tr> <th>TestGet thread</th> <th> A writing thread</th> </tr> <tr> <td>read_opts.timestamp = GetNow()</td> <td></td> </tr> <tr> <td></td> <td>Lock key, do write</td> </tr> <tr> <td>Lock key, read(read_opts) return NotFound</td> <td></td> </tr> </table> Pull Request resolved: https://github.com/facebook/rocksdb/pull/12222 Reviewed By: jowlyzhang Differential Revision: D52678830 Pulled By: jaykorean fbshipit-source-id: 6e154f67bb32968add8fea0b7ae7c4858ea64ee7
-rw-r--r--db_stress_tool/no_batched_ops_stress.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/db_stress_tool/no_batched_ops_stress.cc b/db_stress_tool/no_batched_ops_stress.cc
index eb5b3b2f9..c5e64b862 100644
--- a/db_stress_tool/no_batched_ops_stress.cc
+++ b/db_stress_tool/no_batched_ops_stress.cc
@@ -910,6 +910,17 @@ class NonBatchedOpsStressTest : public StressTest {
PinnableWideColumns from_db;
+ ReadOptions read_opts_copy = read_opts;
+ std::string read_ts_str;
+ Slice read_ts_slice;
+ if (FLAGS_user_timestamp_size > 0) {
+ read_ts_str = GetNowNanos();
+ read_ts_slice = read_ts_str;
+ read_opts_copy.timestamp = &read_ts_slice;
+ }
+ bool read_older_ts = MaybeUseOlderTimestampForPointLookup(
+ thread, read_ts_str, read_ts_slice, read_opts_copy);
+
const Status s = db_->GetEntity(read_opts, cfh, key, &from_db);
int error_count = 0;
@@ -956,7 +967,7 @@ class NonBatchedOpsStressTest : public StressTest {
} else if (s.IsNotFound()) {
thread->stats.AddGets(1, 0);
- if (!FLAGS_skip_verifydb) {
+ if (!FLAGS_skip_verifydb && !read_older_ts) {
ExpectedValue expected =
shared->Get(rand_column_families[0], rand_keys[0]);
if (ExpectedValueHelper::MustHaveExisted(expected, expected)) {