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

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

commit d52a69b999f0d90c499fa39fb922d529fea5795f
Author: zhangstar333 <[email protected]>
AuthorDate: Fri Jun 5 11:54:45 2026 +0800

    be add some graceful logs
---
 be/src/agent/heartbeat_server.cpp                  |  1 +
 be/src/runtime/exec_env.cpp                        |  4 +++
 be/src/service/doris_main.cpp                      |  7 +++++
 be/src/service/internal_service.cpp                | 31 +++++++++++++---------
 .../main/java/org/apache/doris/qe/VariableMgr.java |  2 +-
 5 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/be/src/agent/heartbeat_server.cpp 
b/be/src/agent/heartbeat_server.cpp
index 390f46f0f8d..6b3cdd43e3b 100644
--- a/be/src/agent/heartbeat_server.cpp
+++ b/be/src/agent/heartbeat_server.cpp
@@ -94,6 +94,7 @@ void HeartbeatServer::heartbeat(THeartbeatResult& 
heartbeat_result,
             // FE Master has pulled at least one heartbeat carrying
             // is_shutdown=true. Unblock Phase A in graceful_shutdown.
             doris::k_shutdown_fe_known = true;
+            LOG(INFO) << " The heartbeat with is_shutdown=true has been pulled 
by FE Master.";
         }
         heartbeat_result.backend_info.__set_fragment_executing_count(
                 get_fragment_executing_count());
diff --git a/be/src/runtime/exec_env.cpp b/be/src/runtime/exec_env.cpp
index 5189eac6d55..e1ef845ccc0 100644
--- a/be/src/runtime/exec_env.cpp
+++ b/be/src/runtime/exec_env.cpp
@@ -199,6 +199,8 @@ void ExecEnv::wait_for_all_fe_known() {
 }
 
 void ExecEnv::wait_for_all_tasks_done() {
+    LOG(INFO) << "begin to wait for all tasks done before shutdown. 
k_shutdown_fe_known: "
+              << k_shutdown_fe_known << " k_in_graceful_shutdown: " << 
k_in_graceful_shutdown;
     // For graceful shutdown, need to wait for all running queries to stop
     int32_t wait_seconds_passed = 0;
     while (true) {
@@ -221,6 +223,8 @@ void ExecEnv::wait_for_all_tasks_done() {
     // If the current BE is shut down at this point,
     // the FE will detect the downtime of a related BE and cancel the entire 
query,
     // defeating the purpose of a graceful stop.
+    LOG(INFO) << "after wait all tasks done and sleep. k_shutdown_fe_known: " 
<< k_shutdown_fe_known
+              << " k_in_graceful_shutdown: " << k_in_graceful_shutdown;
     sleep(config::grace_shutdown_post_delay_seconds);
 }
 
diff --git a/be/src/service/doris_main.cpp b/be/src/service/doris_main.cpp
index abd30278565..8b789ec2877 100644
--- a/be/src/service/doris_main.cpp
+++ b/be/src/service/doris_main.cpp
@@ -723,6 +723,9 @@ int main(int argc, char** argv) {
     if (!doris::config::enable_graceful_exit_check) {
         // If not in memleak check mode, no need to wait all objects 
de-constructed normally, just exit.
         // It will make sure that graceful shutdown can be done definitely.
+        LOG(INFO) << "exiting immediately. k_doris_exit : " << 
doris::k_doris_exit
+                  << "k_shutdown_fe_known: " << doris::k_shutdown_fe_known
+                  << " k_in_graceful_shutdown: " << 
doris::k_in_graceful_shutdown;
         LOG(INFO) << "Doris main exited.";
         google::FlushLogFiles(google::GLOG_INFO);
         _exit(0); // Do not call exit(0), it will wait for all objects 
de-constructed normally
@@ -748,6 +751,10 @@ int main(int argc, char** argv) {
     service.reset();
     LOG(INFO) << "Backend Service stopped";
     exec_env->destroy();
+    doris::ThreadLocalHandle::del_thread_local_if_count_is_zero();
+    LOG(INFO) << "stop all will exiting immediately. k_doris_exit : " << 
doris::k_doris_exit
+              << " k_shutdown_fe_known: " << doris::k_shutdown_fe_known
+              << " k_in_graceful_shutdown: " << doris::k_in_graceful_shutdown;
     LOG(INFO) << "All service stopped, doris main exited.";
     return 0;
 }
diff --git a/be/src/service/internal_service.cpp 
b/be/src/service/internal_service.cpp
index c6ed81e8616..e45c11ffd76 100644
--- a/be/src/service/internal_service.cpp
+++ b/be/src/service/internal_service.cpp
@@ -356,7 +356,10 @@ void 
PInternalService::exec_plan_fragment(google::protobuf::RpcController* contr
     gettimeofday(&tv, nullptr);
     response->set_received_time(tv.tv_sec * 1000LL + tv.tv_usec / 1000);
     if (k_doris_exit) {
-        LOG(WARNING) << "BE is shutting down but still received 
exec_plan_fragment request.";
+        LOG(WARNING) << "BE is shutting down but still received 
exec_plan_fragment request.  "
+                        "k_shutdown_fe_known: "
+                     << k_shutdown_fe_known
+                     << ", k_in_graceful_shutdown: " << k_in_graceful_shutdown;
     }
     bool ret = _light_work_pool.try_offer([this, controller, request, 
response, done]() {
         _exec_plan_fragment_in_pthread(controller, request, response, done);
@@ -407,7 +410,9 @@ void 
PInternalService::exec_plan_fragment_prepare(google::protobuf::RpcControlle
     response->set_received_time(tv.tv_sec * 1000LL + tv.tv_usec / 1000);
     if (k_doris_exit) {
         LOG(WARNING) << "BE is shutting down but still received 
exec_plan_fragment_prepare "
-                        "request.";
+                        "request. k_shutdown_fe_known: "
+                     << k_shutdown_fe_known
+                     << ", k_in_graceful_shutdown: " << k_in_graceful_shutdown;
     }
     bool ret = _light_work_pool.try_offer([this, controller, request, 
response, done]() {
         _exec_plan_fragment_in_pthread(controller, request, response, done);
@@ -1825,17 +1830,17 @@ void 
PInternalService::transmit_block(google::protobuf::RpcController* controlle
         // pool here.
         _transmit_block(controller, request, response, done, Status::OK(), 0);
     } else {
-        bool ret = _light_work_pool.try_offer([this, controller, request, 
response, done,
-                                               receive_time]() {
-            response->set_receive_time(receive_time);
-            // Sometimes transmit block function is the last owner of 
PlanFragmentExecutor
-            // It will release the object. And the object maybe a JNIContext.
-            // JNIContext will hold some TLS object. It could not work 
correctly under bthread
-            // Context. So that put the logic into pthread.
-            // But this is rarely happens, so this config is disabled by 
default.
-            _transmit_block(controller, request, response, done, Status::OK(),
-                            GetCurrentTimeNanos() - receive_time);
-        });
+        bool ret = _light_work_pool.try_offer(
+                [this, controller, request, response, done, receive_time]() {
+                    response->set_receive_time(receive_time);
+                    // Sometimes transmit block function is the last owner of 
PlanFragmentExecutor
+                    // It will release the object. And the object maybe a 
JNIContext.
+                    // JNIContext will hold some TLS object. It could not work 
correctly under bthread
+                    // Context. So that put the logic into pthread.
+                    // But this is rarely happens, so this config is disabled 
by default.
+                    _transmit_block(controller, request, response, done, 
Status::OK(),
+                                    GetCurrentTimeNanos() - receive_time);
+                });
         if (!ret) {
             offer_failed(response, done, _light_work_pool);
             return;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
index 768de26cb9d..0e2339a1b3a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
@@ -105,7 +105,7 @@ import javax.annotation.Nullable;
 public class VariableMgr {
     private static final Logger LOG = LogManager.getLogger(VariableMgr.class);
     private static final String HEARTBEAT_INTERVAL_SECOND = 
"heartbeat_interval_second";
-    private static final String FAST_HEARTBEAT_INTERVAL_SECONDS = "1";
+    private static final String FAST_HEARTBEAT_INTERVAL_SECONDS = "3";
     private static final String DEFAULT_HEARTBEAT_INTERVAL_SECONDS = "10";
 
     // Map variable name to variable context which have enough information to 
change variable value.


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

Reply via email to