ReceiveCommits: Retry inserting changes and patch sets

If there are concurrent updates, the creation of the new patch sets may
fail due to LOCK_FAILURE. In this case we should retry the patch set
creation.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ib96cbe650a97be3cf29e3065af2f7a11b23166b7
This commit is contained in:
Edwin Kempin
2020-03-06 12:47:38 +01:00
parent 1f32629349
commit 7f3121bec4

View File

@@ -932,9 +932,17 @@ class ReceiveCommits {
updateGroups.forEach(r -> r.addOps(bu));
logger.atFine().log("Executing batch");
try {
bu.execute();
} catch (UpdateException e) {
retryHelper
.changeUpdate(
"insertChangesAndPatchSets",
() -> {
bu.execute();
return null;
})
.call();
} catch (Exception e) {
throw asRestApiException(e);
}