|
|
67dbe7 |
From ec9fd4e526e572fe9bc0070186fa584b032eac22 Mon Sep 17 00:00:00 2001
|
|
|
67dbe7 |
From: AngelaBriel <abriel@suse.com>
|
|
|
67dbe7 |
Date: Fri, 5 Mar 2021 19:18:02 +0100
|
|
|
67dbe7 |
Subject: [PATCH] during the function 'check_for_primary' sometimes the command
|
|
|
67dbe7 |
'hdbnsutil' does not work, but timed out. As a fallback we use
|
|
|
67dbe7 |
'getParameter.py' to get some parameter values from the global.ini file. In
|
|
|
67dbe7 |
the past the use of the variable 'mode' was sufficient, but now we more often
|
|
|
67dbe7 |
see the problem, that this variable does not contain the current mode of the
|
|
|
67dbe7 |
node. So we will switch to the variable 'actual_mode', which will be more
|
|
|
67dbe7 |
reliable updated by the SAP software and will (hopefully) provide us with the
|
|
|
67dbe7 |
current mode of the node in times, where 'hdbnsutil' refuse to answer. This
|
|
|
67dbe7 |
change will help to avoid the irritating and confusing message 'secondary has
|
|
|
67dbe7 |
unexpected sync status PRIM ==> RESCORE' on a primary node as seen in
|
|
|
67dbe7 |
bsc#1181765
|
|
|
67dbe7 |
|
|
|
67dbe7 |
---
|
|
|
67dbe7 |
heartbeat/SAPHana | 20 ++++++++++++++------
|
|
|
67dbe7 |
1 file changed, 14 insertions(+), 6 deletions(-)
|
|
|
67dbe7 |
|
|
|
67dbe7 |
diff --git a/heartbeat/SAPHana b/heartbeat/SAPHana
|
|
|
67dbe7 |
index 64e61e8..cd91ddf 100755
|
|
|
67dbe7 |
--- a/heartbeat/SAPHana
|
|
|
67dbe7 |
+++ b/heartbeat/SAPHana
|
|
|
67dbe7 |
@@ -1054,21 +1054,29 @@ function check_for_primary() {
|
|
|
67dbe7 |
super_ocf_log info "FLOW $FUNCNAME ($*)"
|
|
|
67dbe7 |
local rc=$HANA_STATE_DEFECT
|
|
|
67dbe7 |
# TODO: PRIO 3: Check beginning from which SPS does SAP support HDBSettings.sh?
|
|
|
67dbe7 |
- # TODO: Limit the runtime of hdbnsutil and use getParameter.py as fallback
|
|
|
67dbe7 |
- # TODO: PRIO2: Maybe we need to use a fallback interface when hdbnsutil does not answer properly -> lookup in config files?
|
|
|
67dbe7 |
- # This might also solve some problems when we could not figure-out the ilocal or remote site name
|
|
|
67dbe7 |
+ # DONE: Limit the runtime of hdbnsutil and use getParameter.py as fallback
|
|
|
67dbe7 |
+ # DONE: PRIO2: Maybe we need to use a fallback interface when hdbnsutil does not answer properly -> lookup in config files?
|
|
|
67dbe7 |
+ # TODO: This might also solve some problems when we could not figure-out the local or remote site name (site_name,site_id from global.ini)
|
|
|
67dbe7 |
local chkMethod=""
|
|
|
67dbe7 |
+ local ini_mode=""
|
|
|
67dbe7 |
for chkMethod in hU hU hU gP; do
|
|
|
67dbe7 |
case "$chkMethod" in
|
|
|
67dbe7 |
gP )
|
|
|
67dbe7 |
+ # fallback for 'hdbnsutil' failing 3 times.
|
|
|
67dbe7 |
local gpKeys=""
|
|
|
67dbe7 |
- gpKeys=$(echo --key=global.ini/system_replication/{mode,site_name,site_id})
|
|
|
67dbe7 |
+ gpKeys=$(echo --key=global.ini/system_replication/{actual_mode,mode})
|
|
|
67dbe7 |
node_full_status=$(HANA_CALL --timeout "$HANA_CALL_TIMEOUT" --cmd "HDBSettings.sh getParameter.py $gpKeys --sapcontrol=1" 2>&1 | awk -F/ 'BEGIN {out=0} /^SAPCONTROL-OK: <begin>/ { out=1 } /^SAPCONTROL-OK: <end>/ { out=0 } /=/ {if (out==1) {print $3} }')
|
|
|
67dbe7 |
- node_status=$(echo "$node_full_status" | awk -F= '$1=="mode" {print $2}')
|
|
|
67dbe7 |
+ # first try to get the value of 'actual_mode' from the global.ini
|
|
|
67dbe7 |
+ ini_mode=$(echo "$node_full_status" | awk -F= '$1=="actual_mode" {print $2}')
|
|
|
67dbe7 |
+ # if 'actual_mode' is not available, fallback to 'mode'
|
|
|
67dbe7 |
+ if [ -z "$ini_mode" ]; then
|
|
|
67dbe7 |
+ ini_mode=$(echo "$node_full_status" | awk -F= '$1=="mode" {print $2}')
|
|
|
67dbe7 |
+ fi
|
|
|
67dbe7 |
+ node_status="$ini_mode"
|
|
|
67dbe7 |
super_ocf_log info "ACT: Using getParameter.py as fallback - node_status=$node_status"
|
|
|
67dbe7 |
;;
|
|
|
67dbe7 |
hU | * )
|
|
|
67dbe7 |
- # DONE: PRIO1: Begginning from SAP HANA rev 112.03 -sr_state is not longer supported
|
|
|
67dbe7 |
+ # DONE: PRIO1: Beginning from SAP HANA rev 112.03 -sr_state is not longer supported
|
|
|
67dbe7 |
node_full_status=$(HANA_CALL --timeout "$HANA_CALL_TIMEOUT" --cmd "$hdbState" 2>/dev/null )
|
|
|
67dbe7 |
node_status=$(echo "$node_full_status" | awk '$1=="mode:" {print $2}')
|
|
|
67dbe7 |
super_ocf_log debug "DBG: check_for_primary: node_status=$node_status"
|