Fix dynamic memory expansion of px rescan scene sort
This commit is contained in:
@ -55,10 +55,10 @@ protected:
|
||||
|
||||
LST_DO_CODE(USING_SORT_IMPL, init, is_inited, add_batch, get_next_batch,
|
||||
get_next_batch_stored_rows, init_temp_row_store, adjust_topn_read_rows, attach_rows,
|
||||
allocator_, eval_ctx_, cmp_sk_exprs_, sk_exprs_, all_exprs_, addon_exprs_,
|
||||
addon_vec_ptrs_, sk_vec_ptrs_, comp_, part_cnt_, topn_cnt_, outputted_rows_cnt_,
|
||||
cmp_sort_collations_, exec_ctx_, enable_encode_sortkey_, sk_rows_, addon_rows_,
|
||||
sk_store_, addon_store_, sk_row_meta_, addon_row_meta_);
|
||||
allocator_, mem_context_, eval_ctx_, cmp_sk_exprs_, sk_exprs_, all_exprs_,
|
||||
addon_exprs_, addon_vec_ptrs_, sk_vec_ptrs_, comp_, part_cnt_, topn_cnt_,
|
||||
outputted_rows_cnt_, cmp_sort_collations_, exec_ctx_, enable_encode_sortkey_,
|
||||
sk_rows_, addon_rows_, sk_store_, addon_store_, sk_row_meta_, addon_row_meta_);
|
||||
|
||||
// fetch rows in same prefix && do sort, set %next_prefix_row_ to nullptr
|
||||
// when all child rows are fetched.
|
||||
|
||||
@ -31,10 +31,20 @@ void ObPrefixSortVecImpl<Compare, Store_Row, has_addon>::reset()
|
||||
prefix_pos_ = 0;
|
||||
im_sk_store_.reset();
|
||||
im_addon_store_.reset();
|
||||
im_sk_rows_ = nullptr;
|
||||
im_addon_rows_ = nullptr;
|
||||
immediate_pos_ = 0;
|
||||
brs_ = nullptr;
|
||||
if (nullptr != mem_context_ && nullptr != selector_) {
|
||||
mem_context_->get_malloc_allocator().free(selector_);
|
||||
selector_ = nullptr;
|
||||
}
|
||||
if (nullptr != mem_context_ && nullptr != im_sk_rows_) {
|
||||
mem_context_->get_malloc_allocator().free(im_sk_rows_);
|
||||
im_sk_rows_ = nullptr;
|
||||
}
|
||||
if (nullptr != mem_context_ && nullptr != im_addon_rows_) {
|
||||
mem_context_->get_malloc_allocator().free(im_addon_rows_);
|
||||
im_addon_rows_ = nullptr;
|
||||
}
|
||||
ObSortVecOpImpl<Compare, Store_Row, has_addon>::reset();
|
||||
}
|
||||
|
||||
@ -80,10 +90,10 @@ int ObPrefixSortVecImpl<Compare, Store_Row, has_addon>::init(ObSortVecOpContext
|
||||
SQL_ENG_LOG(WARN, "failed to init temp row store", K(ret));
|
||||
} else {
|
||||
selector_ =
|
||||
(typeof(selector_))ctx.exec_ctx_->get_allocator().alloc(batch_size * sizeof(*selector_));
|
||||
im_sk_rows_ = (typeof(im_sk_rows_))ctx.exec_ctx_->get_allocator().alloc(
|
||||
(typeof(selector_))mem_context_->get_malloc_allocator().alloc(batch_size * sizeof(*selector_));
|
||||
im_sk_rows_ = (typeof(im_sk_rows_))mem_context_->get_malloc_allocator().alloc(
|
||||
batch_size * sizeof(*im_sk_rows_));
|
||||
im_addon_rows_ = (typeof(im_addon_rows_))ctx.exec_ctx_->get_allocator().alloc(
|
||||
im_addon_rows_ = (typeof(im_addon_rows_))mem_context_->get_malloc_allocator().alloc(
|
||||
batch_size * sizeof(*im_addon_rows_));
|
||||
if (nullptr == selector_ || nullptr == im_sk_rows_ || nullptr == im_addon_rows_) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
|
||||
@ -2769,10 +2769,16 @@ void ObPrefixSortImpl::reset()
|
||||
selector_size_ = 0;
|
||||
sort_prefix_rows_ = 0;
|
||||
immediate_prefix_store_.reset();
|
||||
immediate_prefix_rows_ = 0;
|
||||
immediate_prefix_pos_ = 0;
|
||||
brs_ = NULL;
|
||||
|
||||
if (nullptr != mem_context_ && nullptr != selector_) {
|
||||
mem_context_->get_malloc_allocator().free(selector_);
|
||||
selector_ = nullptr;
|
||||
}
|
||||
if (nullptr != mem_context_ && nullptr != immediate_prefix_rows_) {
|
||||
mem_context_->get_malloc_allocator().free(immediate_prefix_rows_);
|
||||
immediate_prefix_rows_ = nullptr;
|
||||
}
|
||||
ObSortOpImpl::reset();
|
||||
}
|
||||
|
||||
@ -2833,10 +2839,10 @@ int ObPrefixSortImpl::init(const int64_t tenant_id,
|
||||
LOG_WARN("fetch rows failed");
|
||||
}
|
||||
} else {
|
||||
selector_ = (typeof(selector_))eval_ctx->exec_ctx_.get_allocator().alloc(
|
||||
selector_ = (typeof(selector_))mem_context_->get_malloc_allocator().alloc(
|
||||
batch_size * sizeof(*selector_));
|
||||
immediate_prefix_rows_ = (typeof(immediate_prefix_rows_))
|
||||
eval_ctx->exec_ctx_.get_allocator().alloc(batch_size * sizeof(*immediate_prefix_rows_));
|
||||
mem_context_->get_malloc_allocator().alloc(batch_size * sizeof(*immediate_prefix_rows_));
|
||||
if (NULL == selector_ || NULL == immediate_prefix_rows_) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("allocate memory failed",
|
||||
|
||||
Reference in New Issue
Block a user