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 /config-model | |
parent | 77e3fa9d8df495f48fa282e4f82f26743c8078de (diff) |
Add feature flag to use direct RPC for Storage API communication between distributor and content node.
Diffstat (limited to 'config-model')
3 files changed, 38 insertions, 0 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 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); + } + } |