diff options
author | Geir Storli <geirst@verizonmedia.com> | 2020-09-14 11:41:25 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2020-09-14 13:22:15 +0000 |
commit | 0817a6890194989a2f243e54d671252bee2f8920 (patch) | |
tree | c2a76c26c61ec9d26d0f1567cdff70a7df5ba28f | |
parent | 77e3fa9d8df495f48fa282e4f82f26743c8078de (diff) |
Add feature flag to use direct RPC for Storage API communication between distributor and content node.
6 files changed, 55 insertions, 0 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java index 7d0228721aa..756961933db 100644 --- a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java @@ -89,6 +89,9 @@ public interface ModelContext { boolean useThreePhaseUpdates(); + // TODO Remove on 7.XXX when this is default on. + boolean useDirectStorageApiRpc(); + default String proxyProtocol() { return "https+proxy-protocol"; } // TODO bjorncs: Remove after end of May default Optional<AthenzDomain> athenzDomain() { return Optional.empty(); } 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 fc799449379..22bdf31350a 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 @@ -37,6 +37,7 @@ public class TestProperties implements ModelContext.Properties { private boolean useDedicatedNodeForLogserver = false; private boolean useContentNodeBtreeDb = false; private boolean useThreePhaseUpdates = false; + private boolean useDirectStorageApiRpc = false; private double defaultTermwiseLimit = 1.0; private double threadPoolSizeFactor = 0.0; private double queueSizeFactor = 0.0; @@ -73,6 +74,7 @@ public class TestProperties implements ModelContext.Properties { } @Override public boolean useContentNodeBtreeDb() { return useContentNodeBtreeDb; } @Override public boolean useThreePhaseUpdates() { return useThreePhaseUpdates; } + @Override public boolean useDirectStorageApiRpc() { return useDirectStorageApiRpc; } @Override public Optional<AthenzDomain> athenzDomain() { return Optional.ofNullable(athenzDomain); } @Override public Optional<ApplicationRoles> applicationRoles() { return Optional.ofNullable(applicationRoles); } @Override public String responseSequencerType() { return responseSequencerType; } @@ -113,6 +115,11 @@ public class TestProperties implements ModelContext.Properties { return this; } + public TestProperties setUseDirectStorageApiRpc(boolean useDirectStorageApiRpc) { + this.useDirectStorageApiRpc = useDirectStorageApiRpc; + return this; + } + public TestProperties setThreadPoolSizeFactor(double threadPoolSizeFactor) { this.threadPoolSizeFactor = threadPoolSizeFactor; return this; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentNode.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentNode.java index f2e90ae2859..34b6dd017cf 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentNode.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentNode.java @@ -27,6 +27,7 @@ public abstract class ContentNode extends AbstractService private final boolean skipCommunicationManagerThread; private final boolean skipMbusRequestThread; private final boolean skipMbusReplyThread; + private final boolean useDirectStorageApiRpc; public ContentNode(ModelContext.Properties properties, AbstractConfigProducer parent, String clusterName, String rootDirectory, int distributionKey) { super(parent, "" + distributionKey); @@ -35,6 +36,7 @@ public abstract class ContentNode extends AbstractService this.skipMbusRequestThread = properties.skipMbusRequestThread(); this.skipMbusReplyThread = properties.skipMbusReplyThread(); this.rootDirectory = rootDirectory; + this.useDirectStorageApiRpc = properties.useDirectStorageApiRpc(); initialize(); setProp("clustertype", "content"); @@ -81,6 +83,7 @@ public abstract class ContentNode extends AbstractService builder.skip_thread(skipCommunicationManagerThread); builder.mbus.skip_request_thread(skipMbusRequestThread); builder.mbus.skip_reply_thread(skipMbusReplyThread); + builder.use_direct_storageapi_rpc(useDirectStorageApiRpc); } @Override 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 27c88ad2d1f..61f5ec56bb4 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 @@ -16,6 +16,7 @@ import com.yahoo.vespa.config.content.AllClustersBucketSpacesConfig; import com.yahoo.vespa.config.content.FleetcontrollerConfig; import com.yahoo.vespa.config.content.StorDistributionConfig; import com.yahoo.vespa.config.content.StorFilestorConfig; +import com.yahoo.vespa.config.content.core.StorCommunicationmanagerConfig; import com.yahoo.vespa.config.content.core.StorDistributormanagerConfig; import com.yahoo.vespa.config.content.core.StorServerConfig; import com.yahoo.vespa.config.search.DispatchConfig; @@ -980,4 +981,31 @@ public class ContentClusterTest extends ContentBaseTest { assertTrue(resolveThreePhaseUpdateConfigWithFeatureFlag(true)); } + void assertDirectStorageApiRpcConfig(boolean expUseDirectStorageApiRpc, ContentNode node) { + var builder = new StorCommunicationmanagerConfig.Builder(); + node.getConfig(builder); + var config = new StorCommunicationmanagerConfig(builder); + assertEquals(expUseDirectStorageApiRpc, config.use_direct_storageapi_rpc()); + } + + void assertDirectStorageApiRpcFlagIsPropagatedToConfig(boolean useDirectStorageApiRpc) { + VespaModel model = createEnd2EndOneNode(new TestProperties().setUseDirectStorageApiRpc(useDirectStorageApiRpc)); + + ContentCluster cc = model.getContentClusters().get("storage"); + assertFalse(cc.getDistributorNodes().getChildren().isEmpty()); + for (Distributor d : cc.getDistributorNodes().getChildren().values()) { + assertDirectStorageApiRpcConfig(useDirectStorageApiRpc, d); + } + assertFalse(cc.getStorageNodes().getChildren().isEmpty()); + for (StorageNode node : cc.getStorageNodes().getChildren().values()) { + assertDirectStorageApiRpcConfig(useDirectStorageApiRpc, node); + } + } + + @Test + public void use_direct_storage_api_rpc_config_is_controlled_by_properties() { + assertDirectStorageApiRpcFlagIsPropagatedToConfig(false); + assertDirectStorageApiRpcFlagIsPropagatedToConfig(true); + } + } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java index 3d4198c65a9..87b0ed965d3 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java @@ -149,6 +149,7 @@ public class ModelContextImpl implements ModelContext { private final boolean isFirstTimeDeployment; private final boolean useContentNodeBtreeDb; private final boolean useThreePhaseUpdates; + private final boolean useDirectStorageApiRpc; private final Optional<EndpointCertificateSecrets> endpointCertificateSecrets; private final double defaultTermwiseLimit; private final double threadPoolSizeFactor; @@ -199,6 +200,8 @@ public class ModelContextImpl implements ModelContext { .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); useThreePhaseUpdates = Flags.USE_THREE_PHASE_UPDATES.bindTo(flagSource) .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); + useDirectStorageApiRpc = Flags.USE_DIRECT_STORAGE_API_RPC.bindTo(flagSource) + .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); threadPoolSizeFactor = Flags.DEFAULT_THREADPOOL_SIZE_FACTOR.bindTo(flagSource) .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); queueSizefactor = Flags.DEFAULT_QUEUE_SIZE_FACTOR.bindTo(flagSource) @@ -288,6 +291,11 @@ public class ModelContextImpl implements ModelContext { } @Override + public boolean useDirectStorageApiRpc() { + return useDirectStorageApiRpc; + } + + @Override public Optional<AthenzDomain> athenzDomain() { return athenzDomain; } @Override diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index 0da68f576b6..7863289e708 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -196,6 +196,12 @@ public class Flags { "Takes effect at redeployment", ZONE_ID, APPLICATION_ID); + public static final UnboundBooleanFlag USE_DIRECT_STORAGE_API_RPC = defineFeatureFlag( + "use-direct-storage-api-rpc", false, + "Whether to use direct RPC for Storage API communication between content cluster nodes.", + "Takes effect at restart of distributor and content node process", + ZONE_ID, APPLICATION_ID); + public static final UnboundBooleanFlag HOST_HARDENING = defineFeatureFlag( "host-hardening", false, "Whether to enable host hardening Linux baseline.", |