From 0d68aff3a16ae7710ea05b4ace2f1ddf2bcdf189 Mon Sep 17 00:00:00 2001 From: Jay Huh Date: Mon, 29 Jan 2024 12:52:59 -0800 Subject: [PATCH] StressTest - Move some stderr messages to stdout (#12304) Summary: Moving some of the messages that we print out in `stderr` to `stdout` to make `stderr` more strictly related to errors. Pull Request resolved: https://github.com/facebook/rocksdb/pull/12304 Test Plan: ``` $> python3 tools/db_crashtest.py blackbox --simple --max_key=25000000 --write_buffer_size=4194304 ``` **Before** ``` ... stderr: WARNING: prefix_size is non-zero but memtablerep != prefix_hash Error : jewoongh injected test error This is not a real failure. Verification failed :( ``` **After** No longer seeing the `WARNING: prefix_size is non-zero but memtablerep != prefix_hash` message in stderr, but still appears in stdout. ``` WARNING: prefix_size is non-zero but memtablerep != prefix_hash Integrated BlobDB: blob files enabled 0, min blob size 0, blob file size 268435456, blob compression type NoCompression, blob GC enabled 0, cutoff 0.250000, force threshold 1.000000, blob compaction readahead size 0, blob file starting level 0 Integrated BlobDB: blob cache disabled DB path: [/tmp/jewoongh/rocksdb_crashtest_blackboxzztp281q] (Re-)verified 0 unique IDs 2024/01/29-11:57:51 Initializing worker threads Crash-recovery verification passed :) 2024/01/29-11:57:58 Starting database operations 2024/01/29-11:57:58 Starting verification Stress Test : 245.167 micros/op 10221 ops/sec : Wrote 0.00 MB (0.10 MB/sec) (16% of 6 ops) : Wrote 1 times : Deleted 0 times : Single deleted 0 times : 4 read and 0 found the key : Prefix scanned 0 times : Iterator size sum is 0 : Iterated 3 times : Deleted 0 key-ranges : Range deletions covered 0 keys : Got errors 0 times : 0 CompactFiles() succeed : 0 CompactFiles() did not succeed stderr: Error : jewoongh injected test error This is not a real failure. Error : jewoongh injected test error This is not a real failure. Error : jewoongh injected test error This is not a real failure. Verification failed :( ``` Reviewed By: akankshamahajan15 Differential Revision: D53193587 Pulled By: jaykorean fbshipit-source-id: 40d59f4c993c5ce043c571a207ccc9b74a0180c6 --- db_stress_tool/db_stress_common.cc | 4 ++-- db_stress_tool/db_stress_test_base.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db_stress_tool/db_stress_common.cc b/db_stress_tool/db_stress_common.cc index dc600a49f73..bf0a56358b1 100644 --- a/db_stress_tool/db_stress_common.cc +++ b/db_stress_tool/db_stress_common.cc @@ -200,7 +200,7 @@ void CompressedCacheSetCapacityThread(void* v) { // Lower by upto 50% of usable block cache capacity adjustment = (adjustment * thread->rand.Uniform(50)) / 100; block_cache->SetCapacity(capacity - adjustment); - fprintf(stderr, "New cache capacity = %lu\n", + fprintf(stdout, "New cache capacity = %lu\n", block_cache->GetCapacity()); db_stress_env->SleepForMicroseconds(10 * 1000 * 1000); block_cache->SetCapacity(capacity); @@ -210,7 +210,7 @@ void CompressedCacheSetCapacityThread(void* v) { (double)thread->rand.Uniform( FLAGS_compressed_secondary_cache_ratio * 100) / 100; - fprintf(stderr, "New comp cache ratio = %f\n", new_comp_cache_ratio); + fprintf(stdout, "New comp cache ratio = %f\n", new_comp_cache_ratio); s = UpdateTieredCache(block_cache, /*capacity*/ -1, new_comp_cache_ratio); diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index 82b03871e6f..b596382c7f3 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -2701,7 +2701,7 @@ void StressTest::Open(SharedState* shared, bool reopen) { exit(1); } if (FLAGS_prefix_size != 0 && FLAGS_rep_factory != kHashSkipList) { - fprintf(stderr, + fprintf(stdout, "WARNING: prefix_size is non-zero but " "memtablerep != prefix_hash\n"); }