Skip to content

Commit

Permalink
Feature flag GRPC_ENABLE_SETTING
Browse files Browse the repository at this point in the history
Signed-off-by: Finn Carroll <[email protected]>
  • Loading branch information
finnegancarroll committed Oct 31, 2024
1 parent b1b4f25 commit 0d9e606
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ public class FeatureFlags {
Property.NodeScope
);

/**
* Gates the functionality of the Netty4 gRPC server.
*/
public static final String GRPC_EXPERIMENTAL = "opensearch.experimental.feature.grpc.enabled";
public static final Setting<Boolean> GRPC_ENABLE_SETTING = Setting.boolSetting(
GRPC_EXPERIMENTAL,
false,
Property.NodeScope
);

private static final List<Setting<Boolean>> ALL_FEATURE_FLAG_SETTINGS = List.of(
REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING,
EXTENSIONS_SETTING,
Expand All @@ -138,7 +148,8 @@ public class FeatureFlags {
STAR_TREE_INDEX_SETTING,
APPLICATION_BASED_CONFIGURATION_TEMPLATES_SETTING,
READER_WRITER_SPLIT_EXPERIMENTAL_SETTING,
TERM_VERSION_PRECOMMIT_ENABLE_SETTING
TERM_VERSION_PRECOMMIT_ENABLE_SETTING,
GRPC_ENABLE_SETTING
);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ public GrpcStats stats() {
// gRPC service definitions provided at bind
abstract protected TransportAddress bindAddress(InetAddress hostAddress, PortsRange portRange);

// TODO: IDENTICAL TO - HTTP SERVER TRANSPORT
protected void bindServer() {
InetAddress hostAddresses[];
InetAddress[] hostAddresses;
try {
hostAddresses = networkService.resolveBindHostAddresses(bindHosts);
} catch (IOException e) {
Expand Down
13 changes: 9 additions & 4 deletions server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@

import static java.util.stream.Collectors.toList;
import static org.opensearch.common.util.FeatureFlags.BACKGROUND_TASK_EXECUTION_EXPERIMENTAL;
import static org.opensearch.common.util.FeatureFlags.GRPC_ENABLE_SETTING;
import static org.opensearch.common.util.FeatureFlags.TELEMETRY;
import static org.opensearch.common.util.FeatureFlags.initializeFeatureFlags;
import static org.opensearch.env.NodeEnvironment.collectFileCacheDataPath;
import static org.opensearch.index.ShardIndexingPressureSettings.SHARD_INDEXING_PRESSURE_ENABLED_ATTRIBUTE_KEY;
import static org.opensearch.indices.RemoteStoreSettings.CLUSTER_REMOTE_STORE_PINNED_TIMESTAMP_ENABLED;
Expand Down Expand Up @@ -1753,16 +1755,19 @@ public void onTimeout(TimeValue timeout) {

injector.getInstance(HttpServerTransport.class).start();

// TODO: FEATURE FLAG HERE?
injector.getInstance(GrpcServerTransport.class).start();
if (FeatureFlags.isEnabled(GRPC_ENABLE_SETTING)) {
injector.getInstance(GrpcServerTransport.class).start();
}

if (WRITE_PORTS_FILE_SETTING.get(settings())) {
TransportService transport = injector.getInstance(TransportService.class);
writePortsFile("transport", transport.boundAddress());
HttpServerTransport http = injector.getInstance(HttpServerTransport.class);
writePortsFile("http", http.boundAddress());
GrpcServerTransport grpc = injector.getInstance(GrpcServerTransport.class);
writePortsFile("grpc", grpc.boundAddress());
if (FeatureFlags.isEnabled(GRPC_ENABLE_SETTING)) {
GrpcServerTransport grpc = injector.getInstance(GrpcServerTransport.class);
writePortsFile("grpc", grpc.boundAddress());
}
}

logger.info("started");
Expand Down

0 comments on commit 0d9e606

Please sign in to comment.