NotesMigration: Remove support for non-Changes tables
The accounts migration is well underway and we never ended up needing this. Leave NoteDbTable around, as it's still used by the metrics code to parameterize some latency metrics. This ensures the existing metrics stay the same, and it's still conceivable that we might want to measure metrics for the accounts table. Change-Id: I0212d073524867f3d0e8945a5856fd90f8bf76ee
This commit is contained in:
parent
5a8e44b378
commit
8854189b42
@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.server.notedb;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.gerrit.server.notedb.NoteDbTable.ACCOUNTS;
|
||||
import static com.google.gerrit.server.notedb.NoteDbTable.CHANGES;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@ -24,7 +23,6 @@ import com.google.gerrit.server.notedb.NoteDbChangeState.PrimaryStorage;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
|
||||
@ -55,10 +53,7 @@ public class ConfigNotesMigration extends NotesMigration {
|
||||
private static final String WRITE = "write";
|
||||
|
||||
private static void checkConfig(Config cfg) {
|
||||
Set<String> keys = new HashSet<>();
|
||||
for (NoteDbTable t : NoteDbTable.values()) {
|
||||
keys.add(t.key().toLowerCase());
|
||||
}
|
||||
Set<String> keys = ImmutableSet.of(CHANGES.key());
|
||||
Set<String> allowed =
|
||||
ImmutableSet.of(
|
||||
PRIMARY_STORAGE.toLowerCase(),
|
||||
@ -75,10 +70,8 @@ public class ConfigNotesMigration extends NotesMigration {
|
||||
|
||||
public static Config allEnabledConfig() {
|
||||
Config cfg = new Config();
|
||||
for (NoteDbTable t : NoteDbTable.values()) {
|
||||
cfg.setBoolean(NOTE_DB, t.key(), WRITE, true);
|
||||
cfg.setBoolean(NOTE_DB, t.key(), READ, true);
|
||||
}
|
||||
cfg.setBoolean(NOTE_DB, CHANGES.key(), WRITE, true);
|
||||
cfg.setBoolean(NOTE_DB, CHANGES.key(), READ, true);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
@ -87,9 +80,6 @@ public class ConfigNotesMigration extends NotesMigration {
|
||||
private final boolean readChangeSequence;
|
||||
private final PrimaryStorage changePrimaryStorage;
|
||||
|
||||
private final boolean writeAccounts;
|
||||
private final boolean readAccounts;
|
||||
|
||||
@Inject
|
||||
ConfigNotesMigration(@GerritServerConfig Config cfg) {
|
||||
checkConfig(cfg);
|
||||
@ -105,9 +95,6 @@ public class ConfigNotesMigration extends NotesMigration {
|
||||
|
||||
changePrimaryStorage =
|
||||
cfg.getEnum(NOTE_DB, CHANGES.key(), PRIMARY_STORAGE, PrimaryStorage.REVIEW_DB);
|
||||
|
||||
writeAccounts = cfg.getBoolean(NOTE_DB, ACCOUNTS.key(), WRITE, false);
|
||||
readAccounts = cfg.getBoolean(NOTE_DB, ACCOUNTS.key(), READ, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,14 +116,4 @@ public class ConfigNotesMigration extends NotesMigration {
|
||||
public PrimaryStorage changePrimaryStorage() {
|
||||
return changePrimaryStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeAccounts() {
|
||||
return writeAccounts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readAccounts() {
|
||||
return readAccounts;
|
||||
}
|
||||
}
|
||||
|
@ -70,10 +70,6 @@ public abstract class NotesMigration {
|
||||
/** @return default primary storage for new changes. */
|
||||
public abstract PrimaryStorage changePrimaryStorage();
|
||||
|
||||
public abstract boolean readAccounts();
|
||||
|
||||
public abstract boolean writeAccounts();
|
||||
|
||||
/**
|
||||
* Whether to fail when reading any data from NoteDb.
|
||||
*
|
||||
@ -102,6 +98,6 @@ public abstract class NotesMigration {
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return writeChanges() || readChanges() || writeAccounts() || readAccounts();
|
||||
return writeChanges() || readChanges();
|
||||
}
|
||||
}
|
||||
|
@ -52,16 +52,6 @@ public class TestNotesMigration extends NotesMigration {
|
||||
return writeChanges;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readAccounts() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeAccounts() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean failOnLoad() {
|
||||
return failOnLoad;
|
||||
|
Loading…
Reference in New Issue
Block a user