Merge changes I552aa95c,Ie65aeb40,I7cf2b92f
* changes: Add Javadoc and use a more general name for SchemaUpgradeTestEnvironment Use retry mechanism for group creations and name updates RetryHelper: Let callers care about exception handling
This commit is contained in:
@@ -41,6 +41,7 @@ import static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_OTHER_RE
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -149,6 +150,7 @@ import com.google.gerrit.server.update.Context;
|
||||
import com.google.gerrit.server.update.RepoContext;
|
||||
import com.google.gerrit.server.update.RepoOnlyOp;
|
||||
import com.google.gerrit.server.update.RetryHelper;
|
||||
import com.google.gerrit.server.update.RetryHelper.Action;
|
||||
import com.google.gerrit.server.update.RetryHelper.ActionType;
|
||||
import com.google.gerrit.server.update.UpdateException;
|
||||
import com.google.gerrit.server.util.LabelVote;
|
||||
@@ -2891,10 +2893,7 @@ class ReceiveCommits {
|
||||
for (Ref ref : byCommit.get(c.copy())) {
|
||||
PatchSet.Id psId = PatchSet.Id.fromRef(ref.getName());
|
||||
Optional<ChangeData> cd =
|
||||
retryHelper.execute(
|
||||
ActionType.CHANGE_QUERY,
|
||||
() -> byLegacyId(psId.getParentKey()),
|
||||
t -> t instanceof OrmException);
|
||||
executeIndexQuery(() -> byLegacyId(psId.getParentKey()));
|
||||
if (cd.isPresent() && cd.get().change().getDest().equals(branch)) {
|
||||
existingPatchSets++;
|
||||
bu.addOp(
|
||||
@@ -2906,11 +2905,7 @@ class ReceiveCommits {
|
||||
|
||||
for (String changeId : c.getFooterLines(CHANGE_ID)) {
|
||||
if (byKey == null) {
|
||||
byKey =
|
||||
retryHelper.execute(
|
||||
ActionType.CHANGE_QUERY,
|
||||
() -> openChangesByKeyByBranch(branch),
|
||||
t -> t instanceof OrmException);
|
||||
byKey = executeIndexQuery(() -> openChangesByKeyByBranch(branch));
|
||||
}
|
||||
|
||||
ChangeNotes onto = byKey.get(new Change.Key(changeId.trim()));
|
||||
@@ -2967,6 +2962,16 @@ class ReceiveCommits {
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T executeIndexQuery(Action<T> action) throws OrmException {
|
||||
try {
|
||||
return retryHelper.execute(ActionType.INDEX_QUERY, action, OrmException.class::isInstance);
|
||||
} catch (Exception e) {
|
||||
Throwables.throwIfUnchecked(e);
|
||||
Throwables.throwIfInstanceOf(e, OrmException.class);
|
||||
throw new OrmException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAccountInfo() {
|
||||
if (setFullNameTo == null) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user