Hi Robert

(your email editor does some nasty things with formatting, could you set it to use plain text instead? tnx)


On 07/02/2009, at 7:09 AM, Robert Hodges wrote:
One other thing about sequences/auto-increments in general is to think through how they work with replication, since robust implementations tend to be non-serialized. Simple example: you have a master/slave pair for failover. When you failover to the slave, you need to ensure sequences allocate from values that are higher than any value allocated on the former master or the defaults for new rows will generate primary key violations. There are a number of difficulties (read: implied features) that follow from this.

I looked through the mailing lists but did not see much discussion of this aspect of the problem. Forgive me if I missed something.


I presume you're referring to current MySQL deployments.
In such a replicated architecture, slaves would be part of the setup when it comes to things like auto-increment-increment and -offset. I.e., the increment would be large enough to include all possible failover slaves (with room to spare), and each of the slaves also has a configured offset. This way, there'll never be any conflicts on failover.

In the above, the question of "higher values" is moot as the algorithm ensures that there will be no collisions. Rows will get a unique ID, but a) a later row (in time) can get a lower number (at another server) and b) there'll be gaps. I don't give a stuff about either, the unique ID is what matters.


Cheers,
Arjen.
--
Arjen Lentz, Director @ Open Query (http://openquery.com.au)
MySQL Training from $475/day, DBA/Support from $249/month

My blog is at http://arjen-lentz.livejournal.com
OurDelta: free enhanced builds for MySQL @ http://ourdelta.org


_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to