From c8d67e634f79fe0cac7399c1144c1e2a49a0abf3 Mon Sep 17 00:00:00 2001 From: xmx8 Date: Fri, 13 Jun 2025 09:25:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Edebug=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6thread=5Fstatus=5Fupdater=5Fdebug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitoring/thread_status_updater_debug.cc | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 storage/rocksdb/rocksdb/monitoring/thread_status_updater_debug.cc diff --git a/storage/rocksdb/rocksdb/monitoring/thread_status_updater_debug.cc b/storage/rocksdb/rocksdb/monitoring/thread_status_updater_debug.cc new file mode 100644 index 000000000..464c23bba --- /dev/null +++ b/storage/rocksdb/rocksdb/monitoring/thread_status_updater_debug.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2011-present, Facebook, Inc. 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). + +#include + +#include "db/column_family.h" +#include "monitoring/thread_status_updater.h" +#include "util/cast_util.h" + +namespace ROCKSDB_NAMESPACE { + +#ifndef NDEBUG +#ifdef ROCKSDB_USING_THREAD_STATUS +void ThreadStatusUpdater::TEST_VerifyColumnFamilyInfoMap( + const std::vector& handles, bool check_exist) { + std::unique_lock lock(thread_list_mutex_); + if (check_exist) { + assert(cf_info_map_.size() == handles.size()); + } + for (auto* handle : handles) { + auto* cfd = static_cast_with_check(handle)->cfd(); + auto iter __attribute__((__unused__)) = cf_info_map_.find(cfd); + if (check_exist) { + assert(iter != cf_info_map_.end()); + assert(iter->second.cf_name == cfd->GetName()); + } else { + assert(iter == cf_info_map_.end()); + } + } +} + +#else + +void ThreadStatusUpdater::TEST_VerifyColumnFamilyInfoMap( + const std::vector& /*handles*/, bool /*check_exist*/) { +} + +#endif // ROCKSDB_USING_THREAD_STATUS +#endif // !NDEBUG + +} // namespace ROCKSDB_NAMESPACE -- Gitee