Skip to content

Commit

Permalink
Fix TestGetEntity in stress test when UDT is enabled (facebook#12222)
Browse files Browse the repository at this point in the history
Summary:
Similar to facebook#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: facebook#12222

Reviewed By: jowlyzhang

Differential Revision: D52678830

Pulled By: jaykorean

fbshipit-source-id: 6e154f67bb32968add8fea0b7ae7c4858ea64ee7
  • Loading branch information
jaykorean authored and facebook-github-bot committed Jan 11, 2024
1 parent 513aae1 commit 0758271
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion db_stress_tool/no_batched_ops_stress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 0758271

Please sign in to comment.