1. Get unique identifiers for the source and target databases (which may just be their URLs, if no UUIDs are available).
2 . Generate a unique identifier for this replication based on the database IDs ….
So, the question then is, is a UUIDs available from Sync Gateway, or is the URL only used?
The reason for the question, is that I want to be sure that if I create a replica of a Sync Gateway bucket using CouchDB style replication (not XDCR), and then point the original Sync Gateway DNS at the new replica, that existing client replications will behave correctly (i.e. same URL, but new Sync Gateway replica with different sequence)
The second part of the question is: what would be the behaviour if I make the replica using XDCR, rather than CouchDB replication? Would this replica identify as a different, or the same database?
If I recall, the SG database’s UUID is stored in a special key in the bucket.
If you create a new database in SG it will have a different UUID. Using replication to copy the data won’t alter that. Couchbase Lite will treat this as a different database; the replication will work correctly, but it’ll take longer the first time because it will first have to check whether it has all the revisions in the database.
If you use XDCR the UUID will carry over to the new database. This is actually bad because the two buckets can diverge in contents, but the replicator won’t know because it thinks they’re the same database. That can cause data loss.