Skip to content

Commit

Permalink
Print iterator status in stress tests when PrepareValue() fails (#13130)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #13130

The patch changes the stress test code so it always logs the error status to aid debugging when a `PrepareValue` call fails.

Reviewed By: hx235

Differential Revision: D65712502

fbshipit-source-id: da81566a358777b691178f0d0a1b680453d03e7d
  • Loading branch information
ltamasi authored and facebook-github-bot committed Nov 9, 2024
1 parent a6ee297 commit aa889eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions db_stress_tool/batched_ops_stress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,9 @@ class BatchedOpsStressTest : public StressTest {

if (!iters[i]->PrepareValue()) {
fprintf(stderr,
"prefix scan error: PrepareValue failed for key %s\n",
prepare_value_key.c_str());
"prefix scan error: PrepareValue failed for key %s: %s\n",
prepare_value_key.c_str(),
iters[i]->status().ToString().c_str());
continue;
}
}
Expand Down
4 changes: 2 additions & 2 deletions db_stress_tool/db_stress_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2010,9 +2010,9 @@ void StressTest::VerifyIterator(
stderr,
"Iterator failed to prepare value for key %s %s under specified "
"iterator ReadOptions: %s (Empty string or missing field indicates "
"default option or value is used)\n",
"default option or value is used): %s\n",
prepare_value_key.c_str(), op_logs.c_str(),
read_opt_oss.str().c_str());
read_opt_oss.str().c_str(), iter->status().ToString().c_str());
*diverged = true;
}
}
Expand Down
7 changes: 4 additions & 3 deletions db_stress_tool/no_batched_ops_stress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2308,9 +2308,10 @@ class NonBatchedOpsStressTest : public StressTest {
if (!iter->PrepareValue()) {
shared->SetVerificationFailure();

fprintf(stderr,
"Verification failed for key %s: failed to prepare value\n",
prepare_value_key.c_str());
fprintf(
stderr,
"Verification failed for key %s: failed to prepare value: %s\n",
prepare_value_key.c_str(), iter->status().ToString().c_str());
fprintf(stderr, "Column family: %s, op_logs: %s\n",
cfh->GetName().c_str(), op_logs.c_str());

Expand Down

0 comments on commit aa889eb

Please sign in to comment.