diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-08-24 15:17:08 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2022-08-24 15:17:08 +0000 |
commit | d546929a5e4dabaac53717d45dd2bb5c818429a4 (patch) | |
tree | 125dc5075f93399b6b46560834d6b7c9745d4095 /config-model | |
parent | 26d0b997cc573bac2a1d7eda7a2494449452e121 (diff) |
Add 'paged' support for reference attribute fields.
The memory usage of a reference attribute can be calculated as follows:
num_child_docs * 8 + num_parent_docs * 24 + num_child_docs_where_parent_reference_is_set * 4.
When using 'paged' the btrees used in the reverse mapping from parent lid to child lids are still memory allocated.
This is the num_child_docs_where_parent_reference_is_set part of the equation above.
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/processing/PagedAttributeValidator.java | 1 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java | 14 |
2 files changed, 10 insertions, 5 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/processing/PagedAttributeValidator.java b/config-model/src/main/java/com/yahoo/schema/processing/PagedAttributeValidator.java index 34bb6e1db2e..793505acd01 100644 --- a/config-model/src/main/java/com/yahoo/schema/processing/PagedAttributeValidator.java +++ b/config-model/src/main/java/com/yahoo/schema/processing/PagedAttributeValidator.java @@ -48,7 +48,6 @@ public class PagedAttributeValidator extends Processor { private boolean isSupportedType(Attribute attribute) { var type = attribute.getType(); return (type != Attribute.Type.PREDICATE) && - (type != Attribute.Type.REFERENCE) && (isSupportedTensorType(attribute.tensorType())); } diff --git a/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java index 2a3a3ff93e9..719db2ffdcc 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java @@ -59,8 +59,14 @@ public class PagedAttributeValidatorTestCase { } private void assertPagedSupported(String fieldType) throws ParseException { - var appBuilder = createFromString(getSd(fieldType)); - var attribute = appBuilder.getSchema().getAttribute("foo"); + assertPagedSupported(fieldType, Optional.empty()); + } + + private void assertPagedSupported(String fieldType, Optional<String> parentSd) throws ParseException { + var appBuilder = parentSd.isPresent() ? + createFromStrings(new BaseDeployLogger(), parentSd.get(), getSd(fieldType)) : + createFromString(getSd(fieldType)); + var attribute = appBuilder.getSchema("test").getAttribute("foo"); assertTrue(attribute.isPaged()); } @@ -75,8 +81,8 @@ public class PagedAttributeValidatorTestCase { } @Test - void reference_attribute_does_not_support_paged_setting() throws ParseException { - assertPagedSettingNotSupported("reference<parent>", Optional.of(getSd("parent", "int"))); + void reference_attribute_support_paged_setting() throws ParseException { + assertPagedSupported("reference<parent>", Optional.of(getSd("parent", "int"))); } private void assertPagedSettingNotSupported(String fieldType) throws ParseException { |