Skip to content

Commit 3ede3a2

Browse files
committed
Refactor; gradle check fixes
Signed-off-by: Rishabh Maurya <[email protected]>
1 parent be5e3f9 commit 3ede3a2

35 files changed

+364
-973
lines changed

plugins/arrow-flight-rpc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ apply plugin: 'opensearch.internal-cluster-test'
1414
opensearchplugin {
1515
description = 'Arrow flight based transport and stream implementation. It also provides Arrow vector and memory dependencies as' +
1616
'an extended-plugin at runtime; consumers should take a compile time dependency and not runtime on this project.\'\n'
17-
classname = 'org.opensearch.arrow.flight.bootstrap.FlightStreamPlugin'
17+
classname = 'org.opensearch.arrow.flight.transport.FlightStreamPlugin'
1818
}
1919

2020
dependencies {

plugins/arrow-flight-rpc/src/internalClusterTest/java/org/opensearch/arrow/flight/ArrowFlightServerIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import org.apache.arrow.vector.VectorSchemaRoot;
2020
import org.opensearch.arrow.flight.bootstrap.FlightClientManager;
2121
import org.opensearch.arrow.flight.bootstrap.FlightService;
22-
import org.opensearch.arrow.flight.bootstrap.FlightStreamPlugin;
22+
import org.opensearch.arrow.flight.transport.FlightStreamPlugin;
2323
import org.opensearch.arrow.spi.StreamManager;
2424
import org.opensearch.arrow.spi.StreamProducer;
2525
import org.opensearch.arrow.spi.StreamReader;

plugins/arrow-flight-rpc/src/internalClusterTest/java/org/opensearch/arrow/flight/FlightTransportIT.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@
1414
import org.opensearch.action.bulk.BulkRequest;
1515
import org.opensearch.action.bulk.BulkResponse;
1616
import org.opensearch.action.index.IndexRequest;
17-
import org.opensearch.action.search.SearchRequest;
1817
import org.opensearch.action.search.SearchResponse;
19-
import org.opensearch.arrow.flight.bootstrap.FlightStreamPlugin;
18+
import org.opensearch.arrow.flight.transport.FlightStreamPlugin;
2019
import org.opensearch.common.action.ActionFuture;
2120
import org.opensearch.common.settings.Settings;
2221
import org.opensearch.common.unit.TimeValue;
2322
import org.opensearch.common.xcontent.XContentType;
2423
import org.opensearch.plugins.Plugin;
2524
import org.opensearch.search.SearchHit;
2625
import org.opensearch.test.OpenSearchIntegTestCase;
27-
import org.junit.BeforeClass;
2826

2927
import java.util.Collection;
3028
import java.util.Collections;
@@ -39,14 +37,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
3937
return Collections.singleton(FlightStreamPlugin.class);
4038
}
4139

42-
@BeforeClass
43-
public static void setupSysProperties() {
44-
System.setProperty("io.netty.allocator.numDirectArenas", "1");
45-
System.setProperty("io.netty.noUnsafe", "false");
46-
System.setProperty("io.netty.tryUnsafe", "true");
47-
System.setProperty("io.netty.tryReflectionSetAccessible", "true");
48-
}
49-
5040
@Override
5141
public void setUp() throws Exception {
5242
super.setUp();

plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/FlightService.java

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
* FlightService manages the Arrow Flight server and client for OpenSearch.
3737
* It handles the initialization, startup, and shutdown of the Flight server and client,
3838
* as well as managing the stream operations through a FlightStreamManager.
39+
*
40+
* @opensearch.internal
3941
*/
4042
public class FlightService extends AuxTransport {
4143
/**
@@ -71,24 +73,44 @@ public String settingKey() {
7173
return ARROW_FLIGHT_TRANSPORT_SETTING_KEY;
7274
}
7375

74-
void setClusterService(ClusterService clusterService) {
76+
/**
77+
* Sets the cluster service for the Flight service.
78+
* @param clusterService The cluster service instance
79+
*/
80+
public void setClusterService(ClusterService clusterService) {
7581
serverComponents.setClusterService(Objects.requireNonNull(clusterService, "ClusterService cannot be null"));
7682
}
7783

78-
void setNetworkService(NetworkService networkService) {
84+
/**
85+
* Sets the network service for the Flight service.
86+
* @param networkService The network service instance
87+
*/
88+
public void setNetworkService(NetworkService networkService) {
7989
serverComponents.setNetworkService(Objects.requireNonNull(networkService, "NetworkService cannot be null"));
8090
}
8191

82-
void setThreadPool(ThreadPool threadPool) {
92+
/**
93+
* Sets the thread pool for the Flight service.
94+
* @param threadPool The thread pool instance
95+
*/
96+
public void setThreadPool(ThreadPool threadPool) {
8397
this.threadPool = Objects.requireNonNull(threadPool, "ThreadPool cannot be null");
8498
serverComponents.setThreadPool(threadPool);
8599
}
86100

87-
void setClient(Client client) {
101+
/**
102+
* Sets the client for the Flight service.
103+
* @param client The client instance
104+
*/
105+
public void setClient(Client client) {
88106
this.client = client;
89107
}
90108

91-
void setSecureTransportSettingsProvider(SecureTransportSettingsProvider secureTransportSettingsProvider) {
109+
/**
110+
* Sets the secure transport settings provider for the Flight service.
111+
* @param secureTransportSettingsProvider The secure transport settings provider
112+
*/
113+
public void setSecureTransportSettingsProvider(SecureTransportSettingsProvider secureTransportSettingsProvider) {
92114
this.secureTransportSettingsProvider = secureTransportSettingsProvider;
93115
}
94116

plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/ServerComponents.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,47 @@
5252
import static org.opensearch.transport.AuxTransport.AUX_TRANSPORT_PORT;
5353
import static org.opensearch.transport.Transport.resolveTransportPublishPort;
5454

55+
/**
56+
* Server components for Arrow Flight RPC integration with OpenSearch.
57+
* Manages the lifecycle of Flight server instances and their configuration.
58+
* @opensearch.internal
59+
*/
5560
@SuppressWarnings("removal")
5661
public final class ServerComponents implements AutoCloseable {
5762

63+
/**
64+
* Setting for Arrow Flight host addresses.
65+
*/
5866
public static final Setting<List<String>> SETTING_FLIGHT_HOST = listSetting(
5967
"arrow.flight.host",
6068
emptyList(),
6169
Function.identity(),
6270
Setting.Property.NodeScope
6371
);
6472

73+
/**
74+
* Setting for Arrow Flight bind host addresses.
75+
*/
6576
public static final Setting<List<String>> SETTING_FLIGHT_BIND_HOST = listSetting(
6677
"arrow.flight.bind_host",
6778
SETTING_FLIGHT_HOST,
6879
Function.identity(),
6980
Setting.Property.NodeScope
7081
);
7182

83+
/**
84+
* Setting for Arrow Flight publish host addresses.
85+
*/
7286
public static final Setting<List<String>> SETTING_FLIGHT_PUBLISH_HOST = listSetting(
7387
"arrow.flight.publish_host",
7488
SETTING_FLIGHT_HOST,
7589
Function.identity(),
7690
Setting.Property.NodeScope
7791
);
7892

93+
/**
94+
* Setting for Arrow Flight publish port.
95+
*/
7996
public static final Setting<Integer> SETTING_FLIGHT_PUBLISH_PORT = intSetting(
8097
"arrow.flight.publish_port",
8198
-1,
@@ -89,7 +106,14 @@ public final class ServerComponents implements AutoCloseable {
89106
private static final String GRPC_BOSS_ELG = "os-grpc-boss-ELG";
90107
private static final int SHUTDOWN_TIMEOUT_SECONDS = 5;
91108

109+
/**
110+
* The setting key for Flight transport configuration.
111+
*/
92112
public static final String FLIGHT_TRANSPORT_SETTING_KEY = "transport-flight";
113+
114+
/**
115+
* Setting for Arrow Flight port range.
116+
*/
93117
public static final Setting<PortsRange> SETTING_FLIGHT_PORTS = AUX_TRANSPORT_PORT.getConcreteSettingForNamespace(
94118
FLIGHT_TRANSPORT_SETTING_KEY
95119
);

plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/ServerConfig.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
* Configuration class for OpenSearch Flight server settings.
3636
* This class manages server-side configurations including port settings, Arrow memory settings,
3737
* thread pool configurations, and SSL/TLS settings.
38+
* @opensearch.internal
3839
*/
3940
public class ServerConfig {
4041
/**
@@ -182,10 +183,20 @@ static EventLoopGroup createELG(String name, int eventLoopThreads) {
182183
: new NioEventLoopGroup(eventLoopThreads, OpenSearchExecutors.daemonThreadFactory(name));
183184
}
184185

186+
/**
187+
* Returns the appropriate server channel type based on platform availability.
188+
*
189+
* @return EpollServerSocketChannel if Epoll is available, otherwise NioServerSocketChannel
190+
*/
185191
public static Class<? extends Channel> serverChannelType() {
186192
return Epoll.isAvailable() ? EpollServerSocketChannel.class : NioServerSocketChannel.class;
187193
}
188194

195+
/**
196+
* Returns the appropriate client channel type based on platform availability.
197+
*
198+
* @return EpollSocketChannel if Epoll is available, otherwise NioSocketChannel
199+
*/
189200
public static Class<? extends Channel> clientChannelType() {
190201
return Epoll.isAvailable() ? EpollSocketChannel.class : NioSocketChannel.class;
191202
}

0 commit comments

Comments
 (0)