From df4cc7827d8f8d7260162ad4e7685677f3475c51 Mon Sep 17 00:00:00 2001 From: Tin Lam Date: Thu, 26 Mar 2020 11:15:17 -0500 Subject: [PATCH] [Mariadb] Initialize variable There are scenarios where the wsrep_rec_pos variable is being returned without it being first initialized when the .communicate() method returns a blank. This patchset sets up a default initialization, so the readiness check does not error out with an exception. Change-Id: Ifea922f446bf3cbc9220f39a41dffc2763e6a5f3 Signed-off-by: Tin Lam --- mariadb/templates/bin/_start.py.tpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mariadb/templates/bin/_start.py.tpl b/mariadb/templates/bin/_start.py.tpl index 2fde312f21..22309cb729 100644 --- a/mariadb/templates/bin/_start.py.tpl +++ b/mariadb/templates/bin/_start.py.tpl @@ -549,11 +549,14 @@ def update_grastate_on_restart(): stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = wsrep_recover.communicate() + wsrep_rec_pos = '-1' for item in err.split("\n"): logger.info("Recovering wsrep position: {0}".format(item)) if "WSREP: Recovered position:" in item: line = item.strip().split() wsrep_rec_pos = line[-1].split(':')[-1] + if wsrep_rec_pos == '-1': + logger.info("Setting wsrep position to -1.") return wsrep_rec_pos set_grastate_val(key='seqno', value=recover_wsrep_position())