Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions be/src/common/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ static void init_doris_metrics(const std::vector<StorePath>& store_paths) {
void signal_handler(int signal) {
if (signal == SIGINT || signal == SIGTERM) {
k_doris_exit = true;
k_doris_start = false;
LOG(INFO) << "doris start to exit";
}
}
Expand Down
1 change: 1 addition & 0 deletions be/src/common/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace doris {

struct StorePath;
inline bool k_doris_exit = false;
inline bool k_doris_start = false;

class Daemon {
public:
Expand Down
9 changes: 5 additions & 4 deletions be/src/runtime/thread_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class MemTracker;
class RuntimeState;

extern bool k_doris_exit;
extern bool k_doris_start;
extern bthread_key_t btls_key;

// Using gcc11 compiles thread_local variable on lower versions of GLIBC will report an error,
Expand Down Expand Up @@ -388,17 +389,17 @@ class AddThreadMemTrackerConsumer {
// which is different from the previous behavior.
#define CONSUME_MEM_TRACKER(size) \
do { \
if (doris::thread_context_ptr.init) { \
if (doris::k_doris_start && doris::thread_context_ptr.init) { \
doris::thread_context()->consume_memory(size); \
} else if (doris::ExecEnv::GetInstance()->initialized()) { \
} else if (doris::k_doris_start && doris::ExecEnv::GetInstance()->initialized()) { \
doris::ExecEnv::GetInstance()->orphan_mem_tracker_raw()->consume_no_update_peak(size); \
} \
} while (0)
#define RELEASE_MEM_TRACKER(size) \
do { \
if (doris::thread_context_ptr.init) { \
if (doris::k_doris_start && doris::thread_context_ptr.init) { \
doris::thread_context()->consume_memory(-size); \
} else if (doris::ExecEnv::GetInstance()->initialized()) { \
} else if (doris::k_doris_start && doris::ExecEnv::GetInstance()->initialized()) { \
doris::ExecEnv::GetInstance()->orphan_mem_tracker_raw()->consume_no_update_peak( \
-size); \
} \
Expand Down
2 changes: 2 additions & 0 deletions be/src/service/doris_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ int __llvm_profile_write_file();

namespace doris {
extern bool k_doris_exit;
extern bool k_doris_start;
Comment thread
xinyiZzz marked this conversation as resolved.

static void thrift_output(const char* x) {
LOG(WARNING) << "thrift internal message: " << x;
Expand Down Expand Up @@ -463,6 +464,7 @@ int main(int argc, char** argv) {

// init exec env
auto exec_env = doris::ExecEnv::GetInstance();
doris::k_doris_start = true;
doris::ExecEnv::init(exec_env, paths);
doris::TabletSchemaCache::create_global_schema_cache();

Expand Down