I’m using Galera with in a multiserver MariaDB sluster.
I’m wondering what is a “by the book” method to get the a sequential number from a int column.
In a single server I would do something like this in a locked and isolated transaction:
SELECT IFNULL(MAX(sequential),0)+1 as newsequential FROM mytable FOR UPDATE
In a multi-server environment it may fail due to optimistic lock of Galera.