[Improvement](schema-change) Reserve some memory for use by other parts except hold block of schem… (#27800)

Reserve some memory for use by other parts except hold block of schema change job
This commit is contained in:
Pxl
2023-11-30 17:01:51 +08:00
committed by GitHub
parent f573918aa4
commit 96f2ef3d99

View File

@ -555,7 +555,11 @@ Status VSchemaChangeWithSorting::_inner_process(RowsetReaderSharedPtr rowset_rea
}
RETURN_IF_ERROR(_changer.change_block(ref_block.get(), new_block.get()));
if (_mem_tracker->consumption() + new_block->allocated_bytes() > _memory_limitation) {
constexpr double HOLD_BLOCK_MEMORY_RATE =
0.66; // Reserve some memory for use by other parts of this job
if (_mem_tracker->consumption() + new_block->allocated_bytes() > _memory_limitation ||
_mem_tracker->consumption() > _memory_limitation * HOLD_BLOCK_MEMORY_RATE) {
RETURN_IF_ERROR(create_rowset());
if (_mem_tracker->consumption() + new_block->allocated_bytes() > _memory_limitation) {