2016-02-09 15:12:00 -08:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-15 16:03:42 -07:00
|
|
|
// 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).
|
2014-11-20 10:49:32 -08:00
|
|
|
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
#include "db/column_family.h"
|
2017-04-05 19:02:00 -07:00
|
|
|
#include "monitoring/thread_status_updater.h"
|
2014-11-20 10:49:32 -08:00
|
|
|
|
|
|
|
namespace rocksdb {
|
2015-01-13 00:04:08 -08:00
|
|
|
|
|
|
|
#ifndef NDEBUG
|
2016-12-13 18:22:00 -08:00
|
|
|
#ifdef ROCKSDB_USING_THREAD_STATUS
|
2014-12-22 12:20:17 -08:00
|
|
|
void ThreadStatusUpdater::TEST_VerifyColumnFamilyInfoMap(
|
2018-04-12 17:55:14 -07:00
|
|
|
const std::vector<ColumnFamilyHandle*>& handles, bool check_exist) {
|
2014-11-20 10:49:32 -08:00
|
|
|
std::unique_lock<std::mutex> lock(thread_list_mutex_);
|
2014-11-20 21:13:18 -08:00
|
|
|
if (check_exist) {
|
|
|
|
assert(cf_info_map_.size() == handles.size());
|
|
|
|
}
|
2014-11-20 10:49:32 -08:00
|
|
|
for (auto* handle : handles) {
|
|
|
|
auto* cfd = reinterpret_cast<ColumnFamilyHandleImpl*>(handle)->cfd();
|
2018-02-02 12:14:42 -08:00
|
|
|
auto iter __attribute__((__unused__)) = cf_info_map_.find(cfd);
|
2014-11-20 21:13:18 -08:00
|
|
|
if (check_exist) {
|
|
|
|
assert(iter != cf_info_map_.end());
|
2017-09-28 14:22:06 -07:00
|
|
|
assert(iter->second.cf_name == cfd->GetName());
|
2014-11-20 21:13:18 -08:00
|
|
|
} else {
|
|
|
|
assert(iter == cf_info_map_.end());
|
|
|
|
}
|
2014-11-20 10:49:32 -08:00
|
|
|
}
|
|
|
|
}
|
2015-01-13 00:04:08 -08:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
void ThreadStatusUpdater::TEST_VerifyColumnFamilyInfoMap(
|
2018-04-12 17:55:14 -07:00
|
|
|
const std::vector<ColumnFamilyHandle*>& /*handles*/, bool /*check_exist*/) {
|
2015-01-13 00:04:08 -08:00
|
|
|
}
|
|
|
|
|
2014-11-20 10:49:32 -08:00
|
|
|
#endif // ROCKSDB_USING_THREAD_STATUS
|
2015-01-13 00:04:08 -08:00
|
|
|
#endif // !NDEBUG
|
|
|
|
|
|
|
|
} // namespace rocksdb
|