Print iterator status in stress tests when PrepareValue() fails (#13130)

Summary:
Pull Request resolved: https://github.com/facebook/rocksdb/pull/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
This commit is contained in:
Levi Tamasi 2024-11-09 15:04:17 -08:00 committed by Facebook GitHub Bot
parent a6ee297ac9
commit aa889eb5ed
3 changed files with 9 additions and 7 deletions

View File

@ -621,8 +621,9 @@ class BatchedOpsStressTest : public StressTest {
if (!iters[i]->PrepareValue()) { if (!iters[i]->PrepareValue()) {
fprintf(stderr, fprintf(stderr,
"prefix scan error: PrepareValue failed for key %s\n", "prefix scan error: PrepareValue failed for key %s: %s\n",
prepare_value_key.c_str()); prepare_value_key.c_str(),
iters[i]->status().ToString().c_str());
continue; continue;
} }
} }

View File

@ -2010,9 +2010,9 @@ void StressTest::VerifyIterator(
stderr, stderr,
"Iterator failed to prepare value for key %s %s under specified " "Iterator failed to prepare value for key %s %s under specified "
"iterator ReadOptions: %s (Empty string or missing field indicates " "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(), 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; *diverged = true;
} }
} }

View File

@ -2308,9 +2308,10 @@ class NonBatchedOpsStressTest : public StressTest {
if (!iter->PrepareValue()) { if (!iter->PrepareValue()) {
shared->SetVerificationFailure(); shared->SetVerificationFailure();
fprintf(stderr, fprintf(
"Verification failed for key %s: failed to prepare value\n", stderr,
prepare_value_key.c_str()); "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", fprintf(stderr, "Column family: %s, op_logs: %s\n",
cfh->GetName().c_str(), op_logs.c_str()); cfh->GetName().c_str(), op_logs.c_str());