提交 f0c194c3 编写于 作者: O obdev 提交者: ob-robot

fix bug of obj_leak_checker

上级 2c2c26c3
......@@ -337,7 +337,6 @@ public:
ObLDHandle &operator=(ObLDHandle &&other)
{
node_ = other.node_;
other.node_;
return *this;
}
ObLDHandleNode *node_;
......
......@@ -28,7 +28,6 @@ enum ObLeakCheckObjType
{
LEAK_CHECK_OBJ_TABLET_HANDLE,
LEAK_CHECK_OBJ_LS_HANDLE,
LEAK_CHECK_OBJ_TABLE_HANDLE,
LEAK_CHECK_OBJ_MAX_NUM
};
......@@ -81,7 +80,27 @@ public:
ob_assert(it != obj_map.end());
obj_map.erase(it);
}
ObLeakCheckAllMap &get_map() { return map_; }
void print_obj_leak(const uint64_t tenant_id, const ObLeakCheckObjType obj_type)
{
common::ObSpinLockGuard guard(lock_);
auto it = map_.find(tenant_id);
if (it != map_.end()) {
if (LEAK_CHECK_OBJ_MAX_NUM == obj_type) {
for (int64_t i = 0; i < LEAK_CHECK_OBJ_MAX_NUM; i++) {
auto &obj_map = it->second.at(i);
for (auto &pair : obj_map) {
SHARE_LOG(INFO, "dump leak obj", K(pair.first), K(pair.second.c_str()));
}
}
} else {
auto &obj_map = it->second.at(obj_type);
for (auto &pair : obj_map) {
SHARE_LOG(INFO, "dump leak obj", K(pair.first), K(pair.second.c_str()));
}
}
}
}
private:
ObSpinLock lock_;
......@@ -143,24 +162,8 @@ public:
// if obj_type == LEAK_CHECK_OBJ_MAX_NUM, dump all type obj
#define PRINT_OBJ_LEAK(tenant_id, obj_type) \
{ \
auto &leak_map = OBJ_LEAK_CHECKER.get_map(); \
auto it = leak_map.find(tenant_id); \
if (it != leak_map.end()) { \
if (LEAK_CHECK_OBJ_MAX_NUM == obj_type) { \
for (int64_t i = 0; i < LEAK_CHECK_OBJ_MAX_NUM; i++) { \
auto &obj_map = it->second.at(i); \
for (auto &pair : obj_map) { \
LOG_INFO("dump leak obj", K(pair.first), K(pair.second.c_str())); \
} \
} \
} else { \
auto &obj_map = it->second.at(obj_type); \
for (auto &pair : obj_map) { \
LOG_INFO("dump leak obj", K(pair.first), K(pair.second.c_str())); \
} \
} \
} \
}
OBJ_LEAK_CHECKER.print_obj_leak(tenant_id, obj_type); \
}
#else
#define DEFINE_OBJ_LEAK_DEBUG_NODE(node)
......
......@@ -169,14 +169,12 @@ int64_t ObITable::to_string(char *buf, const int64_t buf_len) const
ObTableHandleV2::ObTableHandleV2()
: table_(nullptr), t3m_(nullptr), allocator_(nullptr), table_type_(ObITable::TableType::MAX_TABLE_TYPE)
{
INIT_OBJ_LEAK_DEBUG_NODE(node_, this, share::LEAK_CHECK_OBJ_TABLE_HANDLE, MTL_ID());
}
ObTableHandleV2::ObTableHandleV2(ObITable *table, ObTenantMetaMemMgr *t3m, ObITable::TableType type)
: table_(nullptr), t3m_(nullptr), allocator_(nullptr), table_type_(type)
{
abort_unless(OB_SUCCESS == set_table(table, t3m, table_type_));
INIT_OBJ_LEAK_DEBUG_NODE(node_, this, share::LEAK_CHECK_OBJ_TABLE_HANDLE, MTL_ID());
}
ObTableHandleV2::~ObTableHandleV2()
......@@ -422,7 +420,6 @@ int ObTableHandleV2::get_lock_memtable(const ObLockMemtable *&memtable) const
ObTableHandleV2::ObTableHandleV2(const ObTableHandleV2 &other)
: table_(nullptr), t3m_(nullptr)
{
INIT_OBJ_LEAK_DEBUG_NODE(node_, this, share::LEAK_CHECK_OBJ_TABLE_HANDLE, MTL_ID());
*this = other;
}
......
......@@ -24,7 +24,6 @@
#include "storage/ob_i_store.h"
#include "storage/access/ob_table_read_info.h"
#include "storage/meta_mem/ob_tenant_meta_obj_pool.h"
#include "share/leak_checker/obj_leak_checker.h"
#include "share/ob_table_range.h"
#include "share/scn.h"
......@@ -403,7 +402,6 @@ private:
ObTenantMetaMemMgr *t3m_;
common::ObIAllocator *allocator_;
ObITable::TableType table_type_;
DEFINE_OBJ_LEAK_DEBUG_NODE(node_);
};
class ObTablesHandleArray final
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册