rocksdb/db/write_stall_stats.h
Hui Xiao 7f5b9f40cb Fix initialization-order-fiasco in write_stall_stats.cc (#11355)
Summary:
**Context/Summary:**
As title.

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

Test Plan:
- Ran previously failed tests and they succeed
- Perf
`./db_bench -seed=1679014417652004 -db=/dev/shm/testdb/ -statistics=false -benchmarks="fillseq[-X60]" -key_size=32 -value_size=512 -num=100000 -db_write_buffer_size=655 -target_file_size_base=655 -disable_auto_compactions=false -compression_type=none -bloom_bits=3`

Reviewed By: ajkr

Differential Revision: D44719333

Pulled By: hx235

fbshipit-source-id: 23d22f314144071d97f7106ff1241c31c0bdf08b
2023-04-05 14:42:31 -07:00

48 lines
1.7 KiB
C++

// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#pragma once
#include <array>
#include "db/internal_stats.h"
#include "rocksdb/types.h"
namespace ROCKSDB_NAMESPACE {
extern const std::string& InvalidWriteStallHyphenString();
extern const std::string& WriteStallCauseToHyphenString(WriteStallCause cause);
extern const std::string& WriteStallConditionToHyphenString(
WriteStallCondition condition);
// REQUIRES:
// cause` is CF-scope `WriteStallCause`, see `WriteStallCause` for more
//
// REQUIRES:
// `condition` != `WriteStallCondition::kNormal`
extern InternalStats::InternalCFStatsType InternalCFStat(
WriteStallCause cause, WriteStallCondition condition);
// REQUIRES:
// cause` is DB-scope `WriteStallCause`, see `WriteStallCause` for more
//
// REQUIRES:
// `condition` != `WriteStallCondition::kNormal`
extern InternalStats::InternalDBStatsType InternalDBStat(
WriteStallCause cause, WriteStallCondition condition);
extern bool isCFScopeWriteStallCause(WriteStallCause cause);
extern bool isDBScopeWriteStallCause(WriteStallCause cause);
constexpr uint32_t kNumCFScopeWriteStallCauses =
static_cast<uint32_t>(WriteStallCause::kCFScopeWriteStallCauseEnumMax) -
static_cast<uint32_t>(WriteStallCause::kMemtableLimit);
constexpr uint32_t kNumDBScopeWriteStallCauses =
static_cast<uint32_t>(WriteStallCause::kDBScopeWriteStallCauseEnumMax) -
static_cast<uint32_t>(WriteStallCause::kWriteBufferManagerLimit);
} // namespace ROCKSDB_NAMESPACE