On Thu, Jul 30, 2009 at 08:33:10PM +0400, Alexey Pechnikov scratched on the wall: > Hello! > > On Thursday 30 July 2009 19:47:39 Jay A. Kreibich wrote: > > Then again, given that ROWID values are signed 64 bit values, you > > could just start each master at some offset (like +0x00FFFFFFFFFFFFFF) > > and not worry about it. It would still be a good idea to force all > > the tables into an AUTOINCREMENT mode somehow. >
> Before start replication databases may be copied from prototype > database as files and so they are binary equal. That still works (outside of adjustments to the sqlite_sequences table). Any replication function is going to manually insert a whole record, including the ROWID. The AUTOINCREMENT values would only be used if a master has to insert a brand-new row that otherwise doesn't exist anywhere in the cluster of masters. In that case it has to be assigned a globally unique (i.e. UUID) ROWID value. Off-setting the pool of ROWID values each master uses effectively does this. > UUID is really unique key for multi-master replication. And that's more or less what this does. Any brand new record that is created will be assigned a globally unique ROWID value, basically making that ROWID a UUID. > This is bad because ROWID without explicit field is not persistant > and may change after dump/restore. Please see illustration of the problem: Yes, this is true of almost every database system out there, including ones that generate UUIDs. You're not really supposed to dump and restore a multi-master system. If you trash a database you "restore" it by creating an empty master an syncing from a working master (or, in the case of SQLite, just copy of the file). If all your masters are trashed and you're building a new cluster, the alignment of ROWID values doesn't matter; even if they're freshly generated they're still unique across the new one-master cluster. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Our opponent is an alien starship packed with atomic bombs. We have a protractor." "I'll go home and see if I can scrounge up a ruler and a piece of string." --from Anathem by Neal Stephenson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users