Fix concurrent pushes to the same target URI When performing the refactoring of stripe locks, the runway request was overlooked and completely ignored, leading to all tasks being allowed to be executed concurrently with existing pushes on the runway. The issue has created significant overload on the replication plugin for high-load repositories, where the rate of replication events scheduled is higher than the push time. Bug: Issue 428670066 Release-Notes: Fix the prevention of concurrent PushOps the same target URI when using multiple threads Change-Id: I6863944e997e3541186dfc13cab0d7add29b7805
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java index d535934..41a9a49 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
@@ -672,7 +672,7 @@ } RunwayStatus requestRunway(PushOne op) { - stateLock.withWriteLock( + return stateLock.withWriteLock( op.getURI(), () -> { if (op.wasCanceled()) { @@ -685,9 +685,8 @@ } op.notifyNotAttempted(op.setStartedRefs(replicationTasksStorage.get().start(op))); queue.inFlight.put(op.getURI(), op); - return null; + return RunwayStatus.allowed(); }); - return RunwayStatus.allowed(); } void notifyFinished(PushOne op) {