diff options
Diffstat (limited to 'config-model')
3 files changed, 40 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 8e2f3feb010..c2218cef684 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 @@ -79,6 +79,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea private boolean enableBitVectors = false; private boolean loadCodeAsHugePages = false; private boolean sharedStringRepoNoReclaim = false; + private boolean useTwoPhaseDocumentGc = false; private int mbus_java_num_targets = 1; private int mbus_java_events_before_wakeup = 1; private int mbus_cpp_num_targets = 1; @@ -149,6 +150,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea @Override public int rpcNumTargets() { return rpc_num_targets; } @Override public int rpcEventsBeforeWakeup() { return rpc_events_before_wakeup; } @Override public String queryDispatchPolicy() { return queryDispatchPolicy; } + @Override public boolean useTwoPhaseDocumentGc() { return useTwoPhaseDocumentGc; } public TestProperties sharedStringRepoNoReclaim(boolean sharedStringRepoNoReclaim) { @@ -413,6 +415,11 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea return this; } + public TestProperties setUseTwoPhaseDocumentGc(boolean useTwoPhase) { + this.useTwoPhaseDocumentGc = useTwoPhase; + return this; + } + public static class Spec implements ConfigServerSpec { private final String hostName; 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 b8d2a4f91fe..b8e27d92f8c 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 @@ -43,6 +43,7 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl private final boolean useThreePhaseUpdates; private final int maxActivationInhibitedOutOfSyncGroups; private final boolean unorderedMergeChaining; + private final boolean useTwoPhaseDocumentGc; public static class Builder extends VespaDomBuilder.DomConfigProducerBuilder<DistributorCluster> { @@ -106,11 +107,12 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl boolean useThreePhaseUpdates = deployState.getProperties().featureFlags().useThreePhaseUpdates(); int maxInhibitedGroups = deployState.getProperties().featureFlags().maxActivationInhibitedOutOfSyncGroups(); boolean unorderedMergeChaining = deployState.getProperties().featureFlags().unorderedMergeChaining(); + boolean useTwoPhaseDocumentGc = deployState.getProperties().featureFlags().useTwoPhaseDocumentGc(); return new DistributorCluster(parent, new BucketSplitting.Builder().build(new ModelElement(producerSpec)), gc, hasIndexedDocumentType, useThreePhaseUpdates, - maxInhibitedGroups, unorderedMergeChaining); + maxInhibitedGroups, unorderedMergeChaining, useTwoPhaseDocumentGc); } } @@ -118,7 +120,8 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl GcOptions gc, boolean hasIndexedDocumentType, boolean useThreePhaseUpdates, int maxActivationInhibitedOutOfSyncGroups, - boolean unorderedMergeChaining) + boolean unorderedMergeChaining, + boolean useTwoPhaseDocumentGc) { super(parent, "distributor"); this.parent = parent; @@ -128,6 +131,7 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl this.useThreePhaseUpdates = useThreePhaseUpdates; this.maxActivationInhibitedOutOfSyncGroups = maxActivationInhibitedOutOfSyncGroups; this.unorderedMergeChaining = unorderedMergeChaining; + this.useTwoPhaseDocumentGc = useTwoPhaseDocumentGc; } @Override @@ -142,6 +146,7 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl builder.enable_metadata_only_fetch_phase_for_inconsistent_updates(useThreePhaseUpdates); builder.max_activation_inhibited_out_of_sync_groups(maxActivationInhibitedOutOfSyncGroups); builder.use_unordered_merge_chaining(unorderedMergeChaining); + builder.enable_two_phase_garbage_collection(useTwoPhaseDocumentGc); 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 17ce43bba2c..ac291fc578f 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 @@ -1165,6 +1165,32 @@ public class ContentClusterTest extends ContentBaseTest { return (new StorDistributormanagerConfig(builder)).use_unordered_merge_chaining(); } + private boolean resolveTwoPhaseGcConfigWithFeatureFlag(Boolean flagEnableTwoPhase) { + var props = new TestProperties(); + if (flagEnableTwoPhase != null) { + props.setUseTwoPhaseDocumentGc(flagEnableTwoPhase); + } + VespaModel model = createEnd2EndOneNode(props); + + ContentCluster cc = model.getContentClusters().get("storage"); + var builder = new StorDistributormanagerConfig.Builder(); + cc.getDistributorNodes().getConfig(builder); + + return (new StorDistributormanagerConfig(builder)).enable_two_phase_garbage_collection(); + } + + @Test + public void two_phase_garbage_collection_config_is_controlled_by_properties() { + assertFalse(resolveTwoPhaseGcConfigWithFeatureFlag(false)); + assertTrue(resolveTwoPhaseGcConfigWithFeatureFlag(true)); + } + + // TODO change once gradual rollout complete + @Test + public void two_phase_garbage_collection_config_is_disabled_by_default() { + assertFalse(resolveTwoPhaseGcConfigWithFeatureFlag(null)); + } + @Test void testDedicatedClusterControllers() { VespaModel noContentModel = createEnd2EndOneNode(new TestProperties().setHostedVespa(true) |