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 134b210c03 [improvement](shutdown) not print thread pool error stack trace when shutdown (#24155) 134b210c03 is described below commit 134b210c0346575350e39b603088a33748b5525e Author: yiguolei <676222...@qq.com> AuthorDate: Mon Sep 11 12:20:07 2023 +0800 [improvement](shutdown) not print thread pool error stack trace when shutdown (#24155) * [improvement](shutdown) not print thread pool error stack trace when shutdown when thread pool shutdown, should not print error stack trace, it is very confuse. arrow flight server should not call shutdown, if it is not enabled, because it will print error stack. remove service unavailable from thrift because it is useless. Part of this PR need to pick to 2.0 branch. Co-authored-by: yiguolei <yiguo...@gmail.com> --- be/src/common/status.h | 3 +-- be/src/runtime/stream_load/stream_load_executor.cpp | 2 +- be/src/service/arrow_flight/flight_sql_service.cpp | 5 +++++ be/src/service/arrow_flight/flight_sql_service.h | 1 + be/src/util/threadpool.cpp | 8 +++++--- gensrc/thrift/Status.thrift | 2 +- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/be/src/common/status.h b/be/src/common/status.h index c863f0cc47..ebe8c47c70 100644 --- a/be/src/common/status.h +++ b/be/src/common/status.h @@ -51,7 +51,6 @@ TStatusError(MEM_LIMIT_EXCEEDED); TStatusError(THRIFT_RPC_ERROR); TStatusError(TIMEOUT); TStatusError(TOO_MANY_TASKS); -TStatusError(SERVICE_UNAVAILABLE); TStatusError(UNINITIALIZED); TStatusError(ABORTED); TStatusError(DATA_QUALITY_ERROR); @@ -113,6 +112,7 @@ E(NOT_INITIALIZED, -236); E(ALREADY_CANCELLED, -237); E(TOO_MANY_SEGMENTS, -238); E(ALREADY_CLOSED, -239); +E(SERVICE_UNAVAILABLE, -240); E(CE_CMD_PARAMS_ERROR, -300); E(CE_BUFFER_TOO_SMALL, -301); E(CE_CMD_NOT_VALID, -302); @@ -423,7 +423,6 @@ public: ERROR_CTOR(RpcError, THRIFT_RPC_ERROR) ERROR_CTOR(TimedOut, TIMEOUT) ERROR_CTOR(TooManyTasks, TOO_MANY_TASKS) - ERROR_CTOR(ServiceUnavailable, SERVICE_UNAVAILABLE) ERROR_CTOR(Uninitialized, UNINITIALIZED) ERROR_CTOR(Aborted, ABORTED) ERROR_CTOR(DataQualityError, DATA_QUALITY_ERROR) diff --git a/be/src/runtime/stream_load/stream_load_executor.cpp b/be/src/runtime/stream_load/stream_load_executor.cpp index e1e8e2ff25..1ecba95748 100644 --- a/be/src/runtime/stream_load/stream_load_executor.cpp +++ b/be/src/runtime/stream_load/stream_load_executor.cpp @@ -248,7 +248,7 @@ Status StreamLoadExecutor::begin_txn(StreamLoadContext* ctx) { int64_t duration_ns = 0; TNetworkAddress master_addr = _exec_env->master_info()->network_address; if (master_addr.hostname.empty() || master_addr.port == 0) { - status = Status::ServiceUnavailable("Have not get FE Master heartbeat yet"); + status = Status::Error<SERVICE_UNAVAILABLE>("Have not get FE Master heartbeat yet"); } else { SCOPED_RAW_TIMER(&duration_ns); #ifndef BE_TEST diff --git a/be/src/service/arrow_flight/flight_sql_service.cpp b/be/src/service/arrow_flight/flight_sql_service.cpp index 1bddedc4aa..60add8698a 100644 --- a/be/src/service/arrow_flight/flight_sql_service.cpp +++ b/be/src/service/arrow_flight/flight_sql_service.cpp @@ -102,6 +102,7 @@ Status FlightSqlServer::init(int port) { LOG(INFO) << "Arrow Flight Service not start"; return Status::OK(); } + _inited = true; arrow::flight::Location bind_location; RETURN_DORIS_STATUS_IF_ERROR( arrow::flight::Location::ForGrpcTcp(BackendOptions::get_service_bind_address(), port) @@ -114,6 +115,10 @@ Status FlightSqlServer::init(int port) { } Status FlightSqlServer::join() { + if (!_inited) { + // Flight not inited, not need shutdown + return Status::OK(); + } RETURN_DORIS_STATUS_IF_ERROR(Shutdown()); return Status::OK(); } diff --git a/be/src/service/arrow_flight/flight_sql_service.h b/be/src/service/arrow_flight/flight_sql_service.h index aa170acd1f..4772e98d81 100644 --- a/be/src/service/arrow_flight/flight_sql_service.h +++ b/be/src/service/arrow_flight/flight_sql_service.h @@ -41,6 +41,7 @@ public: private: class Impl; std::shared_ptr<Impl> impl_; + bool _inited = false; explicit FlightSqlServer(std::shared_ptr<Impl> impl); }; diff --git a/be/src/util/threadpool.cpp b/be/src/util/threadpool.cpp index 93c14f4d61..6ac02e5cbd 100644 --- a/be/src/util/threadpool.cpp +++ b/be/src/util/threadpool.cpp @@ -274,7 +274,9 @@ void ThreadPool::shutdown() { // capacity, so clients can't tell them apart. This isn't really a practical // concern though because shutting down a pool typically requires clients to // be quiesced first, so there's no danger of a client getting confused. - _pool_status = Status::ServiceUnavailable("The thread pool {} has been shut down.", _name); + // Not print stack trace here + _pool_status = Status::Error<SERVICE_UNAVAILABLE, false>( + "The thread pool {} has been shut down.", _name); // Clear the various queues under the lock, but defer the releasing // of the tasks outside the lock, in case there are concurrent threads @@ -356,14 +358,14 @@ Status ThreadPool::do_submit(std::shared_ptr<Runnable> r, ThreadPoolToken* token } if (PREDICT_FALSE(!token->may_submit_new_tasks())) { - return Status::ServiceUnavailable("Thread pool({}) token was shut down", _name); + return Status::Error<SERVICE_UNAVAILABLE>("Thread pool({}) token was shut down", _name); } // Size limit check. int64_t capacity_remaining = static_cast<int64_t>(_max_threads) - _active_threads + static_cast<int64_t>(_max_queue_size) - _total_queued_tasks; if (capacity_remaining < 1) { - return Status::ServiceUnavailable( + return Status::Error<SERVICE_UNAVAILABLE>( "Thread pool {} is at capacity ({}/{} tasks running, {}/{} tasks queued)", _name, _num_threads + _num_threads_pending_start, _max_threads, _total_queued_tasks, _max_queue_size); diff --git a/gensrc/thrift/Status.thrift b/gensrc/thrift/Status.thrift index 7b12d3b060..06083b9a93 100644 --- a/gensrc/thrift/Status.thrift +++ b/gensrc/thrift/Status.thrift @@ -69,7 +69,7 @@ enum TStatusCode { NOT_AUTHORIZED = 38, ABORTED = 39, REMOTE_ERROR = 40, - SERVICE_UNAVAILABLE = 41, + //SERVICE_UNAVAILABLE = 41, // Not used any more UNINITIALIZED = 42, CONFIGURATION_ERROR = 43, INCOMPLETE = 44, --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org