Schema upgrade means any data definition statement (DDL statement) run for the database. They change the database structure and are non-transactional.
By default DDL processing in Galera happens by Total Order Isolation (TOI) method. With TOI, the DDL is processed in same order with regards to other transactions in each cluster node. With TOI method, the whole cluster has part of the database locked for the duration of the DDL processing (i.e. behaves like a single server).
The advantage of this method is that it is simple, predictable and guarantees data consistency.
The disadvantage is that the cluster behaves like a single server, potentially canceling the cluster high availability benefit for the duration of DDL execution.
Starting with wsrep patch 5.5.17-22.3 a new method for performing schema upgrades is introduced. User can now choose whether to use the traditional total order isolation or new rolling schema upgrade method. Schema upgrade method choice is done by global parameter:
Rolling schema upgrade is a DDL processing method, where DDL will be only processed locally at the node. The node is desynchronized from the cluster for the duration of the DDL processing, so that it does not block the rest of the nodes. When the DDL processing is complete, the node applies delayed replication events and synchronizes back with the cluster.
To upgrade schema cluster-wide, the DDL should be manually executed at each node in turn. When this rolling schema upgrade proceeds, part of the cluster will have old schema structure and part of the cluster will have new schema structure.
Be warned, however, that wsrep_OSU_method is a global option and will affect any DDL while it is in effect (i.e. neither DDL will be replicated). So it is recommended that the node accepts no other load. If scared, read on…
If you want a more fine-grained control over which DDL is replicated, then starting with MySQL-wsrep version 5.5.33-23.7.6 you can go about it as follows:
mysql> SET GLOBAL wsrep_desync=ON; // this allows the node to fall behind the cluster mysql> SET wsrep_on=OFF; // this disables replication for the given session ... DDL (optimize, add index, rebuild, etc.) ... mysql> SET wsrep_on=ON; mysql> SET GLOBAL wsrep_desync=OFF