Skip to content

Commit

Permalink
Merge pull request #32416 from vespa-engine/revert-32412-hmusum/valid…
Browse files Browse the repository at this point in the history
…ate-redundancy-using-effective-final-redundancy

Revert "Change how we validate redundancy changes"
  • Loading branch information
Harald Musum authored Sep 17, 2024
2 parents a9c942f + a3dd519 commit c8c4570
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 "<services version='1.0'>" +
" <content id='contentClusterId' version='1.0'>" +
" <redundancy>" + redundancy + "</redundancy>" +
Expand All @@ -59,7 +51,7 @@ private static String getServices(int redundancy, int nodes, int groups) {
" <documents>" +
" <document type='music' mode='index'/>" +
" </documents>" +
" <nodes count='" + nodes + "' groups='" + groups + "'/>" +
" <nodes count='3'/>" +
" </content>" +
"</services>";
}
Expand Down

0 comments on commit c8c4570

Please sign in to comment.