From a3dd5191c80ff1f79edc99d2e8eddc5f5c46a898 Mon Sep 17 00:00:00 2001 From: Arnstein Ressem Date: Tue, 17 Sep 2024 18:32:25 +0200 Subject: [PATCH] Revert "Change how we validate redundancy changes" --- .../change/RedundancyIncreaseValidator.java | 4 +++- .../RedundancyIncreaseValidatorTest.java | 20 ++++++------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidator.java index 2b30e1a337d8..3fc3eafcc985 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidator.java @@ -29,6 +29,8 @@ public void validate(ChangeContext context) { } } - private int redundancyOf(ContentCluster cluster) { return cluster.getRedundancy().effectiveFinalRedundancy(); } + private int redundancyOf(ContentCluster cluster) { + return cluster.getRedundancy().finalRedundancy(); + } } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java index ef94f04748f2..c2421e32a7f5 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java @@ -21,9 +21,9 @@ public class RedundancyIncreaseValidatorTest { @Test void testRedundancyIncreaseValidation() { - VespaModel previous = tester.deploy(null, getServices(2, 3, 1), Environment.prod, null, "contentClusterId.indexing").getFirst(); + VespaModel previous = tester.deploy(null, getServices(2), Environment.prod, null, "contentClusterId.indexing").getFirst(); try { - tester.deploy(previous, getServices(3, 3, 1), Environment.prod, null, "contentClusterId.indexing"); + tester.deploy(previous, getServices(3), Environment.prod, null, "contentClusterId.indexing"); fail("Expected exception due to redundancy increase"); } catch (IllegalArgumentException expected) { @@ -35,21 +35,13 @@ void testRedundancyIncreaseValidation() { } } - @Test - void testRedundancyIncreaseValidationWithGroups() { - // Changing redundancy from 1 to 2 is allowed when having 2 nodes in 2 groups versus 3 nodes in 1 group - // (effective redundancy for the cluster is 2 in both cases) - VespaModel previous = tester.deploy(null, getServices(1, 2, 2), Environment.prod, null, "contentClusterId.indexing").getFirst(); - tester.deploy(previous, getServices(2, 3, 1), Environment.prod, null, "contentClusterId.indexing"); - } - @Test void testOverridingContentRemovalValidation() { - VespaModel previous = tester.deploy(null, getServices(2, 3, 1), Environment.prod, null, "contentClusterId.indexing").getFirst(); - tester.deploy(previous, getServices(3, 3, 1), Environment.prod, redundancyIncreaseOverride, "contentClusterId.indexing"); // Allowed due to override + VespaModel previous = tester.deploy(null, getServices(2), Environment.prod, null, "contentClusterId.indexing").getFirst(); + tester.deploy(previous, getServices(3), Environment.prod, redundancyIncreaseOverride, "contentClusterId.indexing"); // Allowed due to override } - private static String getServices(int redundancy, int nodes, int groups) { + private static String getServices(int redundancy) { return "" + " " + " " + redundancy + "" + @@ -59,7 +51,7 @@ private static String getServices(int redundancy, int nodes, int groups) { " " + " " + " " + - " " + + " " + " " + ""; }