diff --git a/SOURCES/bz1984944-SAPHana-use-actual-mode.patch b/SOURCES/bz1984944-SAPHana-use-actual-mode.patch new file mode 100644 index 0000000..e4c43eb --- /dev/null +++ b/SOURCES/bz1984944-SAPHana-use-actual-mode.patch @@ -0,0 +1,59 @@ +From ec9fd4e526e572fe9bc0070186fa584b032eac22 Mon Sep 17 00:00:00 2001 +From: AngelaBriel +Date: Fri, 5 Mar 2021 19:18:02 +0100 +Subject: [PATCH] during the function 'check_for_primary' sometimes the command + 'hdbnsutil' does not work, but timed out. As a fallback we use + 'getParameter.py' to get some parameter values from the global.ini file. In + the past the use of the variable 'mode' was sufficient, but now we more often + see the problem, that this variable does not contain the current mode of the + node. So we will switch to the variable 'actual_mode', which will be more + reliable updated by the SAP software and will (hopefully) provide us with the + current mode of the node in times, where 'hdbnsutil' refuse to answer. This + change will help to avoid the irritating and confusing message 'secondary has + unexpected sync status PRIM ==> RESCORE' on a primary node as seen in + bsc#1181765 + +--- + heartbeat/SAPHana | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/heartbeat/SAPHana b/heartbeat/SAPHana +index 64e61e8..cd91ddf 100755 +--- a/heartbeat/SAPHana ++++ b/heartbeat/SAPHana +@@ -1054,21 +1054,29 @@ function check_for_primary() { + super_ocf_log info "FLOW $FUNCNAME ($*)" + local rc=$HANA_STATE_DEFECT + # TODO: PRIO 3: Check beginning from which SPS does SAP support HDBSettings.sh? +- # TODO: Limit the runtime of hdbnsutil and use getParameter.py as fallback +- # TODO: PRIO2: Maybe we need to use a fallback interface when hdbnsutil does not answer properly -> lookup in config files? +- # This might also solve some problems when we could not figure-out the ilocal or remote site name ++ # DONE: Limit the runtime of hdbnsutil and use getParameter.py as fallback ++ # DONE: PRIO2: Maybe we need to use a fallback interface when hdbnsutil does not answer properly -> lookup in config files? ++ # 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) + local chkMethod="" ++ local ini_mode="" + for chkMethod in hU hU hU gP; do + case "$chkMethod" in + gP ) ++ # fallback for 'hdbnsutil' failing 3 times. + local gpKeys="" +- gpKeys=$(echo --key=global.ini/system_replication/{mode,site_name,site_id}) ++ gpKeys=$(echo --key=global.ini/system_replication/{actual_mode,mode}) + 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: / { out=1 } /^SAPCONTROL-OK: / { out=0 } /=/ {if (out==1) {print $3} }') +- node_status=$(echo "$node_full_status" | awk -F= '$1=="mode" {print $2}') ++ # first try to get the value of 'actual_mode' from the global.ini ++ ini_mode=$(echo "$node_full_status" | awk -F= '$1=="actual_mode" {print $2}') ++ # if 'actual_mode' is not available, fallback to 'mode' ++ if [ -z "$ini_mode" ]; then ++ ini_mode=$(echo "$node_full_status" | awk -F= '$1=="mode" {print $2}') ++ fi ++ node_status="$ini_mode" + super_ocf_log info "ACT: Using getParameter.py as fallback - node_status=$node_status" + ;; + hU | * ) +- # DONE: PRIO1: Begginning from SAP HANA rev 112.03 -sr_state is not longer supported ++ # DONE: PRIO1: Beginning from SAP HANA rev 112.03 -sr_state is not longer supported + node_full_status=$(HANA_CALL --timeout "$HANA_CALL_TIMEOUT" --cmd "$hdbState" 2>/dev/null ) + node_status=$(echo "$node_full_status" | awk '$1=="mode:" {print $2}') + super_ocf_log debug "DBG: check_for_primary: node_status=$node_status" diff --git a/SPECS/resource-agents-sap-hana.spec b/SPECS/resource-agents-sap-hana.spec index 095c65a..a3e451c 100644 --- a/SPECS/resource-agents-sap-hana.spec +++ b/SPECS/resource-agents-sap-hana.spec @@ -29,7 +29,7 @@ Name: resource-agents-sap-hana Summary: SAP HANA cluster resource agents Epoch: 1 Version: 0.154.0 -Release: 2%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 2%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}.1 License: GPLv2+ URL: https://github.com/SUSE/SAPHanaSR %if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} @@ -39,6 +39,7 @@ Group: Productivity/Clustering/HA %endif Source0: %{upstream_prefix}-%{upstream_version}.tar.gz Source1: %{saphana_prefix}-%{saphana_version}.tar.gz +Patch0: bz1984944-SAPHana-use-actual-mode.patch BuildArch: noarch @@ -72,6 +73,8 @@ sed -i -e '/ ocf_heartbeat_SAPInstance.7 \\/a\ # change provider company sed -i -e 's/\("provider_company": \)"SUSE"/\1"Red Hat"/g' %{saphana_prefix}-%{saphana_version}/srHook/SAPHanaSR.py +%patch0 -p1 + %build if [ ! -f configure ]; then ./autogen.sh @@ -127,6 +130,12 @@ rm -rf %{buildroot} %exclude /usr/src %changelog +* Fri Jul 23 2021 Oyvind Albrigtsen - 0.154.0-2.1 +- SAPHana: use actual_mode from global.ini and fallback to mode when + it's not set + + Resolves: rhbz#1984944 + * Fri Feb 14 2020 Oyvind Albrigtsen - 0.154.0-2 - Rebase to SAPHanaSR 0.154.0 upstream release.