diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2023-05-10 15:44:45 +0200 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2023-05-10 15:44:45 +0200 |
commit | 2ad5edd01b4eea8aa961413d10d3777012adc53e (patch) | |
tree | 834173b4604ee3ef565af79d42e80e3e16418827 /config-model | |
parent | 2d11f545108d46dc6ae2aff098892f5462f2cefc (diff) |
Add feature flag for enabling conditional put/remove write repair
This maps to controlling the distributed condition probe feature
of the content layer, which in turn controls whether a conditional
put/remove to an inconsistent bucket triggers a write repair step
on the distributor.
Diffstat (limited to 'config-model')
3 files changed, 26 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 540905bef4c..56f999f85b4 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 @@ -84,6 +84,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea private Optional<CloudAccount> cloudAccount = Optional.empty(); private boolean allowUserFilters = true; private boolean allowMoreThanOneContentGroupDown = false; + private boolean enableConditionalPutRemoveWriteRepair = false; @Override public ModelContext.FeatureFlags featureFlags() { return this; } @Override public boolean multitenant() { return multitenant; } @@ -142,6 +143,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea @Override public boolean allowUserFilters() { return allowUserFilters; } @Override public boolean enableGlobalPhase() { return true; } // Enable global-phase by default for unit tests only @Override public boolean allowMoreThanOneContentGroupDown(ClusterSpec.Id id) { return allowMoreThanOneContentGroupDown; } + @Override public boolean enableConditionalPutRemoveWriteRepair() { return enableConditionalPutRemoveWriteRepair; } public TestProperties sharedStringRepoNoReclaim(boolean sharedStringRepoNoReclaim) { this.sharedStringRepoNoReclaim = sharedStringRepoNoReclaim; @@ -375,6 +377,11 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea return this; } + public TestProperties setEnableConditionalPutRemoveWriteRepair(boolean enable) { + this.enableConditionalPutRemoveWriteRepair = enable; + return this; + } + public TestProperties setAllowUserFilters(boolean b) { this.allowUserFilters = b; return this; } public static class Spec implements ConfigServerSpec { 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 d73f1618dbc..4aac8bfb647 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 @@ -33,6 +33,7 @@ public class DistributorCluster extends TreeConfigProducer<Distributor> implemen private final GcOptions gc; private final boolean hasIndexedDocumentType; private final int maxActivationInhibitedOutOfSyncGroups; + private final boolean enableConditionalPutRemoveWriteRepair; public static class Builder extends VespaDomBuilder.DomConfigProducerBuilderBase<DistributorCluster> { ContentCluster parent; @@ -93,17 +94,20 @@ public class DistributorCluster extends TreeConfigProducer<Distributor> implemen final GcOptions gc = parseGcOptions(documentsNode); final boolean hasIndexedDocumentType = clusterContainsIndexedDocumentType(documentsNode); int maxInhibitedGroups = deployState.getProperties().featureFlags().maxActivationInhibitedOutOfSyncGroups(); + boolean enableConditionalPutRemoveWriteRepair = deployState.getProperties().featureFlags().enableConditionalPutRemoveWriteRepair(); return new DistributorCluster(parent, new BucketSplitting.Builder().build(new ModelElement(producerSpec)), gc, hasIndexedDocumentType, - maxInhibitedGroups); + maxInhibitedGroups, + enableConditionalPutRemoveWriteRepair); } } private DistributorCluster(ContentCluster parent, BucketSplitting bucketSplitting, GcOptions gc, boolean hasIndexedDocumentType, - int maxActivationInhibitedOutOfSyncGroups) + int maxActivationInhibitedOutOfSyncGroups, + boolean enableConditionalPutRemoveWriteRepair) { super(parent, "distributor"); this.parent = parent; @@ -111,6 +115,7 @@ public class DistributorCluster extends TreeConfigProducer<Distributor> implemen this.gc = gc; this.hasIndexedDocumentType = hasIndexedDocumentType; this.maxActivationInhibitedOutOfSyncGroups = maxActivationInhibitedOutOfSyncGroups; + this.enableConditionalPutRemoveWriteRepair = enableConditionalPutRemoveWriteRepair; } @Override @@ -123,6 +128,7 @@ public class DistributorCluster extends TreeConfigProducer<Distributor> implemen builder.enable_revert(parent.getPersistence().supportRevert()); builder.disable_bucket_activation(!hasIndexedDocumentType); builder.max_activation_inhibited_out_of_sync_groups(maxActivationInhibitedOutOfSyncGroups); + builder.enable_condition_probing(enableConditionalPutRemoveWriteRepair); 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 71dd3223da2..14fe7bbcc36 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 @@ -1240,6 +1240,17 @@ public class ContentClusterTest extends ContentBaseTest { assertEquals(2, resolveMaxInhibitedGroupsConfigWithFeatureFlag(2)); } + private boolean resolveConditionProbingFromWriteRepairFeatureFlag(boolean enable) throws Exception { + var cfg = resolveStorDistributormanagerConfig(new TestProperties().setEnableConditionalPutRemoveWriteRepair(enable)); + return cfg.enable_condition_probing(); + } + + @Test + void distributor_condition_probing_is_controlled_by_write_repair_feature_flag() throws Exception { + assertFalse(resolveConditionProbingFromWriteRepairFeatureFlag(false)); + assertTrue(resolveConditionProbingFromWriteRepairFeatureFlag(true)); + } + private int resolveNumDistributorStripesConfig(Optional<Flavor> flavor) throws Exception { var cc = createOneNodeCluster(new TestProperties(), flavor); var builder = new StorDistributormanagerConfig.Builder(); |