MergeOp: Retry when current revision is not found
We were unconditionally setting the change back to NEW if there was some unknown error attempting to merge a change. Be a little more precise about what we do with REVISION_GONE. In particular, in a replicated environment with eventually-consistent semantics (whether master-slave or multi-master), a revision might be missing due to replication lag, which might eventually correct itself. So, we shouldn't reset the change to NEW in this case, allowing the submit queue to eventually pick it up once replication settles out. We can also make the message a little nicer. Like other merge failure messages, this one is repeated only occasionally if it is a duplicate. This does mean that if the failure is not due to replication lag but something else (the kind of thing this code was originally worrying about, e.g. the ref got manually deleted), we might continue retrying indefinitely. This is not so bad; there are already plenty of cases where we do that, and that's why we implemented the message deduplication in the first place. Change-Id: I2f8d2ab1bc3938dbc0573dc5a319f03bb546b5f1
This commit is contained in:
@@ -814,6 +814,19 @@ public class MergeOp {
|
||||
potentiallyStillSubmittable.add(commit);
|
||||
break;
|
||||
|
||||
case REVISION_GONE:
|
||||
logDebug("Commit not found for change {}", c.getId());
|
||||
ChangeMessage msg = new ChangeMessage(
|
||||
new ChangeMessage.Key(
|
||||
c.getId(),
|
||||
ChangeUtil.messageUUID(db)),
|
||||
null,
|
||||
TimeUtil.nowTs(),
|
||||
c.currentPatchSetId());
|
||||
msg.setMessage("Failed to read commit for this patch set");
|
||||
sendMergeFail(commit.notes(), msg, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
setNew(commit,
|
||||
message(c, "Unspecified merge failure: " + s.name()));
|
||||
|
Reference in New Issue
Block a user