diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2020-04-29 15:59:22 +0200 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2020-04-29 16:08:39 +0200 |
commit | c34088ef421acf52cbef5e6835fcbecabd318f77 (patch) | |
tree | 027c9605d17c0efe6a0502820a9188f68c7127d6 /config-model | |
parent | 9499865f8a43aa097841606795a2bea8d0273ef9 (diff) |
Add feature flag for enabling three phase updates
Diffstat (limited to 'config-model')
3 files changed, 29 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java index 475b69c93c2..24cf892c49a 100644 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java +++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java @@ -42,6 +42,7 @@ public class TestProperties implements ModelContext.Properties { private boolean useAdaptiveDispatch = false; private double topKProbability = 1.0; private boolean useDistributorBtreeDb = false; + private boolean useThreePhaseUpdates = false; private double defaultTermwiseLimit = 1.0; private double softStartSeconds = 0.0; private double threadPoolSizeFactor = 0.0; @@ -84,6 +85,7 @@ public class TestProperties implements ModelContext.Properties { @Override public double defaultTopKProbability() { return topKProbability; } @Override public boolean useDistributorBtreeDb() { return useDistributorBtreeDb; } + @Override public boolean useThreePhaseUpdates() { return useThreePhaseUpdates; } @Override public boolean useBucketSpaceMetric() { return true; } @Override public Optional<AthenzDomain> athenzDomain() { return Optional.ofNullable(athenzDomain); } @@ -102,6 +104,11 @@ public class TestProperties implements ModelContext.Properties { return this; } + public TestProperties setUseThreePhaseUpdates(boolean useThreePhaseUpdates) { + this.useThreePhaseUpdates = useThreePhaseUpdates; + return this; + } + public TestProperties setSoftStartSeconds(double softStartSeconds) { this.softStartSeconds = softStartSeconds; return this; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java index 42d20b675a6..0b6b7154a62 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java @@ -42,6 +42,7 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl private final GcOptions gc; private final boolean hasIndexedDocumentType; private final boolean useBtreeDatabase; + private final boolean useThreePhaseUpdates; public static class Builder extends VespaDomBuilder.DomConfigProducerBuilder<DistributorCluster> { @@ -103,16 +104,17 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl final GcOptions gc = parseGcOptions(documentsNode); final boolean hasIndexedDocumentType = clusterContainsIndexedDocumentType(documentsNode); boolean useBtreeDb = deployState.getProperties().useDistributorBtreeDb(); + boolean useThreePhaseUpdates = deployState.getProperties().useThreePhaseUpdates(); return new DistributorCluster(parent, new BucketSplitting.Builder().build(new ModelElement(producerSpec)), gc, - hasIndexedDocumentType, useBtreeDb); + hasIndexedDocumentType, useBtreeDb, useThreePhaseUpdates); } } private DistributorCluster(ContentCluster parent, BucketSplitting bucketSplitting, GcOptions gc, boolean hasIndexedDocumentType, - boolean useBtreeDatabase) + boolean useBtreeDatabase, boolean useThreePhaseUpdates) { super(parent, "distributor"); this.parent = parent; @@ -120,6 +122,7 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl this.gc = gc; this.hasIndexedDocumentType = hasIndexedDocumentType; this.useBtreeDatabase = useBtreeDatabase; + this.useThreePhaseUpdates = useThreePhaseUpdates; } @Override @@ -132,6 +135,7 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl builder.enable_revert(parent.getPersistence().supportRevert()); builder.disable_bucket_activation(hasIndexedDocumentType == false); builder.use_btree_database(useBtreeDatabase); + builder.enable_metadata_only_fetch_phase_for_inconsistent_updates(useThreePhaseUpdates); bucketSplitting.getConfig(builder); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java index 0e8bd0a41f1..802082cc2ff 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java @@ -988,4 +988,20 @@ public class ContentClusterTest extends ContentBaseTest { assertTrue(resolveDistributorBtreeDbConfigWithFeatureFlag(true)); } + private boolean resolveThreePhaseUpdateConfigWithFeatureFlag(boolean flagEnableThreePhase) { + VespaModel model = createEnd2EndOneNode(new TestProperties().setUseThreePhaseUpdates(flagEnableThreePhase)); + + ContentCluster cc = model.getContentClusters().get("storage"); + var builder = new StorDistributormanagerConfig.Builder(); + cc.getDistributorNodes().getConfig(builder); + + return (new StorDistributormanagerConfig(builder)).enable_metadata_only_fetch_phase_for_inconsistent_updates(); + } + + @Test + public void default_distributor_three_phase_update_config_controlled_by_properties() { + assertFalse(resolveThreePhaseUpdateConfigWithFeatureFlag(false)); + assertTrue(resolveThreePhaseUpdateConfigWithFeatureFlag(true)); + } + } |