This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new d625710599 [improvement](shutdown) not print thread pool error stack
trace when shutdown (#24155)
d625710599 is described below
commit d6257105990594cd42d059a1019a637a08b8135c
Author: yiguolei <[email protected]>
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 <[email protected]>
---
be/src/common/status.h | 3 +--
be/src/runtime/stream_load/stream_load_executor.cpp | 2 +-
be/src/util/threadpool.cpp | 8 +++++---
gensrc/thrift/Status.thrift | 2 +-
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/be/src/common/status.h b/be/src/common/status.h
index 2b6b639b04..1d73bee2d1 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);
@@ -116,6 +115,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);
@@ -412,7 +412,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/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: [email protected]
For additional commands, e-mail: [email protected]