This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 433a6103ab [Enhancement](scanner) allocate blocks in scanner_context 
on demand and free them on close (#23182)
433a6103ab is described below

commit 433a6103ab4557c1d95826e941404690ab71d8c8
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 17bfbde79d..a08c81ad5e 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 202a15e426..6e86286b15 100644
--- a/be/src/vec/exec/scan/scanner_context.h
+++ b/be/src/vec/exec/scan/scanner_context.h
@@ -167,8 +167,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]

Reply via email to