fix bug of obj_leak_checker
This commit is contained in:
1
deps/oblib/src/lib/lock/ob_latch.h
vendored
1
deps/oblib/src/lib/lock/ob_latch.h
vendored
@ -337,7 +337,6 @@ public:
|
|||||||
ObLDHandle &operator=(ObLDHandle &&other)
|
ObLDHandle &operator=(ObLDHandle &&other)
|
||||||
{
|
{
|
||||||
node_ = other.node_;
|
node_ = other.node_;
|
||||||
other.node_;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
ObLDHandleNode *node_;
|
ObLDHandleNode *node_;
|
||||||
|
@ -28,7 +28,6 @@ enum ObLeakCheckObjType
|
|||||||
{
|
{
|
||||||
LEAK_CHECK_OBJ_TABLET_HANDLE,
|
LEAK_CHECK_OBJ_TABLET_HANDLE,
|
||||||
LEAK_CHECK_OBJ_LS_HANDLE,
|
LEAK_CHECK_OBJ_LS_HANDLE,
|
||||||
LEAK_CHECK_OBJ_TABLE_HANDLE,
|
|
||||||
LEAK_CHECK_OBJ_MAX_NUM
|
LEAK_CHECK_OBJ_MAX_NUM
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -81,7 +80,27 @@ public:
|
|||||||
ob_assert(it != obj_map.end());
|
ob_assert(it != obj_map.end());
|
||||||
obj_map.erase(it);
|
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:
|
private:
|
||||||
ObSpinLock lock_;
|
ObSpinLock lock_;
|
||||||
@ -143,24 +162,8 @@ public:
|
|||||||
// if obj_type == LEAK_CHECK_OBJ_MAX_NUM, dump all type obj
|
// if obj_type == LEAK_CHECK_OBJ_MAX_NUM, dump all type obj
|
||||||
#define PRINT_OBJ_LEAK(tenant_id, obj_type) \
|
#define PRINT_OBJ_LEAK(tenant_id, obj_type) \
|
||||||
{ \
|
{ \
|
||||||
auto &leak_map = OBJ_LEAK_CHECKER.get_map(); \
|
OBJ_LEAK_CHECKER.print_obj_leak(tenant_id, obj_type); \
|
||||||
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())); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define DEFINE_OBJ_LEAK_DEBUG_NODE(node)
|
#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()
|
ObTableHandleV2::ObTableHandleV2()
|
||||||
: table_(nullptr), t3m_(nullptr), allocator_(nullptr), table_type_(ObITable::TableType::MAX_TABLE_TYPE)
|
: 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)
|
ObTableHandleV2::ObTableHandleV2(ObITable *table, ObTenantMetaMemMgr *t3m, ObITable::TableType type)
|
||||||
: table_(nullptr), t3m_(nullptr), allocator_(nullptr), table_type_(type)
|
: table_(nullptr), t3m_(nullptr), allocator_(nullptr), table_type_(type)
|
||||||
{
|
{
|
||||||
abort_unless(OB_SUCCESS == set_table(table, t3m, table_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()
|
ObTableHandleV2::~ObTableHandleV2()
|
||||||
@ -422,7 +420,6 @@ int ObTableHandleV2::get_lock_memtable(const ObLockMemtable *&memtable) const
|
|||||||
ObTableHandleV2::ObTableHandleV2(const ObTableHandleV2 &other)
|
ObTableHandleV2::ObTableHandleV2(const ObTableHandleV2 &other)
|
||||||
: table_(nullptr), t3m_(nullptr)
|
: table_(nullptr), t3m_(nullptr)
|
||||||
{
|
{
|
||||||
INIT_OBJ_LEAK_DEBUG_NODE(node_, this, share::LEAK_CHECK_OBJ_TABLE_HANDLE, MTL_ID());
|
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "storage/ob_i_store.h"
|
#include "storage/ob_i_store.h"
|
||||||
#include "storage/access/ob_table_read_info.h"
|
#include "storage/access/ob_table_read_info.h"
|
||||||
#include "storage/meta_mem/ob_tenant_meta_obj_pool.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/ob_table_range.h"
|
||||||
#include "share/scn.h"
|
#include "share/scn.h"
|
||||||
|
|
||||||
@ -403,7 +402,6 @@ private:
|
|||||||
ObTenantMetaMemMgr *t3m_;
|
ObTenantMetaMemMgr *t3m_;
|
||||||
common::ObIAllocator *allocator_;
|
common::ObIAllocator *allocator_;
|
||||||
ObITable::TableType table_type_;
|
ObITable::TableType table_type_;
|
||||||
DEFINE_OBJ_LEAK_DEBUG_NODE(node_);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ObTablesHandleArray final
|
class ObTablesHandleArray final
|
||||||
|
Reference in New Issue
Block a user