summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fick <martin.fick@linaro.org>2022-10-13 16:35:15 -0600
committerMartin Fick <martin.fick@linaro.org>2022-10-13 17:03:35 -0600
commit6b523d6b6bf6d77f979a2c6d4a4830f819b466d4 (patch)
treea77e7048e2f87529f92fe1a91fc441b28489ff54
parent20f1c213bc2c56bddce03cf8d4b0b63bd609fc20 (diff)
Demote Files.list() errors when distributor is enabled
Since Files.list() errors for the 'waiting' and 'running' dirs is common and normal when running with a multi-primary setup, demote them to "atFine()" level when the distributor is enabled. This avoids making the logs extrememly noisy during normal multi-primary operation. Change-Id: Iefc96fb79754dad9201afbc194d85194ef257198
-rw-r--r--src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java10
1 files changed, 8 insertions, 2 deletions
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 5c7f887..b06c99f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
@@ -189,13 +189,19 @@ public class ReplicationTasksStorage {
.map(Optional::get);
}
- private static Stream<Path> walkNonDirs(Path path) {
+ private Stream<Path> walkNonDirs(Path path) {
try {
return Files.list(path).flatMap(sub -> walkNonDirs(sub));
} catch (NotDirectoryException e) {
return Stream.of(path);
} catch (Exception e) {
- logger.atSevere().withCause(e).log("Error while walking directory %s", path);
+ String message = "Error while walking directory %s";
+ if (isMultiPrimary() && e instanceof NoSuchFileException) {
+ logger.atFine().log(
+ message + " (expected regularly with multi-primaries and distributor enabled)", path);
+ } else {
+ logger.atSevere().withCause(e).log(message, path);
+ }
return Stream.empty();
}
}