From 068f3fea50d17c63ac527b84a7a3d39c6f6cb5e2 Mon Sep 17 00:00:00 2001 From: fudunwei Date: Fri, 29 Jan 2021 11:06:11 +0800 Subject: [PATCH] Negative seqno need to be considered when comparing seqno Need to consider Negative seqno to compare in some cases, but the task does not support to do that, we need to make it work. 1.we use mariabackup to restore datas on control1, delete the mariadb data on control2 and control3, and then use cluster recovery, as a result that the seqno of the other two nodes will be '-1'. 2. add one more control node into our existing mariadb cluster, and then use cluster recovery, the seqno of the new node will be '-1'. Change-Id: Ic1ac8656f28c3835e091637014f075ac5479d390 --- ansible/roles/mariadb/tasks/recover_cluster.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/mariadb/tasks/recover_cluster.yml b/ansible/roles/mariadb/tasks/recover_cluster.yml index 51b7fcf0a1..c26c946c3c 100644 --- a/ansible/roles/mariadb/tasks/recover_cluster.yml +++ b/ansible/roles/mariadb/tasks/recover_cluster.yml @@ -74,7 +74,7 @@ shell: cmd: | if [[ ! -z {{ hostvars[inventory_hostname]['seqno'] }} && ! -z {{ hostvars[item]['seqno'] }} && - {{ hostvars[inventory_hostname]['seqno'] }} =~ ^[0-9]+$ && {{ hostvars[item]['seqno'] }} =~ ^[0-9]+$ && + {{ hostvars[inventory_hostname]['seqno'] }} =~ ^-?[0-9]+$ && {{ hostvars[item]['seqno'] }} =~ ^-?[0-9]+$ && {{ hostvars[inventory_hostname]['seqno'] }} -lt {{ hostvars[item]['seqno'] }} ]]; then echo {{ hostvars[item]['seqno'] }}; fi with_items: "{{ groups['mariadb'] }}" register: seqno_compare