aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2022-01-17 08:39:00 +0100
committerGitHub <noreply@github.com>2022-01-17 08:39:00 +0100
commit111335bbcb3b88e94952383e52ba53da592f43d0 (patch)
tree20e6ff01ac51f3104510f12118dccafb73c92dc4
parentc318c148a4d347128d931b8e53f99161cd840030 (diff)
parent4516555a4cb1a533f8bb6627628cc414a33e3650 (diff)
Merge pull request #20821 from vespa-engine/handle-new-components-configs-out-of-syncv7.529.2
Handle new components configs out of sync [run-systemtest]
-rw-r--r--container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java b/container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java
index c90f05e2227..0817a87c506 100644
--- a/container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java
+++ b/container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java
@@ -70,12 +70,6 @@ public final class ConfigRetriever {
allKeys.addAll(bootstrapKeys);
setupComponentSubscriber(allKeys);
- var maybeSnapshot = getConfigsOptional(leastGeneration, isInitializing);
- log.log(FINE, () -> "getConfigsOnce returning " + maybeSnapshot);
- return maybeSnapshot;
- }
-
- private Optional<ConfigSnapshot> getConfigsOptional(long leastGeneration, boolean isInitializing) {
if (componentSubscriber.generation() < bootstrapSubscriber.generation()) {
return getComponentsSnapshot(leastGeneration, isInitializing);
}
@@ -87,7 +81,21 @@ public final class ConfigRetriever {
if (newestBootstrapGeneration < leastGeneration) {
return Optional.empty();
}
- return bootstrapConfigIfChanged();
+ return bootstrapConfigIfChanged()
+ // At this point, we normally assume that the bootstrap subscriber is one generation ahead
+ // of the component subscriber, but this is not always the case in practice.
+ .or(this::componentsSnapshotReceivedBeforeBootstrap);
+ }
+
+ private Optional<ConfigSnapshot> componentsSnapshotReceivedBeforeBootstrap() {
+ if (componentSubscriber.generation() == bootstrapSubscriber.generation()) {
+ // The component subscriber originally had a newer config generation than the bootstrap subscriber.
+ // Ensure that this generation is applied if it contains changed configs.
+ // The root cause is probably that the component subscriber skipped a generation and got
+ // one ahead of the bootstrap subscriber.
+ return componentsConfigIfChanged();
+ }
+ return Optional.empty();
}
private Optional<ConfigSnapshot> getComponentsSnapshot(long leastGeneration, boolean isInitializing) {