@@ -11,9 +11,14 @@ NAMESPACE=$(cat ${SERVICEACCOUNT}/namespace)
1111TOKEN=$( cat ${SERVICEACCOUNT} /token)
1212CACERT=${SERVICEACCOUNT} /ca.crt
1313
14- # Retry config
15- RETRIES=6
16- WAIT=1
14+ # OSPRH-17604: use default timeout and retry parameters for fast failover
15+ # default parameters for curl calls to the API server
16+ : ${WSREP_NOTIFY_CURL_CONNECT_TIMEOUT:= 5}
17+ : ${WSREP_NOTIFY_CURL_MAX_TIME:= 30}
18+ CURL=" curl --connect-timeout ${WSREP_NOTIFY_CURL_CONNECT_TIMEOUT} --max-time ${WSREP_NOTIFY_CURL_MAX_TIME} "
19+ # defaults parameters for retry on error
20+ : ${WSREP_NOTIFY_RETRIES:= 30}
21+ : ${WSREP_NOTIFY_RETRY_WAIT:= 1}
1722
1823
1924# #
@@ -66,7 +71,7 @@ function api_server {
6671 request=" $request -d @-"
6772 fi
6873 local output
69- output=$( curl -s --cacert ${CACERT} --header " Content-Type:application/json" --header " Authorization: Bearer ${TOKEN} " --request $request ${APISERVER} /api/v1/namespaces/${NAMESPACE} /services/${service} )
74+ output=$( ${CURL} -s --cacert ${CACERT} --header " Content-Type:application/json" --header " Authorization: Bearer ${TOKEN} " --request $request ${APISERVER} /api/v1/namespaces/${NAMESPACE} /services/${service} )
7075
7176 local rc=$?
7277 if [ $rc != 0 ]; then
@@ -109,8 +114,8 @@ function parse_output {
109114# Generic retry logic for an action function
110115function retry {
111116 local action=$1
112- local retries=$RETRIES
113- local wait=$WAIT
117+ local retries=$WSREP_NOTIFY_RETRIES
118+ local wait=$WSREP_NOTIFY_RETRY_WAIT
114119 local rc=1
115120
116121 $action
@@ -132,7 +137,7 @@ function retry {
132137 mysql_probe_state reprobe
133138 done
134139 if [ $rc -ne 0 ]; then
135- log_error " Could not run action after ${RETRIES } tries. Stop retrying."
140+ log_error " Could not run action after ${WSREP_NOTIFY_RETRIES } tries. Stop retrying."
136141 fi
137142 return $rc
138143}
0 commit comments