TOI (Total Order Isolation) is a method used in Percona XtraDB Cluster (PXC) to handle DDL (Data Definition Language) statements. DDL statements are commands that define or alter the structure of database objects, like tables or indexes. TOI ensures that these changes happen consistently across all nodes in the cluster.
TOI offers strong data consistency guarantees for online schema changes in PXC. However, it comes with the trade-off of potentially impacting performance and introducing complexities. Weigh the advantages and disadvantages based on your specific needs and the complexity of your schema changes.
TOI makes sure that all nodes in the PXC cluster apply schema changes in the exact same order. This means all nodes have identical schemas at any given time, preventing inconsistencies and potential data corruption.
Simplicity
You can set the configuration option, wsrep_OSU_method=TOI.
Predictability
Since all nodes apply changes in the same order, you can predict the outcome, minimizing surprises during schema updates.
During a TOI schema change, all other transactions on the cluster are blocked until the schema change is completed on all nodes. This can lead to temporary performance slowdowns or pauses in application activity depending on the complexity of the schema change and workload.
Increased Load
Replicating the complete schema change statement to all nodes can put additional load on the network and cluster resources.
Potential Deadlocks
In rare cases, complex schema changes involving multiple tables or operations might lead to deadlocks. YOu may need to manually resolve these issues.
Error Handling
If the schema change fails on one node, TOI doesn’t perform a rollback on other nodes. This can leave the cluster in an inconsistent state, requiring additional steps to recover.
Complexity of Changes
The impact of TOI increases with the complexity of the schema changes. Simple changes like adding columns might have minimal performance impact, while complex changes involving multiple tables or data manipulation could cause significant slowdowns.
Testing
Thoroughly testing schema changes in a non-production environment before applying them in a production PXC cluster is crucial.