diff options
Diffstat (limited to 'config-model')
3 files changed, 15 insertions, 4 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/GlobalDistributionValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/content/GlobalDistributionValidator.java index 72a2f41fb6e..684c9aeb225 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/GlobalDistributionValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/GlobalDistributionValidator.java @@ -32,9 +32,14 @@ public class GlobalDistributionValidator { private static void verifyGlobalDocumentsHaveRequiredRedundancy(Set<NewDocumentType> globallyDistributedDocuments, Redundancy redundancy) { if (!globallyDistributedDocuments.isEmpty() && !redundancy.isEffectivelyGloballyDistributed()) { - throw new IllegalArgumentException("The following document types are marked as global, " + - "but do not have high enough redundancy to make the documents globally distributed: " + - asPrintableString(toDocumentNameStream(globallyDistributedDocuments))); + throw new IllegalArgumentException( + String.format( + "The following document types are marked as global, " + + "but do not have high enough redundancy to make the documents globally distributed: %s. " + + "Redundancy is %d, expected %d.", + asPrintableString(toDocumentNameStream(globallyDistributedDocuments)), + redundancy.effectiveFinalRedundancy(), + redundancy.totalNodes())); } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/Redundancy.java b/config-model/src/main/java/com/yahoo/vespa/model/content/Redundancy.java index ecc41f5156b..f458bb54524 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/Redundancy.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/Redundancy.java @@ -46,6 +46,9 @@ public class Redundancy implements StorDistributionConfig.Producer, ProtonConfig public int initialRedundancy() { return initialRedundancy; } public int finalRedundancy() { return finalRedundancy; } public int readyCopies() { return readyCopies; } + public int totalNodes() { + return totalNodes; + } public int effectiveInitialRedundancy() { return Math.min(totalNodes, initialRedundancy * implicitGroups); } public int effectiveFinalRedundancy() { return Math.min(totalNodes, finalRedundancy * implicitGroups); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/GlobalDistributionValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/GlobalDistributionValidatorTest.java index 9d53e52e31e..4f980329e23 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/GlobalDistributionValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/GlobalDistributionValidatorTest.java @@ -33,11 +33,14 @@ public class GlobalDistributionValidatorTest { .collect(toMap(identity(), name -> new NewDocumentType(new NewDocumentType.Name(name)))); HashSet<NewDocumentType> globallyDistributedDocuments = new HashSet<>(documentTypes.values()); Redundancy redundancy = createRedundancyWithGlobalDistributionValue(false); + when(redundancy.effectiveFinalRedundancy()).thenReturn(1); + when(redundancy.totalNodes()).thenReturn(2); exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage( "The following document types are marked as global, " + - "but do not have high enough redundancy to make the documents globally distributed: 'bar', 'foo'"); + "but do not have high enough redundancy to make the documents globally distributed: " + + "'bar', 'foo'. Redundancy is 1, expected 2."); new GlobalDistributionValidator() .validate(documentTypes, globallyDistributedDocuments, redundancy); } |