2023-03-18 16:51:58 +00:00
|
|
|
// 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 {
|
2024-01-29 18:38:08 +00:00
|
|
|
const std::string& InvalidWriteStallHyphenString();
|
2023-03-18 16:51:58 +00:00
|
|
|
|
2024-01-29 18:38:08 +00:00
|
|
|
const std::string& WriteStallCauseToHyphenString(WriteStallCause cause);
|
2023-03-18 16:51:58 +00:00
|
|
|
|
2024-01-29 18:38:08 +00:00
|
|
|
const std::string& WriteStallConditionToHyphenString(
|
2023-04-05 21:42:31 +00:00
|
|
|
WriteStallCondition condition);
|
2023-03-18 16:51:58 +00:00
|
|
|
|
|
|
|
// REQUIRES:
|
|
|
|
// cause` is CF-scope `WriteStallCause`, see `WriteStallCause` for more
|
|
|
|
//
|
|
|
|
// REQUIRES:
|
|
|
|
// `condition` != `WriteStallCondition::kNormal`
|
2024-01-29 18:38:08 +00:00
|
|
|
InternalStats::InternalCFStatsType InternalCFStat(
|
2023-03-18 16:51:58 +00:00
|
|
|
WriteStallCause cause, WriteStallCondition condition);
|
|
|
|
|
|
|
|
// REQUIRES:
|
|
|
|
// cause` is DB-scope `WriteStallCause`, see `WriteStallCause` for more
|
|
|
|
//
|
|
|
|
// REQUIRES:
|
|
|
|
// `condition` != `WriteStallCondition::kNormal`
|
2024-01-29 18:38:08 +00:00
|
|
|
InternalStats::InternalDBStatsType InternalDBStat(
|
2023-03-18 16:51:58 +00:00
|
|
|
WriteStallCause cause, WriteStallCondition condition);
|
|
|
|
|
2024-01-29 18:38:08 +00:00
|
|
|
bool isCFScopeWriteStallCause(WriteStallCause cause);
|
|
|
|
bool isDBScopeWriteStallCause(WriteStallCause cause);
|
2023-03-18 16:51:58 +00:00
|
|
|
|
|
|
|
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
|