Fix bug: PrefixSort did not expand the memory capacity during the add batch

This commit is contained in:
GongYusen
2024-04-19 07:15:56 +00:00
committed by ob-robot
parent bf604885f8
commit 2c0c080499

View File

@ -393,7 +393,10 @@ int ObSortVecOpImpl<Compare, Store_Row, has_addon>::add_batch(const ObBatchRows
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(use_heap_sort_ && need_dump())) {
if (OB_FAIL(do_dump())) {
bool dumped = false;
if (OB_FAIL(preprocess_dump(dumped))) {
SQL_ENG_LOG(WARN, "failed preprocess dump", K(ret));
} else if (dumped && OB_FAIL(do_dump())) {
SQL_ENG_LOG(WARN, "failed to do topn dump", K(ret));
}
}
@ -1156,6 +1159,11 @@ int ObSortVecOpImpl<Compare, Store_Row, has_addon>::preprocess_dump(bool &dumped
K(profile_.get_expect_size()), K(sql_mem_processor_.get_data_size()));
}
}
if (OB_SUCC(ret) && dumped && OB_NOT_NULL(rows_) && rows_->empty()) {
dumped = false; //no data to dump, try to add a batch of data directly
LOG_TRACE("Insufficient memory, unable to store a batch of data", K(mem_context_->used()), K(get_memory_limit()),
K(profile_.get_cache_size()), K(profile_.get_expect_size()));
}
return ret;
}