how wsrep_local_index is defined or could be changed? I have a cluster of 3 nodes using Galera with MariaDB, every time I want to backup I check the node with the highest wsrep_local_index and then do:

SET GLOBAL wsrep_desync = ON;


Take the backup, once finish I do:

SET GLOBAL wsrep_desync = OFF;


But I notice that the wsrep_local_index value changes during this process, also if I reboot a node, the wsrep_local_index values are reorganized, therefore would like to understand more about how this value is defined in the first place and what are the cases that make it change, from the docs I only found: 

wsrep_local_index

This node index in the cluster (base 0).


The reason for taking the backup on a cluster with the highest wsrep_local_index is that the cluster is behind a proxy that only serves traffic from the node with index 0.
The wsrep_local_index does not change due to desync mode. You most likely restart the node, this process does change the local index.

Here is the log of the process to show that it does not change:

MariaDB [(none)]&gt; show global status like 'wsrep_local_index';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| wsrep_local_index | 0     |
+-------------------+-------+
1 row in set (0.002 sec)

MariaDB [(none)]&gt; set global wsrep_desync=1;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]&gt; show global status like 'wsrep_local_index';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| wsrep_local_index | 0     |
+-------------------+-------+
1 row in set (0.002 sec)

MariaDB [(none)]&gt; set global wsrep_desync=0;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]&gt; show global status like 'wsrep_local_index';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| wsrep_local_index | 0     |
+-------------------+-------+
1 row in set (0.002 sec)