public abstract class NotesMigration extends Object
The migration will proceed one root entity type at a time. A root entity is an entity
stored in ReviewDb whose key's getParentKey()
method returns null. For an example of the
entity hierarchy rooted at Change, see the diagram in com.google.gerrit.reviewdb.client.Change
.
During a transitional period, each root entity group from ReviewDb may be either written to or both written to and read from NoteDb.
This class controls the state of the migration according to options in gerrit.config
.
In general, any changes to these options should only be made by adventurous administrators, who
know what they're doing, on non-production data, for the purposes of testing the NoteDb
implementation. Changing options quite likely requires re-running RebuildNoteDb
. For
these reasons, the options remain undocumented.
Constructor and Description |
---|
NotesMigration() |
Modifier and Type | Method and Description |
---|---|
abstract NoteDbChangeState.PrimaryStorage |
changePrimaryStorage() |
boolean |
commitChangeWrites() |
abstract boolean |
disableChangeReviewDb()
Disable ReviewDb access for changes.
|
boolean |
enabled() |
boolean |
failChangeWrites() |
boolean |
failOnLoad()
Whether to fail when reading any data from NoteDb.
|
abstract boolean |
readChanges()
Read changes from NoteDb.
|
abstract boolean |
readChangeSequence()
Read sequential change ID numbers from NoteDb.
|
protected abstract boolean |
writeChanges()
Write changes to NoteDb.
|
public abstract boolean readChanges()
Change data is read from NoteDb refs, but ReviewDb is still the source of truth. If the loader determines NoteDb is out of date, the change data in NoteDb will be transparently rebuilt. This means that some code paths that look read-only may in fact attempt to write.
If true and writeChanges() = false
, changes can still be read from NoteDb, but any
attempts to write will generate an error.
protected abstract boolean writeChanges()
Updates to change data are written to NoteDb refs, but ReviewDb is still the source of truth. Change data will not be written unless the NoteDb refs are already up to date, and the write path will attempt to rebuild the change if not.
If false, the behavior when attempting to write depends on readChanges()
. If readChanges() = false
, writes to NoteDb are simply ignored; if true
, any attempts to
write will generate an error.
public abstract boolean readChangeSequence()
If true, change IDs are read from refs/sequences/changes
in All-Projects. If false,
change IDs are read from ReviewDb's native sequences.
public abstract NoteDbChangeState.PrimaryStorage changePrimaryStorage()
public abstract boolean disableChangeReviewDb()
When set, ReviewDb operations involving the Changes table become no-ops. Lookups return no results; updates do nothing, as does opening, committing, or rolling back a transaction on the Changes table.
public boolean failOnLoad()
Used in conjunction with readChanges()
for tests.
public boolean commitChangeWrites()
public boolean failChangeWrites()
public boolean enabled()