X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Frocksdb%2Fdb_stress_tool%2Fdb_stress_shared_state.h;h=86310f82f75c09710c32374e0a4e9e94838fb0f0;hb=20effc670b57271cb089376d6d0800990e5218d5;hp=b68670b580efe0c70198f64fd355fbbe1c9447fc;hpb=a71831dadd1e1f3e0fa70405511f65cc33db0498;p=ceph.git diff --git a/ceph/src/rocksdb/db_stress_tool/db_stress_shared_state.h b/ceph/src/rocksdb/db_stress_tool/db_stress_shared_state.h index b68670b58..86310f82f 100644 --- a/ceph/src/rocksdb/db_stress_tool/db_stress_shared_state.h +++ b/ceph/src/rocksdb/db_stress_tool/db_stress_shared_state.h @@ -11,6 +11,10 @@ #pragma once #include "db_stress_tool/db_stress_stat.h" +// SyncPoint is not supported in Released Windows Mode. +#if !(defined NDEBUG) || !defined(OS_WIN) +#include "test_util/sync_point.h" +#endif // !(defined NDEBUG) || !defined(OS_WIN) #include "util/gflags_compat.h" DECLARE_uint64(seed); @@ -24,6 +28,7 @@ DECLARE_int32(clear_column_family_one_in); DECLARE_bool(test_batches_snapshots); DECLARE_int32(compaction_thread_pool_adjust_interval); DECLARE_int32(continuous_verification_interval); +DECLARE_int32(read_fault_one_in); namespace ROCKSDB_NAMESPACE { class StressTest; @@ -37,6 +42,20 @@ class SharedState { // indicates a key should definitely be deleted static const uint32_t DELETION_SENTINEL; + // Errors when reading filter blocks are ignored, so we use a thread + // local variable updated via sync points to keep track of errors injected + // while reading filter blocks in order to ignore the Get/MultiGet result + // for those calls +#if defined(ROCKSDB_SUPPORT_THREAD_LOCAL) +#if defined(OS_SOLARIS) + static __thread bool ignore_read_error; +#else + static thread_local bool ignore_read_error; +#endif // OS_SOLARIS +#else + static bool ignore_read_error; +#endif // ROCKSDB_SUPPORT_THREAD_LOCAL + SharedState(Env* env, StressTest* stress_test) : cv_(&mu_), seed_(static_cast(FLAGS_seed)), @@ -171,9 +190,23 @@ class SharedState { ++num_bg_threads_; fprintf(stdout, "Starting continuous_verification_thread\n"); } +#ifndef NDEBUG + if (FLAGS_read_fault_one_in) { + SyncPoint::GetInstance()->SetCallBack("FaultInjectionIgnoreError", + IgnoreReadErrorCallback); + SyncPoint::GetInstance()->EnableProcessing(); + } +#endif // NDEBUG } - ~SharedState() {} + ~SharedState() { +#ifndef NDEBUG + if (FLAGS_read_fault_one_in) { + SyncPoint::GetInstance()->ClearAllCallBacks(); + SyncPoint::GetInstance()->DisableProcessing(); + } +#endif + } port::Mutex* GetMutex() { return &mu_; } @@ -329,6 +362,10 @@ class SharedState { } private: + static void IgnoreReadErrorCallback(void*) { + ignore_read_error = true; + } + port::Mutex mu_; port::CondVar cv_; const uint32_t seed_;