MySQL Forums
Forum List  »  InnoDB

Re: how to upgrade database schema in M-M environment
Posted by: Rick James
Date: May 13, 2013 09:05PM

It depends.

Are the changes incompatible? That is, do the queries have to be changed at the same time as the schema?

If they are compatible (eg just adding a column or index), then...
Set session.binlog=0; ALTER passive master
Wait for replication to catchup.
Failover.
Repeat on other machine.

If incompatible, then build a layer (as Peter suggests) so that the application does not need to change. Instead, the 'layer' will dynamically map the application's requests to one or the other of the schemas. This will take more steps...
Add the layer (without changing the schema yet)
Test
Add new code to the layer to figure out which version it is talking to and run the appropriate queries.
Test (still using only the old schema)
ALTER the passive master (with binlog=0)
Point the layer to the passive master (now active), and tell it to use the new schema.
ALTER the old master (with binlog=0)
Eventually clean out the old code from the layer.

Next month, you will have the layer ready for the next big change :)

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: how to upgrade database schema in M-M environment
848
May 13, 2013 09:05PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.