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

Bug 1748478: Add more states to init probe #1786

Merged
merged 1 commit into from
Nov 14, 2019
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
2 changes: 2 additions & 0 deletions elasticsearch/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ source "logging"
wait_for_port_open
failed=0

touch ${HOME}/init_running
pushd "${ES_HOME}/init"
files=$(ls --hide common | sort)
for init_file in ${files}; do
Expand All @@ -29,6 +30,7 @@ pushd "${ES_HOME}/init"
done
popd

rm -f ${HOME}/init_running
if [ $failed -eq 0 ]; then
touch ${HOME}/init_complete
fi
15 changes: 14 additions & 1 deletion elasticsearch/probe/readiness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,22 @@ function check_if_ready() {
fi
}

function check_for_init_running() {
test -f ${HOME}/init_running
}

function check_for_init_complete() {
test -f ${HOME}/init_complete
}

function show_failures() {
if [ -f ${HOME}/init_failures ]; then
cat ${HOME}/init_failures
else
# this should never happen"
echo "Elasticsearch node is in unknown state"
fi
}

check_if_ready "/" "Elasticsearch node is not ready to accept HTTP requests yet"
check_for_init_complete || cat ${HOME}/init_failures
check_for_init_complete || ( check_for_init_running && echo "Elasticsearch node is initializing" ) || show_failures