add double-destroy check for MemoryContext

This commit is contained in:
jg0
2021-07-27 19:54:14 +08:00
committed by wangzelin.wzl
parent 91852f9b58
commit 0b7773c43f
86 changed files with 416 additions and 329 deletions

View File

@ -128,7 +128,7 @@ public:
: common::ObVTableScanParam(),
trans_desc_(NULL),
table_param_(NULL),
allocator_(&CURRENT_CONTEXT.get_arena_allocator()),
allocator_(&CURRENT_CONTEXT->get_arena_allocator()),
part_filter_(NULL),
part_mgr_(NULL),
column_orders_(nullptr),
@ -143,7 +143,7 @@ public:
: common::ObVTableScanParam(),
trans_desc_(&trans_desc),
table_param_(NULL),
allocator_(&CURRENT_CONTEXT.get_arena_allocator()),
allocator_(&CURRENT_CONTEXT->get_arena_allocator()),
part_filter_(NULL),
part_mgr_(NULL),
column_orders_(nullptr),
@ -170,7 +170,7 @@ public:
int16_t block_cache_hit_rate_;
uint64_t ref_table_id_; // main table id
ObIPartitionGroupGuard* partition_guard_;
lib::MemoryContext* iterator_mementity_;
lib::MemoryContext iterator_mementity_;
OB_INLINE virtual bool is_valid() const
{
return (NULL != trans_desc_ && trans_desc_->is_valid_or_standalone_stmt() && ObVTableScanParam::is_valid());

View File

@ -963,8 +963,8 @@ int ObTableAccessContext::init(ObTableScanParam& scan_param, const ObStoreCtx& c
{
int ret = OB_SUCCESS;
lib::MemoryContext& current_mem =
(NULL == scan_param.iterator_mementity_) ? CURRENT_CONTEXT : *scan_param.iterator_mementity_;
lib::MemoryContext current_mem =
(NULL == scan_param.iterator_mementity_) ? CURRENT_CONTEXT : scan_param.iterator_mementity_;
lib::ContextParam param;
param
.set_mem_attr(
@ -979,11 +979,11 @@ int ObTableAccessContext::init(ObTableScanParam& scan_param, const ObStoreCtx& c
LOG_WARN("invalid argument", K(ret), "pkey", scan_param.pkey_);
} else if (NULL != scan_mem_) {
// reused, do nothing.
} else if (OB_FAIL(current_mem.CREATE_CONTEXT(scan_mem_, param))) {
} else if (OB_FAIL(current_mem->CREATE_CONTEXT(scan_mem_, param))) {
LOG_WARN("fail to create entity", K(ret));
}
if (OB_SUCC(ret)) {
stmt_mem_ = &current_mem;
stmt_mem_ = current_mem;
stmt_allocator_ = &stmt_mem_->get_arena_allocator();
allocator_ = &scan_mem_->get_arena_allocator();
pkey_ = scan_param.pkey_;
@ -1489,7 +1489,7 @@ int ObRowsInfo::init(
const ObRelativeTable& table, const ObStoreCtx& store_ctx, const ObIArray<share::schema::ObColDesc>& col_descs)
{
int ret = OB_SUCCESS;
lib::MemoryContext& current_mem = CURRENT_CONTEXT;
lib::MemoryContext current_mem = CURRENT_CONTEXT;
lib::ContextParam param;
param
@ -1499,7 +1499,7 @@ int ObRowsInfo::init(
if (OB_UNLIKELY(is_inited_)) {
ret = OB_INIT_TWICE;
STORAGE_LOG(WARN, "ObRowsinfo init twice", K(ret));
} else if (OB_FAIL(current_mem.CREATE_CONTEXT(scan_mem_, param))) {
} else if (OB_FAIL(current_mem->CREATE_CONTEXT(scan_mem_, param))) {
LOG_WARN("fail to create entity", K(ret));
} else if (OB_ISNULL(scan_mem_)) {
ret = OB_ERR_UNEXPECTED;

View File

@ -1363,7 +1363,7 @@ struct ObTableAccessContext {
int init(const common::ObQueryFlag& query_flag, const ObStoreCtx& ctx, common::ObArenaAllocator& allocator,
const common::ObVersionRange& trans_version_range);
TO_STRING_KV(K_(is_inited), K_(timeout), K_(pkey), K_(query_flag), K_(sql_mode), KP_(store_ctx), KP_(expr_ctx),
KP_(limit_param), KP_(stmt_allocator), KP_(allocator), KP_(stmt_mem), KP_(scan_mem), KP_(table_scan_stat),
KP_(limit_param), KP_(stmt_allocator), KP_(allocator), KP_(table_scan_stat),
KP_(block_cache_ws), K_(out_cnt), K_(is_end), K_(trans_version_range), KP_(row_filter), K_(merge_log_ts),
K_(read_out_type), K_(lob_locator_helper));
@ -1383,8 +1383,8 @@ public:
common::ObArenaAllocator* stmt_allocator_;
// storage scan/rescan interface level allocator, will be reclaimed in every scan/rescan call
common::ObArenaAllocator* allocator_;
lib::MemoryContext* stmt_mem_; // sql statement level memory entity, only for query
lib::MemoryContext* scan_mem_; // scan/rescan level memory entity, only for query
lib::MemoryContext stmt_mem_; // sql statement level memory entity, only for query
lib::MemoryContext scan_mem_; // scan/rescan level memory entity, only for query
common::ObTableScanStatistic* table_scan_stat_;
blocksstable::ObBlockCacheWorkingSet* block_cache_ws_;
ObTableAccessStat access_stat_;
@ -1512,7 +1512,7 @@ public:
private:
common::ObStoreRowkey min_key_;
lib::MemoryContext* scan_mem_; // scan/rescan level memory entity, only for query
lib::MemoryContext scan_mem_; // scan/rescan level memory entity, only for query
int64_t delete_count_;
bool collation_free_transformed_;
int16_t rowkey_column_num_;