Standardize capitalization of "NoteDb"
Change-Id: I6b46af64267671cf458de07269bcc5b1f51d6fb0
This commit is contained in:
parent
400d1de568
commit
a2d40b836d
@ -525,8 +525,8 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
.id(r.getChangeId())
|
||||
.get();
|
||||
|
||||
// When notedb is enabled adding a reviewer records that user as reviewer
|
||||
// in notedb. When notedb is disabled adding a reviewer results in a dummy 0
|
||||
// When NoteDb is enabled adding a reviewer records that user as reviewer
|
||||
// in NoteDb. When NoteDb is disabled adding a reviewer results in a dummy 0
|
||||
// approval on the change which is treated as CC when the ChangeInfo is
|
||||
// created.
|
||||
Collection<AccountInfo> reviewers = isNoteDbTestEnabled()
|
||||
@ -575,8 +575,8 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
.get();
|
||||
reviewers = c.reviewers.get(REVIEWER);
|
||||
if (isNoteDbTestEnabled()) {
|
||||
// When notedb is enabled adding a reviewer records that user as reviewer
|
||||
// in notedb.
|
||||
// When NoteDb is enabled adding a reviewer records that user as reviewer
|
||||
// in NoteDb.
|
||||
assertThat(reviewers).hasSize(2);
|
||||
Iterator<AccountInfo> reviewerIt = reviewers.iterator();
|
||||
assertThat(reviewerIt.next()._accountId)
|
||||
@ -585,7 +585,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
.isEqualTo(user.getId().get());
|
||||
assertThat(c.reviewers).doesNotContainKey(CC);
|
||||
} else {
|
||||
// When notedb is disabled adding a reviewer results in a dummy 0 approval
|
||||
// When NoteDb is disabled adding a reviewer results in a dummy 0 approval
|
||||
// on the change which is treated as CC when the ChangeInfo is created.
|
||||
assertThat(reviewers).hasSize(1);
|
||||
assertThat(reviewers.iterator().next()._accountId)
|
||||
@ -654,13 +654,13 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
.votes();
|
||||
|
||||
if (isNoteDbTestEnabled()) {
|
||||
// When notedb is enabled each reviewer is explicitly recorded in the
|
||||
// notedb and this record stays even when all votes of that user have been
|
||||
// When NoteDb is enabled each reviewer is explicitly recorded in the
|
||||
// NoteDb and this record stays even when all votes of that user have been
|
||||
// deleted, hence there is no dummy 0 approval left when a vote is
|
||||
// deleted.
|
||||
assertThat(m).isEmpty();
|
||||
} else {
|
||||
// When notedb is disabled there is a dummy 0 approval on the change so
|
||||
// When NoteDb is disabled there is a dummy 0 approval on the change so
|
||||
// that the user is still returned as CC when all votes of that user have
|
||||
// been deleted.
|
||||
assertThat(m).containsEntry("Code-Review", new Short((short)0));
|
||||
@ -675,14 +675,14 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
assertThat(message.message).isEqualTo(
|
||||
"Removed Code-Review+1 by User <user@example.com>\n");
|
||||
if (isNoteDbTestEnabled()) {
|
||||
// When notedb is enabled each reviewer is explicitly recorded in the
|
||||
// notedb and this record stays even when all votes of that user have been
|
||||
// When NoteDb is enabled each reviewer is explicitly recorded in the
|
||||
// NoteDb and this record stays even when all votes of that user have been
|
||||
// deleted.
|
||||
assertThat(getReviewers(c.reviewers.get(REVIEWER)))
|
||||
.containsExactlyElementsIn(
|
||||
ImmutableSet.of(admin.getId(), user.getId()));
|
||||
} else {
|
||||
// When notedb is disabled users that have only dummy 0 approvals on the
|
||||
// When NoteDb is disabled users that have only dummy 0 approvals on the
|
||||
// change are returned as CC and not as REVIEWER.
|
||||
assertThat(getReviewers(c.reviewers.get(REVIEWER)))
|
||||
.containsExactlyElementsIn(ImmutableSet.of(admin.getId()));
|
||||
@ -892,7 +892,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void check() throws Exception {
|
||||
// TODO(dborowitz): Re-enable when ConsistencyChecker supports notedb.
|
||||
// TODO(dborowitz): Re-enable when ConsistencyChecker supports NoteDb.
|
||||
assume().that(notesMigration.enabled()).isFalse();
|
||||
PushOneCommit.Result r = createChange();
|
||||
assertThat(gApi.changes()
|
||||
@ -1067,7 +1067,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notedbCommitsOnPatchSetCreation() throws Exception {
|
||||
public void noteDbCommitsOnPatchSetCreation() throws Exception {
|
||||
assume().that(notesMigration.enabled()).isTrue();
|
||||
|
||||
PushOneCommit.Result r = createChange();
|
||||
|
@ -256,8 +256,8 @@ public class VisibleRefFilterIT extends AbstractDaemonTest {
|
||||
/**
|
||||
* Assert that refs seen by a non-admin user match expected.
|
||||
*
|
||||
* @param expectedWithMeta expected refs, in order. If notedb is disabled by
|
||||
* the configuration, any notedb refs (i.e. ending in "/meta") are removed
|
||||
* @param expectedWithMeta expected refs, in order. If NoteDb is disabled by
|
||||
* the configuration, any NoteDb refs (i.e. ending in "/meta") are removed
|
||||
* from the expected list before comparing to the actual results.
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -28,7 +28,7 @@ import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class RebuildNotedbIT {
|
||||
public class RebuildNoteDbIT {
|
||||
private File sitePath;
|
||||
|
||||
@Before
|
||||
@ -49,7 +49,7 @@ public class RebuildNotedbIT {
|
||||
Files.append(ConfigNotesMigration.allEnabledConfig().toText(),
|
||||
new File(sitePath.toString(), "etc/gerrit.config"),
|
||||
UTF_8);
|
||||
runGerrit("RebuildNotedb", "-d", sitePath.toString(),
|
||||
runGerrit("RebuildNoteDb", "-d", sitePath.toString(),
|
||||
"--show-stack-trace");
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class CreateChangeIT extends AbstractDaemonTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notedbCommit() throws Exception {
|
||||
public void noteDbCommit() throws Exception {
|
||||
assume().that(notesMigration.enabled()).isTrue();
|
||||
|
||||
ChangeInfo c = assertCreateSucceeds(newChangeInput(ChangeStatus.NEW));
|
||||
|
@ -72,7 +72,7 @@ public class ConsistencyCheckerIT extends AbstractDaemonTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
// TODO(dborowitz): Re-enable when ConsistencyChecker supports notedb.
|
||||
// TODO(dborowitz): Re-enable when ConsistencyChecker supports NoteDb.
|
||||
// Note that we *do* want to enable these tests with GERRIT_CHECK_NOTEDB, as
|
||||
// we need to be able to convert old, corrupt changes. However, those tests
|
||||
// don't necessarily need to pass.
|
||||
|
@ -74,7 +74,6 @@ public final class GerritLauncher {
|
||||
System.err.println();
|
||||
System.err.println("The most commonly used commands are:");
|
||||
System.err.println(" init Initialize a Gerrit installation");
|
||||
System.err.println(" rebuild-notedb Rebuild the review notes database");
|
||||
System.err.println(" reindex Rebuild the secondary index");
|
||||
System.err.println(" daemon Run the Gerrit network daemons");
|
||||
System.err.println(" gsql Run the interactive query console");
|
||||
|
@ -358,7 +358,7 @@ public class LuceneChangeIndex implements ChangeIndex {
|
||||
|
||||
if (!schema.hasField(PROJECT)) {
|
||||
// Schema is not new enough to have project field. Ensure we have ID
|
||||
// field, and call createOnlyWhenNotedbDisabled from toChangeData below.
|
||||
// field, and call createOnlyWhenNoteDbDisabled from toChangeData below.
|
||||
if (fs.contains(LEGACY_ID.getName())) {
|
||||
return fs;
|
||||
} else {
|
||||
@ -389,9 +389,9 @@ public class LuceneChangeIndex implements ChangeIndex {
|
||||
new Change.Id(doc.getField(idFieldName).numericValue().intValue());
|
||||
IndexableField project = doc.getField(PROJECT.getName());
|
||||
if (project == null) {
|
||||
// Old schema without project field: we can safely assume notedb is
|
||||
// Old schema without project field: we can safely assume NoteDb is
|
||||
// disabled.
|
||||
cd = changeDataFactory.createOnlyWhenNotedbDisabled(db.get(), id);
|
||||
cd = changeDataFactory.createOnlyWhenNoteDbDisabled(db.get(), id);
|
||||
} else {
|
||||
cd = changeDataFactory.create(
|
||||
db.get(), new Project.NameKey(project.stringValue()), id);
|
||||
|
@ -75,9 +75,9 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class RebuildNotedb extends SiteProgram {
|
||||
public class RebuildNoteDb extends SiteProgram {
|
||||
private static final Logger log =
|
||||
LoggerFactory.getLogger(RebuildNotedb.class);
|
||||
LoggerFactory.getLogger(RebuildNoteDb.class);
|
||||
|
||||
@Option(name = "--threads",
|
||||
usage = "Number of threads to use for rebuilding NoteDb")
|
||||
@ -121,14 +121,14 @@ public class RebuildNotedb extends SiteProgram {
|
||||
sysInjector = createSysInjector();
|
||||
sysInjector.injectMembers(this);
|
||||
if (!notesMigration.enabled()) {
|
||||
die("Notedb is not enabled.");
|
||||
die("NoteDb is not enabled.");
|
||||
}
|
||||
LifecycleManager sysManager = new LifecycleManager();
|
||||
sysManager.add(sysInjector);
|
||||
sysManager.start();
|
||||
|
||||
ListeningExecutorService executor = newExecutor();
|
||||
System.out.println("Rebuilding the notedb");
|
||||
System.out.println("Rebuilding the NoteDb");
|
||||
|
||||
Multimap<Project.NameKey, Change.Id> changesByProject =
|
||||
getChangesByProject();
|
||||
@ -171,7 +171,7 @@ public class RebuildNotedb extends SiteProgram {
|
||||
}
|
||||
}));
|
||||
} catch (Exception e) {
|
||||
log.error("Error rebuilding notedb", e);
|
||||
log.error("Error rebuilding NoteDb", e);
|
||||
ok.set(false);
|
||||
break;
|
||||
}
|
@ -24,7 +24,7 @@ import org.eclipse.jgit.lib.Config;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
// TODO(dborowitz): Not necessary once we switch to notedb.
|
||||
// TODO(dborowitz): Not necessary once we switch to NoteDb.
|
||||
/** Utility to limit threads used by a batch program. */
|
||||
public class ThreadLimiter {
|
||||
private static final Logger log =
|
||||
|
@ -46,7 +46,7 @@ public class RefNames {
|
||||
/** A change starred by a user */
|
||||
public static final String REFS_STARRED_CHANGES = "refs/starred-changes/";
|
||||
|
||||
/** Sequence counters in notedb. */
|
||||
/** Sequence counters in NoteDb. */
|
||||
public static final String REFS_SEQUENCES = "refs/sequences/";
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ public class RefNames {
|
||||
*/
|
||||
public static final String REFS_CACHE_AUTOMERGE = "refs/cache-automerge/";
|
||||
|
||||
/** Suffix of a meta ref in the notedb. */
|
||||
/** Suffix of a meta ref in the NoteDb. */
|
||||
public static final String META_SUFFIX = "/meta";
|
||||
|
||||
public static final String EDIT_PREFIX = "edit-";
|
||||
|
@ -55,7 +55,7 @@ import java.util.TreeMap;
|
||||
* <p>
|
||||
* The result of a copy may either be stored, as when stamping approvals in the
|
||||
* database at submit time, or refreshed on demand, as when reading approvals
|
||||
* from the notedb.
|
||||
* from the NoteDb.
|
||||
*/
|
||||
@Singleton
|
||||
public class ApprovalCopier {
|
||||
|
@ -313,7 +313,7 @@ public class PatchLineCommentsUtil {
|
||||
bru.addCommand(new ReceiveCommand(
|
||||
ref.getObjectId(), ObjectId.zeroId(), ref.getName()));
|
||||
}
|
||||
bru.setRefLogMessage("Delete drafts from notedb", false);
|
||||
bru.setRefLogMessage("Delete drafts from NoteDb", false);
|
||||
bru.execute(rw, NullProgressMonitor.INSTANCE);
|
||||
for (ReceiveCommand cmd : bru.getCommands()) {
|
||||
if (cmd.getResult() != ReceiveCommand.Result.OK) {
|
||||
|
@ -97,7 +97,7 @@ public class ChangeResource implements RestResource, HasETag {
|
||||
noteId = null; // This ETag will be invalidated if it loads next time.
|
||||
}
|
||||
hashObjectId(h, noteId, buf);
|
||||
// TODO(dborowitz): Include more notedb and other related refs, e.g. drafts
|
||||
// TODO(dborowitz): Include more NoteDb and other related refs, e.g. drafts
|
||||
// and edits.
|
||||
|
||||
for (ProjectState p : control.getProjectControl().getProjectState().tree()) {
|
||||
|
@ -68,7 +68,7 @@ public class Check implements RestReadView<ChangeResource>,
|
||||
|
||||
private void checkEnabled() throws NotImplementedException {
|
||||
if (notesMigration.readChanges()) {
|
||||
throw new NotImplementedException("check not implemented for notedb");
|
||||
throw new NotImplementedException("check not implemented for NoteDb");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public class ConsistencyChecker {
|
||||
|
||||
private void checkImpl() {
|
||||
checkState(!notesMigration.readChanges(),
|
||||
"ConsistencyChecker for notedb not yet implemented");
|
||||
"ConsistencyChecker for NoteDb not yet implemented");
|
||||
checkOwner();
|
||||
checkCurrentPatchSetEntity();
|
||||
|
||||
|
@ -50,7 +50,7 @@ class DeleteDraftChangeOp extends BatchUpdate.Op {
|
||||
|
||||
static ReviewDb unwrap(ReviewDb db) {
|
||||
// This is special. We want to delete exactly the rows that are present in
|
||||
// the database, even when reading everything else from notedb, so we need
|
||||
// the database, even when reading everything else from NoteDb, so we need
|
||||
// to bypass the write-only wrapper.
|
||||
if (db instanceof BatchUpdateReviewDb) {
|
||||
db = ((BatchUpdateReviewDb) db).unsafeGetDelegate();
|
||||
@ -108,7 +108,7 @@ class DeleteDraftChangeOp extends BatchUpdate.Op {
|
||||
db.accountPatchReviews().byPatchSet(ps.getId()));
|
||||
}
|
||||
|
||||
// Only delete from reviewdb here; deletion from notedb is handled in
|
||||
// Only delete from ReviewDb here; deletion from NoteDb is handled in
|
||||
// BatchUpdate.
|
||||
db.patchComments().delete(db.patchComments().byChange(id));
|
||||
db.patchSetApprovals().delete(db.patchSetApprovals().byChange(id));
|
||||
|
@ -136,7 +136,7 @@ public class DeleteDraftPatchSet implements RestModifyView<RevisionResource, Inp
|
||||
|
||||
private void deleteDraftPatchSet(PatchSet patchSet, ChangeContext ctx)
|
||||
throws OrmException {
|
||||
// For notedb itself, no need to delete these entities, as they are
|
||||
// For NoteDb itself, no need to delete these entities, as they are
|
||||
// automatically filtered out when patch sets are deleted.
|
||||
psUtil.delete(ctx.getDb(), ctx.getUpdate(patchSet.getId()), patchSet);
|
||||
|
||||
|
@ -480,7 +480,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
||||
}
|
||||
ChangeUpdate u = ctx.getUpdate(psId);
|
||||
// TODO(dborowitz): Currently doesn't work for PUBLISH_ALL_REVISIONS with
|
||||
// notedb.
|
||||
// NoteDb.
|
||||
plcUtil.deleteComments(ctx.getDb(), u, del);
|
||||
plcUtil.putComments(ctx.getDb(), u, ups);
|
||||
comments.addAll(ups);
|
||||
|
@ -279,7 +279,7 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager,
|
||||
@Override
|
||||
public Repository openMetadataRepository(Project.NameKey name)
|
||||
throws RepositoryNotFoundException, IOException {
|
||||
checkState(notesMigration.readChanges(), "notedb disabled");
|
||||
checkState(notesMigration.readChanges(), "NoteDb disabled");
|
||||
try {
|
||||
return openRepository(noteDbPath, name);
|
||||
} catch (RepositoryNotFoundException e) {
|
||||
|
@ -370,7 +370,7 @@ abstract class SubmitStrategyOp extends BatchUpdate.Op {
|
||||
update.removeApprovalFor(psa.getAccountId(), psa.getLabel());
|
||||
}
|
||||
|
||||
// TODO(dborowitz): Don't use a label in notedb; just check when status
|
||||
// TODO(dborowitz): Don't use a label in NoteDb; just check when status
|
||||
// change happened.
|
||||
for (PatchSetApproval psa : normalized.unchanged()) {
|
||||
if (includeUnchanged || psa.isLegacySubmit()) {
|
||||
|
@ -59,7 +59,7 @@ public class IndexedChangeQuery extends Predicate<ChangeData>
|
||||
|
||||
public static QueryOptions createOptions(IndexConfig config, int start,
|
||||
int limit, Set<String> fields) {
|
||||
// Always include project since it is needed to load the change from notedb.
|
||||
// Always include project since it is needed to load the change from NoteDb.
|
||||
if (!fields.contains(CHANGE.getName())
|
||||
&& !fields.contains(PROJECT.getName())) {
|
||||
fields = new HashSet<>(fields);
|
||||
|
@ -82,7 +82,7 @@ public abstract class AbstractChangeNotes<T> extends VersionedMetaData {
|
||||
}
|
||||
}
|
||||
|
||||
/** Load default values for any instance variables when notedb is disabled. */
|
||||
/** Load default values for any instance variables when NoteDb is disabled. */
|
||||
protected abstract void loadDefaults();
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ public class ChangeDelete {
|
||||
ru.setExpectedOldObjectId(notes.load().getRevision());
|
||||
ru.setNewObjectId(ObjectId.zeroId());
|
||||
ru.setForceUpdate(true);
|
||||
ru.setRefLogMessage("Delete change from notedb", false);
|
||||
ru.setRefLogMessage("Delete change from NoteDb", false);
|
||||
RefUpdate.Result result = ru.delete();
|
||||
switch (result) {
|
||||
case FAST_FORWARD:
|
||||
|
@ -202,10 +202,10 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
}
|
||||
|
||||
// TODO(dborowitz): Remove when deleting index schemas <27.
|
||||
public ChangeNotes createFromIdOnlyWhenNotedbDisabled(
|
||||
public ChangeNotes createFromIdOnlyWhenNoteDbDisabled(
|
||||
ReviewDb db, Change.Id changeId) throws OrmException {
|
||||
checkState(!migration.readChanges(), "do not call"
|
||||
+ " createFromIdOnlyWhenNotedbDisabled when notedb is enabled");
|
||||
+ " createFromIdOnlyWhenNoteDbDisabled when NoteDb is enabled");
|
||||
Change change = unwrap(db).changes().get(changeId);
|
||||
return new ChangeNotes(repoManager, migration, allUsers, noteUtil,
|
||||
change.getProject(), change).load();
|
||||
@ -216,10 +216,10 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
* Instantiate ChangeNotes for a change that has been loaded by a batch read
|
||||
* from the database.
|
||||
*/
|
||||
private ChangeNotes createFromChangeOnlyWhenNotedbDisabled(Change change)
|
||||
private ChangeNotes createFromChangeOnlyWhenNoteDbDisabled(Change change)
|
||||
throws OrmException {
|
||||
checkState(!migration.readChanges(), "do not call"
|
||||
+ " createFromChangeWhenNotedbDisabled when notedb is enabled");
|
||||
+ " createFromChangeWhenNoteDbDisabled when NoteDb is enabled");
|
||||
return new ChangeNotes(repoManager, migration, allUsers, noteUtil,
|
||||
change.getProject(), change).load();
|
||||
}
|
||||
@ -271,7 +271,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
}
|
||||
|
||||
for (Change c : unwrap(db).changes().get(changeIds)) {
|
||||
notes.add(createFromChangeOnlyWhenNotedbDisabled(c));
|
||||
notes.add(createFromChangeOnlyWhenNoteDbDisabled(c));
|
||||
}
|
||||
return notes;
|
||||
}
|
||||
@ -292,7 +292,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
|
||||
for (Change c : unwrap(db).changes().get(changeIds)) {
|
||||
if (c != null && project.equals(c.getDest().getParentKey())) {
|
||||
ChangeNotes cn = createFromChangeOnlyWhenNotedbDisabled(c);
|
||||
ChangeNotes cn = createFromChangeOnlyWhenNoteDbDisabled(c);
|
||||
if (predicate.apply(cn)) {
|
||||
notes.add(cn);
|
||||
}
|
||||
@ -307,7 +307,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
if (migration.readChanges()) {
|
||||
for (Project.NameKey project : projectCache.all()) {
|
||||
try (Repository repo = repoManager.openRepository(project)) {
|
||||
List<ChangeNotes> changes = scanNotedb(repo, db, project);
|
||||
List<ChangeNotes> changes = scanNoteDb(repo, db, project);
|
||||
for (ChangeNotes cn : changes) {
|
||||
if (predicate.apply(cn)) {
|
||||
m.put(project, cn);
|
||||
@ -317,7 +317,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
}
|
||||
} else {
|
||||
for (Change change : unwrap(db).changes().all()) {
|
||||
ChangeNotes notes = createFromChangeOnlyWhenNotedbDisabled(change);
|
||||
ChangeNotes notes = createFromChangeOnlyWhenNoteDbDisabled(change);
|
||||
if (predicate.apply(notes)) {
|
||||
m.put(change.getProject(), notes);
|
||||
}
|
||||
@ -332,7 +332,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
return scanDb(repo, db);
|
||||
}
|
||||
|
||||
return scanNotedb(repo, db, project);
|
||||
return scanNoteDb(repo, db, project);
|
||||
}
|
||||
|
||||
private List<ChangeNotes> scanDb(Repository repo, ReviewDb db)
|
||||
@ -343,13 +343,13 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
// but still >1.
|
||||
for (List<Change.Id> batch : Iterables.partition(ids, 30)) {
|
||||
for (Change change : unwrap(db).changes().get(batch)) {
|
||||
notes.add(createFromChangeOnlyWhenNotedbDisabled(change));
|
||||
notes.add(createFromChangeOnlyWhenNoteDbDisabled(change));
|
||||
}
|
||||
}
|
||||
return notes;
|
||||
}
|
||||
|
||||
private List<ChangeNotes> scanNotedb(Repository repo, ReviewDb db,
|
||||
private List<ChangeNotes> scanNoteDb(Repository repo, ReviewDb db,
|
||||
Project.NameKey project) throws OrmException, IOException {
|
||||
Set<Change.Id> ids = scan(repo);
|
||||
List<ChangeNotes> changeNotes = new ArrayList<>(ids.size());
|
||||
|
@ -189,15 +189,15 @@ public class ChangeRebuilder {
|
||||
events.add(new ApprovalEvent(psa, change.getCreatedOn()));
|
||||
}
|
||||
|
||||
Change notedbChange = new Change(null, null, null, null, null);
|
||||
Change noteDbChange = new Change(null, null, null, null, null);
|
||||
for (ChangeMessage msg : db.changeMessages().byChange(changeId)) {
|
||||
events.add(
|
||||
new ChangeMessageEvent(msg, notedbChange, change.getCreatedOn()));
|
||||
new ChangeMessageEvent(msg, noteDbChange, change.getCreatedOn()));
|
||||
}
|
||||
|
||||
Collections.sort(events, EVENT_ORDER);
|
||||
|
||||
events.add(new FinalUpdatesEvent(change, notedbChange));
|
||||
events.add(new FinalUpdatesEvent(change, noteDbChange));
|
||||
|
||||
EventList<Event> el = new EventList<>();
|
||||
for (Event e : events) {
|
||||
@ -632,14 +632,14 @@ public class ChangeRebuilder {
|
||||
Pattern.compile("^Restored(\n.*)*$");
|
||||
|
||||
private final ChangeMessage message;
|
||||
private final Change notedbChange;
|
||||
private final Change noteDbChange;
|
||||
|
||||
ChangeMessageEvent(ChangeMessage message, Change notedbChange,
|
||||
ChangeMessageEvent(ChangeMessage message, Change noteDbChange,
|
||||
Timestamp changeCreatedOn) {
|
||||
super(message.getPatchSetId(), message.getAuthor(),
|
||||
message.getWrittenOn(), changeCreatedOn);
|
||||
this.message = message;
|
||||
this.notedbChange = notedbChange;
|
||||
this.noteDbChange = noteDbChange;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -661,7 +661,7 @@ public class ChangeRebuilder {
|
||||
if (m.matches()) {
|
||||
String topic = m.group(1);
|
||||
update.setTopic(topic);
|
||||
notedbChange.setTopic(topic);
|
||||
noteDbChange.setTopic(topic);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -669,13 +669,13 @@ public class ChangeRebuilder {
|
||||
if (m.matches()) {
|
||||
String topic = m.group(2);
|
||||
update.setTopic(topic);
|
||||
notedbChange.setTopic(topic);
|
||||
noteDbChange.setTopic(topic);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TOPIC_REMOVED_REGEXP.matcher(msg).matches()) {
|
||||
update.setTopic(null);
|
||||
notedbChange.setTopic(null);
|
||||
noteDbChange.setTopic(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -683,26 +683,26 @@ public class ChangeRebuilder {
|
||||
String msg = message.getMessage();
|
||||
if (STATUS_ABANDONED_REGEXP.matcher(msg).matches()) {
|
||||
update.setStatus(Change.Status.ABANDONED);
|
||||
notedbChange.setStatus(Change.Status.ABANDONED);
|
||||
noteDbChange.setStatus(Change.Status.ABANDONED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (STATUS_RESTORED_REGEXP.matcher(msg).matches()) {
|
||||
update.setStatus(Change.Status.NEW);
|
||||
notedbChange.setStatus(Change.Status.NEW);
|
||||
noteDbChange.setStatus(Change.Status.NEW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class FinalUpdatesEvent extends Event {
|
||||
private final Change change;
|
||||
private final Change notedbChange;
|
||||
private final Change noteDbChange;
|
||||
|
||||
FinalUpdatesEvent(Change change, Change notedbChange) {
|
||||
FinalUpdatesEvent(Change change, Change noteDbChange) {
|
||||
super(change.currentPatchSetId(), change.getOwner(),
|
||||
change.getLastUpdatedOn(), change.getCreatedOn());
|
||||
this.change = change;
|
||||
this.notedbChange = notedbChange;
|
||||
this.noteDbChange = noteDbChange;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -713,10 +713,10 @@ public class ChangeRebuilder {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
void apply(ChangeUpdate update) throws OrmException {
|
||||
if (!Objects.equals(change.getTopic(), notedbChange.getTopic())) {
|
||||
if (!Objects.equals(change.getTopic(), noteDbChange.getTopic())) {
|
||||
update.setTopic(change.getTopic());
|
||||
}
|
||||
if (!Objects.equals(change.getStatus(), notedbChange.getStatus())) {
|
||||
if (!Objects.equals(change.getStatus(), noteDbChange.getStatus())) {
|
||||
// TODO(dborowitz): Stamp approximate approvals at this time.
|
||||
update.fixStatus(change.getStatus());
|
||||
}
|
||||
@ -724,7 +724,7 @@ public class ChangeRebuilder {
|
||||
update.setSubmissionId(change.getSubmissionId());
|
||||
}
|
||||
if (!update.isEmpty()) {
|
||||
update.setSubjectForCommit("Final notedb migration updates");
|
||||
update.setSubjectForCommit("Final NoteDb migration updates");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class ConfigNotesMigration extends NotesMigration {
|
||||
}
|
||||
}
|
||||
|
||||
private static final String NOTEDB = "notedb";
|
||||
private static final String NOTE_DB = "noteDb";
|
||||
private static final String READ = "read";
|
||||
private static final String WRITE = "write";
|
||||
|
||||
@ -62,16 +62,16 @@ public class ConfigNotesMigration extends NotesMigration {
|
||||
for (Table t : Table.values()) {
|
||||
keys.add(t.key());
|
||||
}
|
||||
for (String t : cfg.getSubsections(NOTEDB)) {
|
||||
for (String t : cfg.getSubsections(NOTE_DB)) {
|
||||
checkArgument(keys.contains(t.toLowerCase()),
|
||||
"invalid notedb table: %s", t);
|
||||
for (String key : cfg.getNames(NOTEDB, t)) {
|
||||
"invalid NoteDb table: %s", t);
|
||||
for (String key : cfg.getNames(NOTE_DB, t)) {
|
||||
String lk = key.toLowerCase();
|
||||
checkArgument(lk.equals(WRITE) || lk.equals(READ),
|
||||
"invalid notedb key: %s.%s", t, key);
|
||||
"invalid NoteDb key: %s.%s", t, key);
|
||||
}
|
||||
boolean write = cfg.getBoolean(NOTEDB, t, WRITE, false);
|
||||
boolean read = cfg.getBoolean(NOTEDB, t, READ, false);
|
||||
boolean write = cfg.getBoolean(NOTE_DB, t, WRITE, false);
|
||||
boolean read = cfg.getBoolean(NOTE_DB, t, READ, false);
|
||||
checkArgument(!(read && !write),
|
||||
"must have write enabled when read enabled: %s", t);
|
||||
}
|
||||
@ -80,8 +80,8 @@ public class ConfigNotesMigration extends NotesMigration {
|
||||
public static Config allEnabledConfig() {
|
||||
Config cfg = new Config();
|
||||
for (Table t : Table.values()) {
|
||||
cfg.setBoolean(NOTEDB, t.key(), WRITE, true);
|
||||
cfg.setBoolean(NOTEDB, t.key(), READ, true);
|
||||
cfg.setBoolean(NOTE_DB, t.key(), WRITE, true);
|
||||
cfg.setBoolean(NOTE_DB, t.key(), READ, true);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
@ -92,8 +92,8 @@ public class ConfigNotesMigration extends NotesMigration {
|
||||
@Inject
|
||||
ConfigNotesMigration(@GerritServerConfig Config cfg) {
|
||||
checkConfig(cfg);
|
||||
writeChanges = cfg.getBoolean(NOTEDB, Table.CHANGES.key(), WRITE, false);
|
||||
readChanges = cfg.getBoolean(NOTEDB, Table.CHANGES.key(), READ, false);
|
||||
writeChanges = cfg.getBoolean(NOTE_DB, Table.CHANGES.key(), WRITE, false);
|
||||
readChanges = cfg.getBoolean(NOTE_DB, Table.CHANGES.key(), READ, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,7 @@ public enum PatchSetState {
|
||||
/**
|
||||
* Deleted patch set.
|
||||
* <p>
|
||||
* Used internally as a tombstone; patch sets exposed by public notedb
|
||||
* Used internally as a tombstone; patch sets exposed by public NoteDb
|
||||
* interfaces never have this state.
|
||||
*/
|
||||
DELETED;
|
||||
|
@ -281,7 +281,7 @@ public class ChangeData {
|
||||
ChangeData create(ReviewDb db, ChangeControl c);
|
||||
|
||||
// TODO(dborowitz): Remove when deleting index schemas <27.
|
||||
ChangeData createOnlyWhenNotedbDisabled(ReviewDb db, Change.Id id);
|
||||
ChangeData createOnlyWhenNoteDbDisabled(ReviewDb db, Change.Id id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -506,7 +506,7 @@ public class ChangeData {
|
||||
@Assisted ReviewDb db,
|
||||
@Assisted Change.Id id) {
|
||||
checkState(!notesMigration.readChanges(),
|
||||
"do not call createOnlyWhenNotedbDisabled when notedb is enabled");
|
||||
"do not call createOnlyWhenNoteDbDisabled when NoteDb is enabled");
|
||||
this.db = db;
|
||||
this.repoManager = repoManager;
|
||||
this.changeControlFactory = changeControlFactory;
|
||||
@ -629,7 +629,7 @@ public class ChangeData {
|
||||
public Project.NameKey project() throws OrmException {
|
||||
if (project == null) {
|
||||
checkState(!notesMigration.readChanges(), "should not have created "
|
||||
+ " ChangeData without a project when notedb is enabled");
|
||||
+ " ChangeData without a project when NoteDb is enabled");
|
||||
project = change().getProject();
|
||||
}
|
||||
return project;
|
||||
@ -699,7 +699,7 @@ public class ChangeData {
|
||||
|
||||
public Change reloadChange() throws OrmException {
|
||||
if (project == null) {
|
||||
notes = notesFactory.createFromIdOnlyWhenNotedbDisabled(db, legacyId);
|
||||
notes = notesFactory.createFromIdOnlyWhenNoteDbDisabled(db, legacyId);
|
||||
} else {
|
||||
notes = notesFactory.create(db, project, legacyId);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import com.google.gwtorm.server.OrmException;
|
||||
import com.google.gwtorm.server.ResultSet;
|
||||
|
||||
public class DisabledChangesReviewDbWrapper extends ReviewDbWrapper {
|
||||
private static final String MSG = "This table has been migrated to notedb";
|
||||
private static final String MSG = "This table has been migrated to NoteDb";
|
||||
|
||||
private final DisabledChangeAccess changes;
|
||||
private final DisabledPatchSetApprovalAccess patchSetApprovals;
|
||||
|
@ -25,7 +25,7 @@ import java.lang.annotation.Retention;
|
||||
* that talks to the underlying traditional {@link
|
||||
* com.google.gerrit.reviewdb.server.ReviewDb} database.
|
||||
* <p>
|
||||
* During the migration to notedb, the actual {@code ReviewDb} will be a wrapper
|
||||
* During the migration to NoteDb, the actual {@code ReviewDb} will be a wrapper
|
||||
* with certain tables enabled/disabled; this marker goes on the low-level
|
||||
* implementation that has all tables.
|
||||
*/
|
||||
|
@ -1019,7 +1019,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byHashtagWithNotedb() throws Exception {
|
||||
public void byHashtagWithNoteDb() throws Exception {
|
||||
assume().that(notesMigration.enabled()).isTrue();
|
||||
List<Change> changes = setUpHashtagChanges();
|
||||
assertQuery("hashtag:foo", changes.get(1), changes.get(0));
|
||||
@ -1032,7 +1032,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byHashtagWithoutNotedb() throws Exception {
|
||||
public void byHashtagWithoutNoteDb() throws Exception {
|
||||
assume().that(notesMigration.enabled()).isFalse();
|
||||
setUpHashtagChanges();
|
||||
assertQuery("hashtag:foo");
|
||||
@ -1335,7 +1335,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
cd.reviewedBy();
|
||||
|
||||
// TODO(dborowitz): Swap out GitRepositoryManager somehow? Will probably be
|
||||
// necessary for notedb anyway.
|
||||
// necessary for NoteDb anyway.
|
||||
cd.isMergeable();
|
||||
|
||||
exception.expect(DisabledReviewDb.Disabled.class);
|
||||
|
@ -114,7 +114,7 @@ public class TestChanges {
|
||||
return update;
|
||||
}
|
||||
|
||||
// Change doesn't exist yet. Notedb requires that there be a commit for the
|
||||
// Change doesn't exist yet. NoteDb requires that there be a commit for the
|
||||
// first patch set, so create one.
|
||||
try (Repository repo = repoManager.openRepository(c.getProject())) {
|
||||
TestRepository<Repository> tr = new TestRepository<>(repo);
|
||||
|
Loading…
x
Reference in New Issue
Block a user