In the last application upgrade, we learned the hard way that the best approach for executing ALTER queries (schema upgrades) is to shut down the two replication nodes, perform the ALTER query on the master node, then sequentially restart and sync the replication nodes. This method has proven effective.
Currently, I have a new application upgrade that includes a schema change, and I need to clarify the best approach for performing this upgrade. The current setup is as follows:
Node1 (master) started with systemctl start mysql
Node2 (replication node) was previously started with mysql@bootstrap
Node3 (replication node) started with systemctl start mysql
Given this configuration, I am concerned about the proper procedure for the schema upgrade. My plan is to:
Stop Node2 using mysql@bootstrap stop
Stop Node3 using systemctl stop mysql
Perform the ALTER query on Node1 (master)
Restart Node2 using systemctl start mysql and wait for it to sync and join the cluster
Restart Node3 using systemctl start mysql and wait for it to sync and join the cluster
Throughout this process, the application will remain stopped. My main concern is the previous use of mysql@bootstrap for Node2. Is this the correct and best approach for handling the schema upgrade in this scenario?
Hello @steve.original,
The main issue you are facing is wsrep_osu_method=TOI which is the default. This locks/blocks all activity on your PXC during the ALTER. This is expected behavior. Your current process is quite drastic. We can improve this.
Use pt-online-schema-change to make schema changes. This will make the schema changes without blocking/locking up the cluster.
Use ârolling schema upgradesâ. Set wsrep_osu_method=RSU on node3. Alter table on node3. After that is done. Repeat for node2. After done, repeat for node1. Your schema change MUST BE DONE before application code is rolled out.
Try wsrep_osu_method=NBO which is a new feature we introduced to help lessen TOI blocks.
You are right related to default setting for wsrep_osu_method.
I have worked with pt-online-schema-change before so I am familiar with that.
But related to point 2 from your reply, after i perform upgrade with RSU, rolling schema upgrades on all three nodes, should i return wsrep_osu_method=TOI or leave it on RSU? If I should return to TOI, when to do that?
Curious but is wsrep_osu_method=NBO only available in enterprise subscription-based licenses? or has it transitioned to the free opened-sourced versions?
There is no such thing as âenterpriseâ or âsubscription-based licensesâ with any Percona software All of our software is 100% free and open-source.
That isnât a very large table, in my opinion. Optimizing a table is used to remove/reclaim empty space within the table. You might reclaim a few hundred MBs, as InnoDB will always reuse already allocated pages before requesting new ones. I wouldnât worry about it if I was your DBA.