From 0e3d87ab54bbc63719df8b7e35cb6a6631c66edd Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Tue, 14 Jul 2020 12:16:42 +0200 Subject: [PATCH] Add Assertions on CS Application in Snapshot Logic (#58681) (#59511) Relates to #58680. Bugs like that should not only show up in logs but ideally also get caught in tests. We expect to never see exceptions in these two spots. --- .../java/org/elasticsearch/repositories/RepositoriesService.java | 1 + .../java/org/elasticsearch/snapshots/SnapshotShardsService.java | 1 + 2 files changed, 2 insertions(+) diff --git a/server/src/main/java/org/elasticsearch/repositories/RepositoriesService.java b/server/src/main/java/org/elasticsearch/repositories/RepositoriesService.java index 2f1583c6095..3ee39f53f42 100644 --- a/server/src/main/java/org/elasticsearch/repositories/RepositoriesService.java +++ b/server/src/main/java/org/elasticsearch/repositories/RepositoriesService.java @@ -355,6 +355,7 @@ public class RepositoriesService extends AbstractLifecycleComponent implements C } repositories = Collections.unmodifiableMap(builder); } catch (Exception ex) { + assert false : new AssertionError(ex); logger.warn("failure updating cluster state ", ex); } } diff --git a/server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java b/server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java index ae58101949e..84375f0f51c 100644 --- a/server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java +++ b/server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java @@ -137,6 +137,7 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements } } catch (Exception e) { + assert false : new AssertionError(e); logger.warn("Failed to update snapshot state ", e); } }