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 9461e86b10c [pipelineX](debug) add debug string (#28137)
9461e86b10c is described below

commit 9461e86b10c98ea9914198a2f343b73072fc38e6
Author: Gabriel <gabrielleeb...@gmail.com>
AuthorDate: Thu Dec 7 23:21:10 2023 +0800

    [pipelineX](debug) add debug string (#28137)
    
    * [pipelineX](debug) add debug string
    
    * update
---
 be/src/pipeline/exec/scan_operator.cpp | 20 ++++++++++++++++++++
 be/src/pipeline/exec/scan_operator.h   |  5 +++--
 be/src/vec/exec/scan/scanner_context.h |  4 ++++
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/be/src/pipeline/exec/scan_operator.cpp 
b/be/src/pipeline/exec/scan_operator.cpp
index 25afa697107..96bda3cd0be 100644
--- a/be/src/pipeline/exec/scan_operator.cpp
+++ b/be/src/pipeline/exec/scan_operator.cpp
@@ -554,6 +554,26 @@ bool ScanLocalState<Derived>::_is_predicate_acting_on_slot(
     return true;
 }
 
+template <typename Derived>
+std::string ScanLocalState<Derived>::debug_string(int indentation_level) const 
{
+    fmt::memory_buffer debug_string_buffer;
+    fmt::format_to(debug_string_buffer, "{}, _eos = {}",
+                   PipelineXLocalState<>::debug_string(indentation_level), 
_eos.load());
+    if (_scanner_ctx) {
+        fmt::format_to(debug_string_buffer, "");
+        fmt::format_to(debug_string_buffer,
+                       ", Scanner Context: (_is_finished = {}, _should_stop = 
{}, "
+                       "_num_running_scanners={}, "
+                       "_num_scheduling_ctx = {}, _num_unfinished_scanners = 
{})",
+                       _scanner_ctx->is_finished(), 
_scanner_ctx->should_stop(),
+                       _scanner_ctx->get_num_running_scanners(),
+                       _scanner_ctx->get_num_scheduling_ctx(),
+                       _scanner_ctx->get_num_unfinished_scanners());
+    }
+
+    return fmt::to_string(debug_string_buffer);
+}
+
 template <typename Derived>
 bool ScanLocalState<Derived>::_ignore_cast(SlotDescriptor* slot, 
vectorized::VExpr* expr) {
     if (slot->type().is_string_type() && expr->type().is_string_type()) {
diff --git a/be/src/pipeline/exec/scan_operator.h 
b/be/src/pipeline/exec/scan_operator.h
index d7dd83a2e58..18b5cebd6c1 100644
--- a/be/src/pipeline/exec/scan_operator.h
+++ b/be/src/pipeline/exec/scan_operator.h
@@ -187,6 +187,7 @@ class ScanLocalState : public ScanLocalStateBase {
     Status init(RuntimeState* state, LocalStateInfo& info) override;
     Status open(RuntimeState* state) override;
     Status close(RuntimeState* state) override;
+    std::string debug_string(int indentation_level) const override;
 
     bool ready_to_read() override;
 
@@ -362,7 +363,7 @@ protected:
     vectorized::VExprContextSPtrs _stale_expr_ctxs;
     vectorized::VExprContextSPtrs _common_expr_ctxs_push_down;
 
-    std::shared_ptr<vectorized::ScannerContext> _scanner_ctx;
+    std::shared_ptr<vectorized::ScannerContext> _scanner_ctx = nullptr;
 
     vectorized::FilterPredicates _filter_predicates {};
 
@@ -404,7 +405,7 @@ protected:
     // "_colname_to_value_range" and in "_not_in_value_ranges"
     std::vector<ColumnValueRangeType> _not_in_value_ranges;
 
-    bool _eos = false;
+    std::atomic<bool> _eos = false;
 
     std::mutex _block_lock;
 };
diff --git a/be/src/vec/exec/scan/scanner_context.h 
b/be/src/vec/exec/scan/scanner_context.h
index 6afe03d5353..c6e88567502 100644
--- a/be/src/vec/exec/scan/scanner_context.h
+++ b/be/src/vec/exec/scan/scanner_context.h
@@ -116,6 +116,8 @@ public:
 
     // Return true if this ScannerContext need no more process
     virtual bool done() { return _is_finished || _should_stop; }
+    bool is_finished() { return _is_finished.load(); }
+    bool should_stop() { return _should_stop.load(); }
 
     void inc_num_running_scanners(int32_t scanner_inc);
 
@@ -123,6 +125,8 @@ public:
 
     int get_num_running_scanners() const { return _num_running_scanners; }
 
+    int get_num_unfinished_scanners() const { return _num_unfinished_scanners; 
}
+
     void dec_num_scheduling_ctx();
 
     int get_num_scheduling_ctx() const { return _num_scheduling_ctx; }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to