Demote delete errors when distributor is enabled

Since delete errors for Tasks is expected after recovery (when another
nodes starts up) when running with a multi-primary setup, demote them to
"atFine()" level when the distributor is enabled. This avoids errors in
the logs during normal multi-primary operation.

Release-Notes: Reduced log level for Task deletion errors in MP setups
Change-Id: Iccca2e1bd2b91b91e12a14c4e473c8a6df6fd4b7
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
index b06c99f..0d5604c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
@@ -272,7 +272,14 @@
         logger.atFine().log("DELETE %s %s", running, updateLog());
         Files.delete(running);
       } catch (IOException e) {
-        logger.atSevere().withCause(e).log("Error while deleting task %s", taskKey);
+        String message = "Error while deleting task %s";
+        if (isMultiPrimary() && e instanceof NoSuchFileException) {
+          logger.atFine().log(
+              message + " (expected after recovery from another node's startup with multi-primaries and distributor enabled)",
+              taskKey);
+        } else {
+          logger.atSevere().withCause(e).log(message, taskKey);
+        }
       }
     }