This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 3fe0d614866a3b131391fd01751a742c0622825a Author: HappenLee <[email protected]> AuthorDate: Sat Aug 19 12:13:24 2023 +0800 [Enhancement](scanner) allocate blocks in scanner_context on demand and free them on close (#23182) Introduced #19389 , removed #20785 --- be/src/vec/exec/scan/scanner_context.cpp | 16 ---------------- be/src/vec/exec/scan/scanner_context.h | 2 -- 2 files changed, 18 deletions(-) diff --git a/be/src/vec/exec/scan/scanner_context.cpp b/be/src/vec/exec/scan/scanner_context.cpp index bd72ece043..1c1cde4647 100644 --- a/be/src/vec/exec/scan/scanner_context.cpp +++ b/be/src/vec/exec/scan/scanner_context.cpp @@ -104,9 +104,6 @@ Status ScannerContext::init() { limit == -1 ? _batch_size : std::min(static_cast<int64_t>(_batch_size), limit); _block_per_scanner = (doris_scanner_row_num + (real_block_size - 1)) / real_block_size; _free_blocks_capacity = _max_thread_num * _block_per_scanner; - auto pre_alloc_block_count = _max_thread_num * _block_per_scanner; - - _init_free_block(pre_alloc_block_count, real_block_size); #ifndef BE_TEST // 3. get thread token @@ -126,19 +123,6 @@ Status ScannerContext::init() { return Status::OK(); } -void ScannerContext::_init_free_block(int pre_alloc_block_count, int real_block_size) { - // The free blocks is used for final output block of scanners. - // So use _output_tuple_desc; - int64_t free_blocks_memory_usage = 0; - for (int i = 0; i < pre_alloc_block_count; ++i) { - auto block = vectorized::Block::create_unique(_output_tuple_desc->slots(), real_block_size, - true /*ignore invalid slots*/); - free_blocks_memory_usage += block->allocated_bytes(); - _free_blocks.enqueue(std::move(block)); - } - _free_blocks_memory_usage->add(free_blocks_memory_usage); -} - vectorized::BlockUPtr ScannerContext::get_free_block(bool* has_free_block, bool get_block_not_empty) { vectorized::BlockUPtr block; diff --git a/be/src/vec/exec/scan/scanner_context.h b/be/src/vec/exec/scan/scanner_context.h index f86a971d39..a87ef5c603 100644 --- a/be/src/vec/exec/scan/scanner_context.h +++ b/be/src/vec/exec/scan/scanner_context.h @@ -162,8 +162,6 @@ private: protected: virtual void _dispose_coloate_blocks_not_in_queue() {} - void _init_free_block(int pre_alloc_block_count, int real_block_size); - RuntimeState* _state; VScanNode* _parent; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
