Enable RepoSequence with a config option

When noteDb.changes.sequence is true, read changes from the
refs/sequences/changes blob in All-Projects. Use a lazily evaluated
Seed that reads the next change number from ReviewDb and uses it as
the first number in NoteDb.

In a single-server setting this is sufficient, but in a multi-master
environment it may be desirable to leave a gap after the next
ReviewDb counter to account for the fact that not all servers may
receive the configuration update immediately. Control this with an
undocumented config option.

Change-Id: I2de8fbd42b525a75b3cdbcdb4b3f9e33e382b7a7
This commit is contained in:
Dave Borowitz
2016-07-21 15:20:16 -04:00
parent 9448ed4c81
commit 08de3c852b
7 changed files with 167 additions and 35 deletions

View File

@@ -62,6 +62,15 @@ public abstract class NotesMigration {
*/
protected abstract boolean writeChanges();
/**
* Read sequential change ID numbers from NoteDb.
* <p>
* If true, change IDs are read from {@code refs/sequences/changes} in
* All-Projects. If false, change IDs are read from ReviewDb's native
* sequences.
*/
public abstract boolean readChangeSequence();
public abstract boolean readAccounts();
public abstract boolean writeAccounts();