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

morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 8c1c25b3dc6 [bugfix](be) should set is inited = true only when init 
successfully and not update counters if init == false (#54927)
8c1c25b3dc6 is described below

commit 8c1c25b3dc6105bf2475035758a025a1906242ce
Author: yiguolei <[email protected]>
AuthorDate: Tue Aug 19 09:56:57 2025 +0800

    [bugfix](be) should set is inited = true only when init successfully and 
not update counters if init == false (#54927)
    
    ### What problem does this PR solve?
    
    If init = false, some variables is not inited, for example, the
    _tablet_reader is not inited. And when update counters, it will core.
    This problem only exist in master and 3.1.
    And in master branch, I refactor these code because the init flag is
    modified very confused.
---
 be/src/vec/exec/scan/new_olap_scanner.cpp  | 2 +-
 be/src/vec/exec/scan/scanner_scheduler.cpp | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/exec/scan/new_olap_scanner.cpp 
b/be/src/vec/exec/scan/new_olap_scanner.cpp
index 19dcf5d1976..707defa1690 100644
--- a/be/src/vec/exec/scan/new_olap_scanner.cpp
+++ b/be/src/vec/exec/scan/new_olap_scanner.cpp
@@ -127,7 +127,6 @@ static std::string read_columns_to_string(TabletSchemaSPtr 
tablet_schema,
 }
 
 Status NewOlapScanner::init() {
-    _is_init = true;
     auto* local_state = 
static_cast<pipeline::OlapScanLocalState*>(_local_state);
     auto& tablet = _tablet_reader_params.tablet;
     auto& tablet_schema = _tablet_reader_params.tablet_schema;
@@ -237,6 +236,7 @@ Status NewOlapScanner::init() {
         SchemaCache::instance()->insert_schema(schema_key, tablet_schema);
     }
 
+    _is_init = true;
     return Status::OK();
 }
 
diff --git a/be/src/vec/exec/scan/scanner_scheduler.cpp 
b/be/src/vec/exec/scan/scanner_scheduler.cpp
index aed708442ae..db767cf9228 100644
--- a/be/src/vec/exec/scan/scanner_scheduler.cpp
+++ b/be/src/vec/exec/scan/scanner_scheduler.cpp
@@ -315,8 +315,10 @@ void 
ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
     }
     // WorkloadGroup Policy will check cputime realtime, so that should update 
the counter
     // as soon as possible, could not update it on close.
-    scanner->update_scan_cpu_timer();
-    scanner->update_realtime_counters();
+    if (scanner->is_init()) {
+        scanner->update_scan_cpu_timer();
+        scanner->update_realtime_counters();
+    }
 
     if (eos) {
         scanner->mark_to_need_to_close();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to