]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/monitoring/thread_status_updater_debug.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / monitoring / thread_status_updater_debug.cc
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5
6 #include <mutex>
7
8 #include "db/column_family.h"
9 #include "monitoring/thread_status_updater.h"
10 #include "util/cast_util.h"
11
12 namespace ROCKSDB_NAMESPACE {
13
14 #ifndef NDEBUG
15 #ifdef ROCKSDB_USING_THREAD_STATUS
16 void ThreadStatusUpdater::TEST_VerifyColumnFamilyInfoMap(
17 const std::vector<ColumnFamilyHandle*>& handles, bool check_exist) {
18 std::unique_lock<std::mutex> lock(thread_list_mutex_);
19 if (check_exist) {
20 assert(cf_info_map_.size() == handles.size());
21 }
22 for (auto* handle : handles) {
23 auto* cfd = static_cast_with_check<ColumnFamilyHandleImpl>(handle)->cfd();
24 auto iter __attribute__((__unused__)) = cf_info_map_.find(cfd);
25 if (check_exist) {
26 assert(iter != cf_info_map_.end());
27 assert(iter->second.cf_name == cfd->GetName());
28 } else {
29 assert(iter == cf_info_map_.end());
30 }
31 }
32 }
33
34 #else
35
36 void ThreadStatusUpdater::TEST_VerifyColumnFamilyInfoMap(
37 const std::vector<ColumnFamilyHandle*>& /*handles*/, bool /*check_exist*/) {
38 }
39
40 #endif // ROCKSDB_USING_THREAD_STATUS
41 #endif // !NDEBUG
42
43 } // namespace ROCKSDB_NAMESPACE