fix slice_writer allocator bug

This commit is contained in:
yongshige 2023-06-21 21:42:28 +00:00 committed by ob-robot
parent 93b3db6042
commit 2c601683f3
2 changed files with 7 additions and 3 deletions

View File

@ -53,6 +53,7 @@ bool ObDirectLoadFastHeapTableBuildParam::is_valid() const
ObDirectLoadFastHeapTableBuilder::ObDirectLoadFastHeapTableBuilder()
: allocator_("TLD_FastHTable"),
slice_writer_allocator_("TLD_SliceWriter"),
fast_heap_table_tablet_ctx_(nullptr),
slice_writer_(nullptr),
row_count_(0),
@ -65,12 +66,13 @@ ObDirectLoadFastHeapTableBuilder::~ObDirectLoadFastHeapTableBuilder()
{
if (nullptr != slice_writer_) {
slice_writer_->~ObSSTableInsertSliceWriter();
allocator_.free(slice_writer_);
slice_writer_allocator_.free(slice_writer_);
slice_writer_ = nullptr;
}
for (int64_t i = 0; i < column_stat_array_.count(); ++i) {
ObOptOSGColumnStat *col_stat = column_stat_array_.at(i);
col_stat->~ObOptOSGColumnStat();
allocator_.free(col_stat);
col_stat = nullptr;
}
}
@ -132,6 +134,7 @@ int ObDirectLoadFastHeapTableBuilder::init(const ObDirectLoadFastHeapTableBuildP
} else {
param_ = param;
allocator_.set_tenant_id(MTL_ID());
slice_writer_allocator_.set_tenant_id(MTL_ID());
if (param_.online_opt_stat_gather_ && OB_FAIL(init_sql_statistics())) {
LOG_WARN("fail to inner init sql statistics", KR(ret));
} else if (OB_FAIL(param_.fast_heap_table_ctx_->get_tablet_context(
@ -163,7 +166,7 @@ int ObDirectLoadFastHeapTableBuilder::init_sstable_slice_ctx()
fast_heap_table_tablet_ctx_->get_target_tablet_id(),
write_ctx_.start_seq_,
slice_writer_,
allocator_))) {
slice_writer_allocator_))) {
LOG_WARN("fail to construct sstable slice writer", KR(ret));
}
return ret;
@ -179,7 +182,7 @@ int ObDirectLoadFastHeapTableBuilder::switch_sstable_slice()
LOG_WARN("fail to close sstable slice builder", KR(ret));
} else {
slice_writer_->~ObSSTableInsertSliceWriter();
allocator_.reuse();
slice_writer_allocator_.reuse();
if (OB_FAIL(init_sstable_slice_ctx())) {
LOG_WARN("fail to init sstable slice ctx", KR(ret));
}

View File

@ -67,6 +67,7 @@ private:
private:
ObDirectLoadFastHeapTableBuildParam param_;
common::ObArenaAllocator allocator_;
common::ObArenaAllocator slice_writer_allocator_;
ObDirectLoadFastHeapTableTabletContext *fast_heap_table_tablet_ctx_;
ObSSTableInsertSliceWriter *slice_writer_;
ObDirectLoadFastHeapTableTabletWriteCtx write_ctx_;