From 111ebf3161e3ef03986f02a16f1b2207be2567fe Mon Sep 17 00:00:00 2001 From: sdong Date: Wed, 6 Nov 2019 17:37:07 -0800 Subject: [PATCH] db_stress: improve TestGet() failure printing (#5989) Summary: Right now, in db_stress's CF consistency test's TestGet case, if failure happens, we do normal string printing, rather than hex printing, so that some text is not printed out, which makes debugging harder. Fix it by printing hex instead. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5989 Test Plan: Build db_stress and see t passes. Differential Revision: D18363552 fbshipit-source-id: 09d1b8f6fbff37441cbe7e63a1aef27551226cec --- tools/db_stress_tool.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/db_stress_tool.cc b/tools/db_stress_tool.cc index 845416602..1444b1460 100644 --- a/tools/db_stress_tool.cc +++ b/tools/db_stress_tool.cc @@ -4277,27 +4277,31 @@ class CfConsistencyStressTest : public StressTest { } if (!found && s.ok()) { fprintf(stderr, "Get() return different results with key %s\n", - key_str.c_str()); + Slice(key_str).ToString(true).c_str()); fprintf(stderr, "CF %s is not found\n", column_family_names_[0].c_str()); fprintf(stderr, "CF %s returns value %s\n", - column_family_names_[i].c_str(), value1.c_str()); + column_family_names_[i].c_str(), + Slice(value1).ToString(true).c_str()); is_consistent = false; } else if (found && s.IsNotFound()) { fprintf(stderr, "Get() return different results with key %s\n", - key_str.c_str()); + Slice(key_str).ToString(true).c_str()); fprintf(stderr, "CF %s returns value %s\n", - column_family_names_[0].c_str(), value0.c_str()); + column_family_names_[0].c_str(), + Slice(value0).ToString(true).c_str()); fprintf(stderr, "CF %s is not found\n", column_family_names_[i].c_str()); is_consistent = false; } else if (s.ok() && value0 != value1) { fprintf(stderr, "Get() return different results with key %s\n", - key_str.c_str()); + Slice(key_str).ToString(true).c_str()); fprintf(stderr, "CF %s returns value %s\n", - column_family_names_[0].c_str(), value0.c_str()); + column_family_names_[0].c_str(), + Slice(value0).ToString(true).c_str()); fprintf(stderr, "CF %s returns value %s\n", - column_family_names_[i].c_str(), value1.c_str()); + column_family_names_[i].c_str(), + Slice(value1).ToString(true).c_str()); is_consistent = false; } if (!is_consistent) {