Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore](bash) optimize output information when doris_cloud startup #45883

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
31 changes: 21 additions & 10 deletions cloud/script/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ fi
RUN_DAEMON=0
RUN_VERSION=0
RUN_CONSOLE=0
RUN_METASERVICE=0
RUN_RECYCLYER=0
for arg; do
shift
[[ "${arg}" = "--daemonized" ]] && RUN_DAEMON=1 && continue
[[ "${arg}" = "-daemonized" ]] && RUN_DAEMON=1 && continue
[[ "${arg}" = "--daemon" ]] && RUN_DAEMON=1 && continue
[[ "${arg}" = "--version" ]] && RUN_VERSION=1 && continue
[[ "${arg}" = "--console" ]] && RUN_CONSOLE=1 && continue
[[ "${arg}" = "--meta-service" ]] && RUN_METASERVICE=1 && continue
[[ "${arg}" = "--recycler" ]] && RUN_RECYCLYER=1 && continue
set -- "$@" "${arg}"
done
# echo "$@" "daemonized=${daemonized}"}
Expand All @@ -60,13 +64,23 @@ while read -r line; do
fi
done <"${DORIS_HOME}/conf/doris_cloud.conf"

role=''
if [[ ${RUN_METASERVICE} -eq 0 ]] && [[ ${RUN_RECYCLYER} -eq 0 ]]; then
role='MetaService and Recycler'
elif [[ ${RUN_METASERVICE} -eq 1 ]] && [[ ${RUN_RECYCLYER} -eq 0 ]]; then
role='MetaService'
elif [[ ${RUN_METASERVICE} -eq 0 ]] && [[ ${RUN_RECYCLYER} -eq 1 ]]; then
role='Recycler'
elif [[ ${RUN_METASERVICE} -eq 1 ]] && [[ ${RUN_RECYCLYER} -eq 1 ]]; then
role='MetaService and Recycler'
fi
process=doris_cloud

if [[ ${RUN_VERSION} -eq 0 ]] && [[ -f "${DORIS_HOME}/bin/${process}.pid" ]]; then
pid=$(cat "${DORIS_HOME}/bin/${process}.pid")
if [[ "${pid}" != "" ]]; then
if kill -0 "$(cat "${DORIS_HOME}/bin/${process}.pid")" >/dev/null 2>&1; then
echo "pid file existed, ${process} have already started, pid=${pid}"
echo "pid file existed, ${role} have already started, pid=${pid}"
exit 1
fi
fi
Expand Down Expand Up @@ -113,7 +127,7 @@ if [[ -f "${DORIS_HOME}/conf/hdfs-site.xml" ]]; then
export LIBHDFS3_CONF="${DORIS_HOME}/conf/hdfs-site.xml"
fi

echo "LIBHDFS3_CONF=${LIBHDFS3_CONF}"
# echo "LIBHDFS3_CONF=${LIBHDFS3_CONF}"

# to enable dump jeprof heap stats prodigally, change `prof_active:false` to `prof_active:true` or curl http://be_host:be_webport/jeheap/prof/true
# to control the dump interval change `lg_prof_interval` to a specific value, it is pow/exponent of 2 in size of bytes, default 34 means 2 ** 34 = 16GB
Expand All @@ -126,22 +140,19 @@ if [[ "${RUN_VERSION}" -ne 0 ]]; then
fi

mkdir -p "${DORIS_HOME}/log"
echo "starts ${process} with args: $*"
out_file=${DORIS_HOME}/log/${process}.out
printf "\n\n\n\n\n\n\n\n\n\n" >>"${out_file}"
echo "$(date +'%F %T') start with args: $*" >>"${out_file}"
if [[ "${RUN_DAEMON}" -eq 1 ]]; then
# append 10 blank lines to ensure the following tail -n10 works correctly
printf "\n\n\n\n\n\n\n\n\n\n" >>"${out_file}"
echo "$(date +'%F %T') try to start ${process}" >>"${out_file}"
nohup "${bin}" "$@" >>"${out_file}" 2>&1 &
echo "wait and check ${process} start successfully"
echo "wait and check ${role} start successfully" >>"${out_file}"
sleep 3
tail -n10 "${out_file}" | grep 'successfully started brpc'
ret=$?
if [[ ${ret} -ne 0 ]]; then
echo "${process} may not start successfully please check process log for more details"
echo "${role} may not start successfully please check process log for more details"
exit 1
fi
echo "${process} start successfully"
tail -n12 "${out_file}"
exit 0
elif [[ "${RUN_CONSOLE}" -eq 1 ]]; then
export DORIS_LOG_TO_STDERR=1
Expand Down
10 changes: 5 additions & 5 deletions cloud/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ int main(int argc, char** argv) {

// We can invoke glog from now on
std::string msg;
LOG(INFO) << "try to start doris_cloud";
LOG(INFO) << "try to start " << process_name;
LOG(INFO) << build_info();
std::cout << build_info() << std::endl;

Expand All @@ -223,7 +223,7 @@ int main(int argc, char** argv) {
std::get<0>(args.args()[ARG_RECYCLER]) = true;
LOG(INFO) << "meta_service and recycler are both not specified, "
"run doris_cloud as meta_service and recycler by default";
std::cout << "run doris_cloud as meta_service and recycler by default" << std::endl;
std::cout << "try to start meta_service, recycler" << std::endl;
}

brpc::Server server;
Expand Down Expand Up @@ -275,7 +275,7 @@ int main(int argc, char** argv) {
std::cerr << msg << std::endl;
return ret;
}
msg = "meta-service started";
msg = "MetaService has been started successfully";
LOG(INFO) << msg;
std::cout << msg << std::endl;
}
Expand All @@ -288,7 +288,7 @@ int main(int argc, char** argv) {
std::cerr << msg << std::endl;
return ret;
}
msg = "recycler started";
msg = "Recycler has been started successfully";
LOG(INFO) << msg;
std::cout << msg << std::endl;
auto periodiccally_log = [&]() {
Expand Down Expand Up @@ -317,7 +317,7 @@ int main(int argc, char** argv) {
return -1;
}
end = steady_clock::now();
msg = "successfully started brpc listening on port=" + std::to_string(port) +
msg = "successfully started service listening on port=" + std::to_string(port) +
" time_elapsed_ms=" + std::to_string(duration_cast<milliseconds>(end - start).count());
LOG(INFO) << msg;
std::cout << msg << std::endl;
Expand Down
Loading