Upgrading schemas in a distributed system by using Maintenance Mode features
The Advanced Replication architecture allows you to distribute your data between a master database and one or more replica databases. Publications are created on the master database, and replica databases can subscribe to those publications.
In some cases, you might need to alter the tables used by a publication, for example, by adding a new column to a table.
solidDB provides a set of schema management and synchronization features that allow you to change the schema of master and replica databases in your system. Schema management features in solidDB do not fully automate the schema upgrade process, but instead provide a set of programming tools that allow you to build a solution that matches the application needs.
For example, if the administrator creates a new table or alters an existing table in the master database, the administrator can decide whether the table should also be modified in the replica database and, if so, when the modification should be done.
solidDB provides a set of ‘Maintenance Mode’ features that have the primary purpose of reducing the effort that is required to upgrade the schema of a distributed system - that is, to alter the structure of a table that is used by a publication.
If you do not use the ‘Maintenance Mode’ features, you cannot change a table without first dropping the publication that references the table. Re-creating the publication forces all replicas to do a full refresh (rather than an incremental refresh) the next time that they refresh from a publication that contains that table. This is true even if the publication uses only a subset of the columns in that table, and the ALTER TABLE statement that you used did not affect any of those columns.
You can use ‘Maintenance Mode’ features to perform significant updates to a database schema without causing large amounts of data to be synchronized with the replica databases. Write operations made to a master database data in ‘Maintenance Mode’ are not synchronized. Instead, it is assumed that the same updates will be done in the replica database.
The ‘Maintenance Mode’ functionality for upgrading the schema of a distributed system includes the following features:
▪ Sync Mode – Setting the catalog sync mode to Maintenance mode allows you to make schema changes (DDL operations) to tables that are referenced by a publication without necessarily requiring the replica database to have a full refresh of the data. For more information, see Set catalog sync mode to Maintenance mode.
▪ OR REPLACE option in the CREATE PUBLICATION statement – The OR REPLACE option allows you to change an existing publication without necessarily requiring the replica database to have a full refresh of the data. For more information, see OR REPLACE option in the CREATE PUBLICATION statement.
▪ Table-level locking – You can explicitly lock an entire table to make it easier to change the schema. For more information, see Table-level locking.
▪ Schema version tracking – If either the master or replica database sets the persistent catalog-level parameter SYNC_APP_SCHEMA_VERSION, the servers refuse to synchronize unless both have the same value for the version. This prevents synchronization when the schema of the replica database does not match the schema of the master database. For more information, see Version checking with SYNC_APP_SCHEMA_VERSION.