From 7c98d715671390a304cad3483868c9dc8e00cec2 Mon Sep 17 00:00:00 2001 From: Maysam Yabandeh Date: Thu, 2 Jan 2020 16:43:55 -0800 Subject: [PATCH] Print before AddErrors in stress tests (#6256) Summary: Stress tests count number of errors and report them at the end. Not all the cases are accompanied with a log line which makes debugging difficult. The patch adds a log line to the remaining cases. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6256 Differential Revision: D19268785 Pulled By: maysamyabandeh fbshipit-source-id: bdabcaa5c5c7edcb4ce4f25e38fd8a3fd9c7700b --- db_stress_tool/batched_ops_stress.cc | 1 + db_stress_tool/cf_consistency_stress.cc | 4 ++++ db_stress_tool/db_stress_test_base.cc | 1 + db_stress_tool/no_batched_ops_stress.cc | 3 +++ 4 files changed, 9 insertions(+) diff --git a/db_stress_tool/batched_ops_stress.cc b/db_stress_tool/batched_ops_stress.cc index 298903a0a..9adaf2fe2 100644 --- a/db_stress_tool/batched_ops_stress.cc +++ b/db_stress_tool/batched_ops_stress.cc @@ -325,6 +325,7 @@ class BatchedOpsStressTest : public StressTest { if (s.ok()) { thread->stats.AddPrefixes(1, count); } else { + fprintf(stderr, "TestPrefixScan error: %s\n", s.ToString().c_str()); thread->stats.AddErrors(1); } diff --git a/db_stress_tool/cf_consistency_stress.cc b/db_stress_tool/cf_consistency_stress.cc index 0a8e1b7f6..1441418ac 100644 --- a/db_stress_tool/cf_consistency_stress.cc +++ b/db_stress_tool/cf_consistency_stress.cc @@ -184,6 +184,7 @@ class CfConsistencyStressTest : public StressTest { db_->ReleaseSnapshot(snapshot); } if (!is_consistent) { + fprintf(stderr, "TestGet error: is_consistent is false\n"); thread->stats.AddErrors(1); // Fail fast to preserve the DB state. thread->shared->SetVerificationFailure(); @@ -192,6 +193,7 @@ class CfConsistencyStressTest : public StressTest { } else if (s.IsNotFound()) { thread->stats.AddGets(1, 0); } else { + fprintf(stderr, "TestGet error: %s\n", s.ToString().c_str()); thread->stats.AddErrors(1); } return s; @@ -225,6 +227,7 @@ class CfConsistencyStressTest : public StressTest { thread->stats.AddGets(1, 0); } else { // errors case + fprintf(stderr, "MultiGet error: %s\n", s.ToString().c_str()); thread->stats.AddErrors(1); } } @@ -263,6 +266,7 @@ class CfConsistencyStressTest : public StressTest { if (s.ok()) { thread->stats.AddPrefixes(1, count); } else { + fprintf(stderr, "TestPrefixScan error: %s\n", s.ToString().c_str()); thread->stats.AddErrors(1); } delete iter; diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index 3e070ee26..3d6d9e360 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -955,6 +955,7 @@ Status StressTest::TestIterate(ThreadState* thread, if (s.ok()) { thread->stats.AddIterations(1); } else { + fprintf(stderr, "TestIterate error: %s\n", s.ToString().c_str()); thread->stats.AddErrors(1); break; } diff --git a/db_stress_tool/no_batched_ops_stress.cc b/db_stress_tool/no_batched_ops_stress.cc index 0cc98ed3a..eed3f8eed 100644 --- a/db_stress_tool/no_batched_ops_stress.cc +++ b/db_stress_tool/no_batched_ops_stress.cc @@ -147,6 +147,7 @@ class NonBatchedOpsStressTest : public StressTest { thread->stats.AddGets(1, 0); } else { // errors case + fprintf(stderr, "TestGet error: %s\n", s.ToString().c_str()); thread->stats.AddErrors(1); } return s; @@ -243,6 +244,7 @@ class NonBatchedOpsStressTest : public StressTest { thread->stats.AddGets(1, 0); } else { // errors case + fprintf(stderr, "MultiGet error: %s\n", s.ToString().c_str()); thread->stats.AddErrors(1); } } @@ -277,6 +279,7 @@ class NonBatchedOpsStressTest : public StressTest { if (iter->status().ok()) { thread->stats.AddPrefixes(1, count); } else { + fprintf(stderr, "TestPrefixScan error: %s\n", s.ToString().c_str()); thread->stats.AddErrors(1); } delete iter;