[BugFix] fix some problems when be exits gracefully (#12852)

This commit is contained in:
eyes_on_me 2022-11-07 10:29:54 +08:00 committed by GitHub
parent 6c10ce5346
commit 89ec2b66c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 37 additions and 1 deletions

View File

@ -826,6 +826,12 @@ install(FILES
${BASE_DIR}/../conf/log4j.properties
DESTINATION ${OUTPUT_DIR}/conf)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "ASAN" OR "${CMAKE_BUILD_TYPE}" STREQUAL "LSAN")
install(FILES
${BASE_DIR}/../conf/asan_suppressions.conf
DESTINATION ${OUTPUT_DIR}/conf)
endif()
install(DIRECTORY
${BASE_DIR}/../webroot/be/
DESTINATION ${OUTPUT_DIR}/www)

View File

@ -60,6 +60,8 @@ public:
void init_or_die();
void stop();
void submit_tasks(TAgentResult& agent_result, const std::vector<TAgentTaskRequest>& tasks);
void make_snapshot(TAgentResult& agent_result, const TSnapshotRequest& snapshot_request);
@ -212,7 +214,7 @@ void AgentServer::Impl::init_or_die() {
#undef CREATE_AND_START_POOL
}
AgentServer::Impl::~Impl() {
void AgentServer::Impl::stop() {
_thread_pool_publish_version->shutdown();
_thread_pool_drop->shutdown();
_thread_pool_create_tablet->shutdown();
@ -244,6 +246,8 @@ AgentServer::Impl::~Impl() {
#undef STOP_POOL
}
AgentServer::Impl::~Impl() {}
// TODO(lingbin): each task in the batch may have it own status or FE must check and
// resend request when something is wrong(BE may need some logic to guarantee idempotence.
void AgentServer::Impl::submit_tasks(TAgentResult& agent_result, const std::vector<TAgentTaskRequest>& tasks) {
@ -552,4 +556,8 @@ void AgentServer::init_or_die() {
return _impl->init_or_die();
}
void AgentServer::stop() {
return _impl->stop();
}
} // namespace starrocks

View File

@ -46,6 +46,8 @@ public:
void init_or_die();
void stop();
void submit_tasks(TAgentResult& agent_result, const std::vector<TAgentTaskRequest>& tasks);
void make_snapshot(TAgentResult& agent_result, const TSnapshotRequest& snapshot_request);

View File

@ -290,6 +290,9 @@ void* my_malloc(size_t size) __THROW {
// free
void my_free(void* p) __THROW {
if (UNLIKELY(p == nullptr)) {
return;
}
MEMORY_RELEASE_PTR(p);
STARROCKS_FREE(p);
}
@ -352,6 +355,9 @@ void* my_calloc(size_t n, size_t size) __THROW {
}
void my_cfree(void* ptr) __THROW {
if (UNLIKELY(ptr == nullptr)) {
return;
}
MEMORY_RELEASE_PTR(ptr);
STARROCKS_CFREE(ptr);
}

View File

@ -33,6 +33,7 @@
#include <curl/curl.h>
#include <thrift/TOutput.h>
#include "agent/agent_server.h"
#include "agent/heartbeat_server.h"
#include "agent/status.h"
#include "common/config.h"
@ -316,6 +317,7 @@ int main(int argc, char** argv) {
heartbeat_thrift_server->stop();
heartbeat_thrift_server->join();
exec_env->agent_server()->stop();
engine->stop();
delete engine;
starrocks::ExecEnv::destroy(exec_env);

View File

@ -109,6 +109,10 @@ StorageEngine::~StorageEngine() {
if (_s_instance == this) {
_s_instance = _p_instance;
}
#else
if (_s_instance != nullptr) {
_s_instance = nullptr;
}
#endif
}

View File

@ -126,6 +126,7 @@ fi
export JEMALLOC_CONF="percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:5000,dirty_decay_ms:5000,metadata_thp:auto,background_thread:true"
# enable coredump when BE build with ASAN
export ASAN_OPTIONS=abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1
export LSAN_OPTIONS=suppressions=${STARROCKS_HOME}/conf/asan_suppressions.conf
# Prevent JVM from handling any internally or externally generated signals.
# Otherwise, JVM will overwrite the signal handlers for SIGINT and SIGTERM.

View File

@ -358,6 +358,9 @@ if [ ${BUILD_BE} -eq 1 ]; then
cp -r -p ${STARROCKS_HOME}/be/output/conf/cn.conf ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/hadoop_env.sh ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/log4j.properties ${STARROCKS_OUTPUT}/be/conf/
if [ "${BUILD_TYPE}" == "ASAN" ]; then
cp -r -p ${STARROCKS_HOME}/be/output/conf/asan_suppressions.conf ${STARROCKS_OUTPUT}/be/conf/
fi
cp -r -p ${STARROCKS_HOME}/be/output/lib/* ${STARROCKS_OUTPUT}/be/lib/
cp -r -p ${STARROCKS_HOME}/be/output/www/* ${STARROCKS_OUTPUT}/be/www/
cp -r -p ${STARROCKS_HOME}/be/output/udf/*.a ${STARROCKS_OUTPUT}/udf/lib/

View File

@ -0,0 +1,2 @@
# This file is licensed under the Elastic License 2.0. Copyright 2021-present, StarRocks Inc.
leak:brpc

View File

@ -1,3 +1,5 @@
# This file is licensed under the Elastic License 2.0. Copyright 2021-present, StarRocks Inc.
# log configuration for jars called via JNI in BE
# Because there are almost no other logs except jdbc bridge now, so it's enough to only output to stdout.
# If necessary, we can add special log files later