Skip to content

Commit

Permalink
Gracefully exit mysqld_safe loop during backoff
Browse files Browse the repository at this point in the history
Summary:
Currentt systemctl stop [email protected] can take 10 mins when mysqld_safe is in backoff period.

D28517599 adds a interrupt to sleep in mysql_stop, and mysqld_safe immediately break the retry loop if sleep is interruptted.

Reviewed By: anirbanr-fb

Differential Revision: D28606439
  • Loading branch information
li-chi authored and inikep committed May 17, 2023
1 parent 92f572c commit e24557c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/mysqld_safe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1065,10 +1065,20 @@ do
then
log_notice "Throttling restart after 10 restarts: Sleep 1 day"
sleep 86400
if [ $? = 137 ];
then
log_notice "Sleep was likely interrupted from outside. Will exit loop"
break
fi
else
sleep_time=$((1<<${cur_retry_times}))
log_notice "Throttling restart after $cur_retry_times restarts: Sleep $sleep_time seconds"
sleep $sleep_time
if [ $? = 137 ];
then
log_notice "Sleep was likely interrupted from outside. Will exit loop"
break
fi
fi

# Note: the following code is not needed after exponential backoff
Expand Down

0 comments on commit e24557c

Please sign in to comment.