db_stress prints key in Hex (#7533)

Summary:
db_stress prints key in both id and hex. https://github.com/facebook/rocksdb/issues/7531

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7533

Test Plan: local test

Reviewed By: akankshamahajan15

Differential Revision: D24252725

Pulled By: jay-zhuang

fbshipit-source-id: f0c1409a0568874df36949d5da139316d978fa98
main
Jay Zhuang 4 years ago committed by Facebook GitHub Bot
parent 3dc823212d
commit 4a6840bd00
  1. 6
      db_stress_tool/db_stress_common.cc
  2. 6
      db_stress_tool/db_stress_test_base.cc

@ -160,8 +160,10 @@ void PrintKeyValue(int cf, uint64_t key, const char* value, size_t sz) {
snprintf(buf, 4, "%X", value[i]); snprintf(buf, 4, "%X", value[i]);
tmp.append(buf); tmp.append(buf);
} }
fprintf(stdout, "[CF %d] %" PRIi64 " == > (%" ROCKSDB_PRIszt ") %s\n", cf, auto key_str = Key(key);
key, sz, tmp.c_str()); Slice key_slice = key_str;
fprintf(stdout, "[CF %d] %s (%" PRIi64 ") == > (%" ROCKSDB_PRIszt ") %s\n",
cf, key_slice.ToString(true).c_str(), key, sz, tmp.c_str());
} }
// Note that if hot_key_alpha != 0, it generates the key based on Zipfian // Note that if hot_key_alpha != 0, it generates the key based on Zipfian

@ -329,9 +329,11 @@ void StressTest::VerificationAbort(SharedState* shared, std::string msg,
void StressTest::VerificationAbort(SharedState* shared, std::string msg, int cf, void StressTest::VerificationAbort(SharedState* shared, std::string msg, int cf,
int64_t key) const { int64_t key) const {
auto key_str = Key(key);
Slice key_slice = key_str;
fprintf(stderr, fprintf(stderr,
"Verification failed for column family %d key %" PRIi64 ": %s\n", cf, "Verification failed for column family %d key %s (%" PRIi64 "): %s\n",
key, msg.c_str()); cf, key_slice.ToString(true).c_str(), key, msg.c_str());
shared->SetVerificationFailure(); shared->SetVerificationFailure();
} }

Loading…
Cancel
Save