Merge changes Iaea11e5f,I36c1e2f5,I1e7277b3
* changes:
Stop reindexing changes for batch ref updates with only draft refs
Exclude drafts and stars from the change state
Delete leftovers of the COMPUTE_FROM_ALL_USERS_REPO experiment
diff --git a/java/com/google/gerrit/acceptance/ChangeIndexedCounter.java b/java/com/google/gerrit/acceptance/ChangeIndexedCounter.java
index 1ff7d0e..5991646 100644
--- a/java/com/google/gerrit/acceptance/ChangeIndexedCounter.java
+++ b/java/com/google/gerrit/acceptance/ChangeIndexedCounter.java
@@ -46,6 +46,10 @@
}
public void assertReindexOf(ChangeInfo info, long expectedCount) {
+ if (expectedCount == 0) {
+ assertThat(countsByChange.asMap()).isEmpty();
+ return;
+ }
assertThat(countsByChange.asMap()).containsExactly(info._number, expectedCount);
clear();
}
diff --git a/java/com/google/gerrit/server/StarredChangesUtil.java b/java/com/google/gerrit/server/StarredChangesUtil.java
index ae98d3c..0f5629e 100644
--- a/java/com/google/gerrit/server/StarredChangesUtil.java
+++ b/java/com/google/gerrit/server/StarredChangesUtil.java
@@ -14,7 +14,6 @@
package com.google.gerrit.server;
-import static com.google.gerrit.server.experiments.ExperimentFeaturesConstants.GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.joining;
@@ -39,11 +38,9 @@
import com.google.gerrit.git.GitUpdateFailureException;
import com.google.gerrit.git.LockFailureException;
import com.google.gerrit.server.config.AllUsersName;
-import com.google.gerrit.server.experiments.ExperimentFeatures;
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.index.change.ChangeField;
-import com.google.gerrit.server.index.change.ChangeIndexer;
import com.google.gerrit.server.logging.Metadata;
import com.google.gerrit.server.logging.TraceContext;
import com.google.gerrit.server.logging.TraceContext.TraceTimer;
@@ -169,9 +166,7 @@
private final GitReferenceUpdated gitRefUpdated;
private final AllUsersName allUsers;
private final Provider<PersonIdent> serverIdent;
- private final ChangeIndexer indexer;
private final Provider<InternalChangeQuery> queryProvider;
- private final ExperimentFeatures experimentFeatures;
@Inject
StarredChangesUtil(
@@ -179,16 +174,12 @@
GitReferenceUpdated gitRefUpdated,
AllUsersName allUsers,
@GerritPersonIdent Provider<PersonIdent> serverIdent,
- ChangeIndexer indexer,
- Provider<InternalChangeQuery> queryProvider,
- ExperimentFeatures experimentFeatures) {
+ Provider<InternalChangeQuery> queryProvider) {
this.repoManager = repoManager;
this.gitRefUpdated = gitRefUpdated;
this.allUsers = allUsers;
this.serverIdent = serverIdent;
- this.indexer = indexer;
this.queryProvider = queryProvider;
- this.experimentFeatures = experimentFeatures;
}
public NavigableSet<String> getLabels(Account.Id accountId, Change.Id changeId) {
@@ -224,10 +215,6 @@
} else {
updateLabels(repo, refName, old.objectId(), labels);
}
- if (!experimentFeatures.isFeatureEnabled(
- GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY)) {
- indexer.index(project, changeId);
- }
} catch (IOException e) {
throw new StorageException(
String.format("Star change %d for account %d failed", changeId.get(), accountId.get()),
diff --git a/java/com/google/gerrit/server/experiments/ExperimentFeaturesConstants.java b/java/com/google/gerrit/server/experiments/ExperimentFeaturesConstants.java
index ffeb44b..b876341 100644
--- a/java/com/google/gerrit/server/experiments/ExperimentFeaturesConstants.java
+++ b/java/com/google/gerrit/server/experiments/ExperimentFeaturesConstants.java
@@ -27,13 +27,6 @@
public static String GERRIT_BACKEND_REQUEST_FEATURE_REMOVE_REVISION_ETAG =
"GerritBackendRequestFeature__remove_revision_etag";
- /**
- * When set, we compute information from All-Users repository if able, instead of computing it
- * from the change index.
- */
- public static final String GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY =
- "GerritBackendRequestFeature__compute_from_all_users_repository";
-
/** Features, enabled by default in the current release. */
public static final ImmutableSet<String> DEFAULT_ENABLED_FEATURES =
ImmutableSet.of(UI_FEATURE_PATCHSET_COMMENTS, UI_FEATURE_SUBMIT_REQUIREMENTS_UI);
diff --git a/java/com/google/gerrit/server/index/change/ChangeSchemaDefinitions.java b/java/com/google/gerrit/server/index/change/ChangeSchemaDefinitions.java
index 5021a1a..6116f5a 100644
--- a/java/com/google/gerrit/server/index/change/ChangeSchemaDefinitions.java
+++ b/java/com/google/gerrit/server/index/change/ChangeSchemaDefinitions.java
@@ -129,8 +129,14 @@
new Schema.Builder<ChangeData>().add(V76).add(ChangeField.COMMIT_MESSAGE_EXACT).build();
// Upgrade Lucene to 7.x requires reindexing.
- static final Schema<ChangeData> V78 = schema(V77);
+ @Deprecated static final Schema<ChangeData> V78 = schema(V77);
+ /** Remove draft and star fields. */
+ static final Schema<ChangeData> V79 =
+ new Schema.Builder<ChangeData>()
+ .add(V78)
+ .remove(ChangeField.DRAFTBY, ChangeField.STAR, ChangeField.STARBY)
+ .build();
/**
* Name of the change index to be used when contacting index backends or loading configurations.
*/
diff --git a/java/com/google/gerrit/server/query/change/ChangeData.java b/java/com/google/gerrit/server/query/change/ChangeData.java
index 5b63555..1349523 100644
--- a/java/com/google/gerrit/server/query/change/ChangeData.java
+++ b/java/com/google/gerrit/server/query/change/ChangeData.java
@@ -1193,7 +1193,7 @@
this.stars = ImmutableListMultimap.copyOf(stars);
}
- public ImmutableMap<Account.Id, StarRef> starRefs() {
+ private ImmutableMap<Account.Id, StarRef> starRefs() {
if (starRefs == null) {
if (!lazyload()) {
return ImmutableMap.of();
@@ -1274,7 +1274,6 @@
edit.getRowKey(), edit.getColumnKey().changeId(), edit.getColumnKey()),
edit.getValue()));
}
- starRefs().values().forEach(r -> result.put(allUsersName, RefState.of(r.ref())));
// TODO: instantiating the notes is too much. We don't want to parse NoteDb, we just want the
// refs.
@@ -1282,14 +1281,6 @@
notes().getRobotComments(); // Force loading robot comments.
RobotCommentNotes robotNotes = notes().getRobotCommentNotes();
result.put(project, RefState.create(robotNotes.getRefName(), robotNotes.getMetaId()));
- draftRefs()
- .entrySet()
- .forEach(
- r ->
- result.put(
- allUsersName,
- RefState.create(
- RefNames.refsDraftComments(getId(), r.getKey()), r.getValue())));
refStates = result.build();
}
diff --git a/java/com/google/gerrit/server/query/change/ChangePredicates.java b/java/com/google/gerrit/server/query/change/ChangePredicates.java
index c874db7..3363ad7 100644
--- a/java/com/google/gerrit/server/query/change/ChangePredicates.java
+++ b/java/com/google/gerrit/server/query/change/ChangePredicates.java
@@ -81,11 +81,7 @@
* Returns a predicate that matches changes where the provided {@link
* com.google.gerrit.entities.Account.Id} has a pending draft comment.
*/
- public static Predicate<ChangeData> draftBy(
- boolean computeFromAllUsersRepository, CommentsUtil commentsUtil, Account.Id id) {
- if (!computeFromAllUsersRepository) {
- return new ChangeIndexPredicate(ChangeField.DRAFTBY, id.toString());
- }
+ public static Predicate<ChangeData> draftBy(CommentsUtil commentsUtil, Account.Id id) {
Set<Predicate<ChangeData>> changeIdPredicates =
commentsUtil.getChangesWithDrafts(id).stream()
.map(ChangePredicates::idStr)
@@ -100,13 +96,7 @@
* com.google.gerrit.entities.Account.Id} has starred changes with {@code label}.
*/
public static Predicate<ChangeData> starBy(
- boolean computeFromAllUsersRepository,
- StarredChangesUtil starredChangesUtil,
- Account.Id id,
- String label) {
- if (!computeFromAllUsersRepository) {
- return new StarPredicate(id, label);
- }
+ StarredChangesUtil starredChangesUtil, Account.Id id, String label) {
Set<Predicate<ChangeData>> starredChanges =
starredChangesUtil.byAccountId(id, label).stream()
.map(ChangePredicates::idStr)
diff --git a/java/com/google/gerrit/server/query/change/ChangeQueryBuilder.java b/java/com/google/gerrit/server/query/change/ChangeQueryBuilder.java
index 3ec16dd..e99306a 100644
--- a/java/com/google/gerrit/server/query/change/ChangeQueryBuilder.java
+++ b/java/com/google/gerrit/server/query/change/ChangeQueryBuilder.java
@@ -17,7 +17,6 @@
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.gerrit.entities.Change.CHANGE_ID_PATTERN;
import static com.google.gerrit.server.account.AccountResolver.isSelf;
-import static com.google.gerrit.server.experiments.ExperimentFeaturesConstants.GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY;
import static com.google.gerrit.server.query.change.ChangeData.asChanges;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
@@ -1120,19 +1119,11 @@
private Predicate<ChangeData> starredBySelf() throws QueryParseException {
return ChangePredicates.starBy(
- args.experimentFeatures.isFeatureEnabled(
- GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY),
- args.starredChangesUtil,
- self(),
- StarredChangesUtil.DEFAULT_LABEL);
+ args.starredChangesUtil, self(), StarredChangesUtil.DEFAULT_LABEL);
}
private Predicate<ChangeData> draftBySelf() throws QueryParseException {
- return ChangePredicates.draftBy(
- args.experimentFeatures.isFeatureEnabled(
- GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY),
- args.commentsUtil,
- self());
+ return ChangePredicates.draftBy(args.commentsUtil, self());
}
@Operator
diff --git a/java/com/google/gerrit/server/query/change/StarPredicate.java b/java/com/google/gerrit/server/query/change/StarPredicate.java
deleted file mode 100644
index 4a8fe43..0000000
--- a/java/com/google/gerrit/server/query/change/StarPredicate.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.gerrit.server.query.change;
-
-import com.google.gerrit.entities.Account;
-import com.google.gerrit.server.StarredChangesUtil;
-import com.google.gerrit.server.index.change.ChangeField;
-
-public class StarPredicate extends ChangeIndexPredicate {
- protected final Account.Id accountId;
- protected final String label;
-
- public StarPredicate(Account.Id accountId, String label) {
- super(ChangeField.STAR, StarredChangesUtil.StarField.create(accountId, label).toString());
- this.accountId = accountId;
- this.label = label;
- }
-
- @Override
- public boolean match(ChangeData cd) {
- return cd.stars().get(accountId).contains(label);
- }
-
- @Override
- public String toString() {
- return ChangeQueryBuilder.FIELD_STAR + ":" + label;
- }
-}
diff --git a/java/com/google/gerrit/server/restapi/account/DeleteDraftComments.java b/java/com/google/gerrit/server/restapi/account/DeleteDraftComments.java
index fbb4fbd..e35ffdb 100644
--- a/java/com/google/gerrit/server/restapi/account/DeleteDraftComments.java
+++ b/java/com/google/gerrit/server/restapi/account/DeleteDraftComments.java
@@ -15,7 +15,6 @@
package com.google.gerrit.server.restapi.account;
import static com.google.common.collect.ImmutableList.toImmutableList;
-import static com.google.gerrit.server.experiments.ExperimentFeaturesConstants.GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY;
import com.google.common.base.CharMatcher;
import com.google.common.base.Strings;
@@ -40,7 +39,6 @@
import com.google.gerrit.server.PatchSetUtil;
import com.google.gerrit.server.account.AccountResource;
import com.google.gerrit.server.change.ChangeJson;
-import com.google.gerrit.server.experiments.ExperimentFeatures;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.google.gerrit.server.query.change.ChangeData;
import com.google.gerrit.server.query.change.ChangePredicates;
@@ -77,7 +75,6 @@
private final Provider<CommentJson> commentJsonProvider;
private final CommentsUtil commentsUtil;
private final PatchSetUtil psUtil;
- private final ExperimentFeatures experimentFeatures;
@Inject
DeleteDraftComments(
@@ -89,8 +86,7 @@
ChangeJson.Factory changeJsonFactory,
Provider<CommentJson> commentJsonProvider,
CommentsUtil commentsUtil,
- PatchSetUtil psUtil,
- ExperimentFeatures experimentFeatures) {
+ PatchSetUtil psUtil) {
this.userProvider = userProvider;
this.batchUpdateFactory = batchUpdateFactory;
this.queryBuilder = queryBuilder;
@@ -100,7 +96,6 @@
this.commentJsonProvider = commentJsonProvider;
this.commentsUtil = commentsUtil;
this.psUtil = psUtil;
- this.experimentFeatures = experimentFeatures;
}
@Override
@@ -151,12 +146,7 @@
private Predicate<ChangeData> predicate(Account.Id accountId, DeleteDraftCommentsInput input)
throws BadRequestException {
- Predicate<ChangeData> hasDraft =
- ChangePredicates.draftBy(
- experimentFeatures.isFeatureEnabled(
- GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY),
- commentsUtil,
- accountId);
+ Predicate<ChangeData> hasDraft = ChangePredicates.draftBy(commentsUtil, accountId);
if (CharMatcher.whitespace().trimFrom(Strings.nullToEmpty(input.query)).isEmpty()) {
return hasDraft;
}
diff --git a/java/com/google/gerrit/server/update/BatchUpdate.java b/java/com/google/gerrit/server/update/BatchUpdate.java
index 3dfd9b4..92d614b 100644
--- a/java/com/google/gerrit/server/update/BatchUpdate.java
+++ b/java/com/google/gerrit/server/update/BatchUpdate.java
@@ -38,6 +38,7 @@
import com.google.gerrit.entities.Change;
import com.google.gerrit.entities.PatchSet;
import com.google.gerrit.entities.Project;
+import com.google.gerrit.entities.RefNames;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.config.FactoryModule;
import com.google.gerrit.extensions.restapi.BadRequestException;
@@ -148,7 +149,9 @@
}
for (ChangesHandle h : changesHandles) {
h.execute();
- indexFutures.addAll(h.startIndexFutures());
+ if (h.requiresReindex()) {
+ indexFutures.addAll(h.startIndexFutures());
+ }
}
notifyAfterUpdateRefs(listeners);
notifyAfterUpdateChanges(listeners);
@@ -621,6 +624,16 @@
BatchUpdate.this.executed = manager.isExecuted();
}
+ boolean requiresReindex() {
+ // We do not need to reindex changes if there are no ref updates, or if updated refs
+ // are all draft comment refs (since draft fields are not stored in the change index).
+ BatchRefUpdate bru = BatchUpdate.this.batchRefUpdate;
+ return !(bru == null
+ || bru.getCommands().isEmpty()
+ || bru.getCommands().stream()
+ .allMatch(cmd -> RefNames.isRefsDraftsComments(cmd.getRefName())));
+ }
+
ImmutableList<ListenableFuture<ChangeData>> startIndexFutures() {
if (dryrun) {
return ImmutableList.of();
diff --git a/javatests/com/google/gerrit/acceptance/api/change/BUILD b/javatests/com/google/gerrit/acceptance/api/change/BUILD
index 94fb0dc..306852a 100644
--- a/javatests/com/google/gerrit/acceptance/api/change/BUILD
+++ b/javatests/com/google/gerrit/acceptance/api/change/BUILD
@@ -6,5 +6,8 @@
labels = [
"api",
],
- deps = ["//java/com/google/gerrit/server/util/time"],
+ deps = [
+ "//java/com/google/gerrit/server/util/time",
+ "//javatests/com/google/gerrit/acceptance/server/change:util",
+ ],
) for f in glob(["*IT.java"])]
diff --git a/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java b/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
index 33d195a..c89da5b 100644
--- a/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
@@ -85,6 +85,7 @@
import com.google.gerrit.acceptance.VerifyNoPiiInChangeNotes;
import com.google.gerrit.acceptance.api.change.ChangeIT.TestAttentionSetListenerModule.TestAttentionSetListener;
import com.google.gerrit.acceptance.config.GerritConfig;
+import com.google.gerrit.acceptance.server.change.CommentsUtil;
import com.google.gerrit.acceptance.testsuite.account.AccountOperations;
import com.google.gerrit.acceptance.testsuite.change.IndexOperations;
import com.google.gerrit.acceptance.testsuite.group.GroupOperations;
@@ -4654,13 +4655,40 @@
ChangeInfo change = info(triplet);
assertThat(change.starred).isTrue();
assertThat(change.stars).contains(DEFAULT_LABEL);
- changeIndexedCounter.assertReindexOf(change);
+ // change was not re-indexed
+ changeIndexedCounter.assertReindexOf(change, 0);
gApi.accounts().self().unstarChange(triplet);
change = info(triplet);
assertThat(change.starred).isNull();
assertThat(change.stars).isNull();
- changeIndexedCounter.assertReindexOf(change);
+ // change was not re-indexed
+ changeIndexedCounter.assertReindexOf(change, 0);
+ }
+ }
+
+ @Test
+ public void createAndDeleteDraftCommentDoesNotTriggerChangeReindex() throws Exception {
+ ChangeIndexedCounter changeIndexedCounter = new ChangeIndexedCounter();
+ try (Registration registration =
+ extensionRegistry.newRegistration().add(changeIndexedCounter)) {
+ PushOneCommit.Result r = createChange();
+ String changeId = r.getChangeId();
+ String revId = r.getCommit().getName();
+ String triplet = project.get() + "~master~" + r.getChangeId();
+ changeIndexedCounter.clear();
+
+ // Create the draft. Change is not re-indexed
+ DraftInput draftInput =
+ CommentsUtil.newDraft("file1", Side.REVISION, /* line= */ 1, "comment 1");
+ CommentInfo draftInfo =
+ gApi.changes().id(changeId).revision(revId).createDraft(draftInput).get();
+ ChangeInfo change = info(triplet);
+ changeIndexedCounter.assertReindexOf(change, 0);
+
+ // Delete the draft comment. Change is not re-indexed
+ gApi.changes().id(changeId).revision(revId).draft(draftInfo.id).delete();
+ changeIndexedCounter.assertReindexOf(change, 0);
}
}
diff --git a/javatests/com/google/gerrit/acceptance/server/change/BUILD b/javatests/com/google/gerrit/acceptance/server/change/BUILD
index 19ca946..4514ea3 100644
--- a/javatests/com/google/gerrit/acceptance/server/change/BUILD
+++ b/javatests/com/google/gerrit/acceptance/server/change/BUILD
@@ -14,6 +14,7 @@
java_library(
name = "util",
srcs = ["CommentsUtil.java"],
+ visibility = ["//javatests/com/google/gerrit/acceptance/api/change:__subpackages__"],
deps = [
"//java/com/google/gerrit/acceptance:lib",
"//java/com/google/gerrit/entities",
diff --git a/javatests/com/google/gerrit/acceptance/server/change/CommentsUtil.java b/javatests/com/google/gerrit/acceptance/server/change/CommentsUtil.java
index c4927f0..f32cf32 100644
--- a/javatests/com/google/gerrit/acceptance/server/change/CommentsUtil.java
+++ b/javatests/com/google/gerrit/acceptance/server/change/CommentsUtil.java
@@ -34,7 +34,7 @@
* A utility class for creating {@link CommentInput} objects, publishing comments and creating draft
* comments. Used by tests that require dealing with comments.
*/
-class CommentsUtil {
+public class CommentsUtil {
static CommentInput addComment(GerritApi gApi, String changeId) throws Exception {
ReviewInput input = new ReviewInput();
CommentInput comment = CommentsUtil.newComment(FILE_NAME, Side.REVISION, 0, "a message", false);
@@ -88,7 +88,7 @@
return populate(c, path, Side.PARENT, parent, line, message);
}
- static DraftInput newDraft(String path, Side side, int line, String message) {
+ public static DraftInput newDraft(String path, Side side, int line, String message) {
DraftInput d = new DraftInput();
d.unresolved = false;
return populate(d, path, side, null, line, message);
diff --git a/javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java b/javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java
index 4795185..5d587f1 100644
--- a/javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java
+++ b/javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java
@@ -115,7 +115,6 @@
import com.google.gerrit.server.change.NotifyResolver;
import com.google.gerrit.server.change.PatchSetInserter;
import com.google.gerrit.server.config.AllUsersName;
-import com.google.gerrit.server.experiments.ExperimentFeaturesConstants;
import com.google.gerrit.server.git.meta.MetaDataUpdate;
import com.google.gerrit.server.group.testing.TestGroupBackend;
import com.google.gerrit.server.index.change.ChangeField;
@@ -198,7 +197,6 @@
@Inject protected TestGroupBackend testGroupBackend;
@Inject protected ProjectCache projectCache;
@Inject protected MetaDataUpdate.Server metaDataUpdateFactory;
- @Inject protected IdentifiedUser.GenericFactory identifiedUserFactory;
@Inject protected AuthRequest.Factory authRequestFactory;
@Inject protected ExternalIdFactory externalIdFactory;
@@ -2522,21 +2520,7 @@
}
@Test
- public void byHasDraft_draftsComputedFromIndex() throws Exception {
- byHasDraft();
- }
-
- @Test
- @GerritConfig(
- name = "experiments.enabled",
- value =
- ExperimentFeaturesConstants
- .GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY)
- public void byHasDraft_draftsComputedFromAllUsersRepository() throws Exception {
- byHasDraft();
- }
-
- private void byHasDraft() throws Exception {
+ public void byHasDraft() throws Exception {
TestRepository<Repo> repo = createProject("repo");
Change change1 = insert(repo, newChange(repo));
Change change2 = insert(repo, newChange(repo));
@@ -2606,20 +2590,8 @@
assertQuery("has:draft");
}
- public void byHasDraftWithManyDrafts_draftsComputedFromIndex() throws Exception {
- byHasDraftWithManyDrafts();
- }
-
- @GerritConfig(
- name = "experiments.enabled",
- value =
- ExperimentFeaturesConstants
- .GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY)
- public void byHasDraftWithManyDrafts_draftsComputedFromAllUsersRepository() throws Exception {
- byHasDraftWithManyDrafts();
- }
-
- private void byHasDraftWithManyDrafts() throws Exception {
+ @Test
+ public void byHasDraftWithManyDrafts() throws Exception {
TestRepository<Repo> repo = createProject("repo");
Change[] changesWithDrafts = new Change[30];
@@ -2647,21 +2619,7 @@
}
@Test
- public void byStarredBy_starsComputedFromIndex() throws Exception {
- byStarredBy();
- }
-
- @GerritConfig(
- name = "experiments.enabled",
- value =
- ExperimentFeaturesConstants
- .GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY)
- @Test
- public void byStarredBy_starsComputedFromAllUsersRepository() throws Exception {
- byStarredBy();
- }
-
- private void byStarredBy() throws Exception {
+ public void byStarredBy() throws Exception {
TestRepository<Repo> repo = createProject("repo");
Change change1 = insert(repo, newChange(repo));
Change change2 = insert(repo, newChange(repo));
@@ -2680,21 +2638,7 @@
}
@Test
- public void byStar_starsComputedFromIndex() throws Exception {
- byStar();
- }
-
- @GerritConfig(
- name = "experiments.enabled",
- value =
- ExperimentFeaturesConstants
- .GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY)
- @Test
- public void byStar_starsComputedFromAllUsersRepository() throws Exception {
- byStar();
- }
-
- private void byStar() throws Exception {
+ public void byStar() throws Exception {
TestRepository<Repo> repo = createProject("repo");
Change change1 = insert(repo, newChangeWithStatus(repo, Change.Status.MERGED));
@@ -2709,20 +2653,8 @@
assertQuery("is:starred", change1);
}
- public void byStarWithManyStars_starsComputedFromIndex() throws Exception {
- byStarWithManyStars();
- }
-
- @GerritConfig(
- name = "experiments.enabled",
- value =
- ExperimentFeaturesConstants
- .GERRIT_BACKEND_REQUEST_FEATURE_COMPUTE_FROM_ALL_USERS_REPOSITORY)
- public void byStarWithManyStars_starsComputedFromAllUsersRepository() throws Exception {
- byStarWithManyStars();
- }
-
- private void byStarWithManyStars() throws Exception {
+ @Test
+ public void byStarWithManyStars() throws Exception {
TestRepository<Repo> repo = createProject("repo");
Change[] changesWithDrafts = new Change[30];
for (int i = 0; i < changesWithDrafts.length; i++) {