Mergeability: handle UncheckedExecutionException like ExecutionException

Before this fix, UncheckedExecution exceptions caused by IllegalState
exceptions like "Duplicate stages not allowed" from jgit DirCacheBuilder
used to fail re-indexing. The stack trace available from the below
linked Issue is our recently noticed example of this.

This fix treats such exceptions the same way as Execution exceptions are
currently handled in MergeabilityCacheImpl. Should an
UncheckedExecutionException be thrown within checking mergeability from
re-indexing (or other threads), then the mergeability flag gets set to
false -as for a checked ExecutionException.

Bug: Issue 4249
Change-Id: I270db012c2796a7bebeb66ffe2969d7564daebe0
This commit is contained in:
Marco Miller
2016-07-12 11:40:36 -04:00
parent c5fe4f4edc
commit 1bf5784825

View File

@@ -28,6 +28,7 @@ import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.UncheckedExecutionException;
import com.google.gerrit.extensions.client.SubmitType;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.server.ReviewDb;
@@ -269,7 +270,7 @@ public class MergeabilityCacheImpl implements MergeabilityCache {
EntryKey key = new EntryKey(commit, into, submitType, mergeStrategy);
try {
return cache.get(key, new Loader(key, dest, repo, db));
} catch (ExecutionException e) {
} catch (ExecutionException | UncheckedExecutionException e) {
log.error(String.format("Error checking mergeability of %s into %s (%s)",
key.commit.name(), key.into.name(), key.submitType.name()),
e.getCause());