From 4d808243f0b9419b6d65423589e5c55128e6553e Mon Sep 17 00:00:00 2001 From: Oleksii Grudev Date: Wed, 23 Oct 2019 15:39:47 +0300 Subject: [PATCH] Fix search of max sequence number It was observed that sometimes during galera ckuster restart the node with highest seqno is determined incorrecly. After investigation it was found that max function is invoked on the list of string values which can lead to incorrect results. This patch performs casting the value to integer before building list of seqnos hence max function will return correct result Change-Id: I604ec837f3f2d157c829ab43a44e561879775c77 --- mariadb/templates/bin/_start.py.tpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mariadb/templates/bin/_start.py.tpl b/mariadb/templates/bin/_start.py.tpl index 20216e2c0..f53cffb69 100644 --- a/mariadb/templates/bin/_start.py.tpl +++ b/mariadb/templates/bin/_start.py.tpl @@ -619,7 +619,8 @@ def get_nodes_with_highest_seqno(): key = keyitems[0] node = keyitems[1] if key == 'seqno': - seqnos[node] = value + #Explicit casting to integer to have resulting list of integers for correct comparison + seqnos[node] = int(value) max_seqno = max(seqnos.values()) max_seqno_nodes = sorted([k for k, v in list(seqnos.items()) if v == max_seqno]) return max_seqno_nodes