OneSizeFitsQuorum commented on code in PR #11218:
URL: https://github.com/apache/iotdb/pull/11218#discussion_r1369487521
##########
iotdb-client/cli/src/main/java/org/apache/iotdb/cli/Cli.java:
##########
@@ -141,15 +143,14 @@ private static void serve() {
password = lineReader.readLine("please input your password:", '\0');
}
receiveCommands(lineReader);
-
} catch (Exception e) {
println(IOTDB_ERROR_PREFIX + ": Exit cli with error: " + e.getMessage());
System.exit(CODE_ERROR);
}
}
private static void executeSql() throws TException {
- Properties info = new Properties();
+
if (useSsl != null && Boolean.parseBoolean(useSsl)) {
Review Comment:
update these five lines in constructor?
##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/SessionConnection.java:
##########
@@ -118,17 +118,29 @@ public SessionConnection(Session session, ZoneId zoneId)
throws IoTDBConnectionE
initClusterConn();
}
- private void init(TEndPoint endPoint) throws IoTDBConnectionException {
+ private void init(TEndPoint endPoint, boolean useSSL, String trustStore,
String trustStorePwd)
+ throws IoTDBConnectionException {
RpcTransportFactory.setDefaultBufferCapacity(session.thriftDefaultBufferSize);
RpcTransportFactory.setThriftMaxFrameSize(session.thriftMaxFrameSize);
try {
- transport =
- RpcTransportFactory.INSTANCE.getTransport(
- // as there is a try-catch already, we do not need to use
TSocket.wrap
- endPoint.getIp(), endPoint.getPort(),
session.connectionTimeoutInMs);
- if (!transport.isOpen()) {
- transport.open();
+ if (useSSL) {
+ transport =
+ RpcTransportFactory.INSTANCE.getTransport(
+ endPoint.getIp(),
+ endPoint.getPort(),
+ session.connectionTimeoutInMs,
+ trustStore,
+ trustStorePwd);
+ } else {
+ transport =
+ RpcTransportFactory.INSTANCE.getTransport(
+ // as there is a try-catch already, we do not need to use
TSocket.wrap
+ endPoint.getIp(), endPoint.getPort(),
session.connectionTimeoutInMs);
+ if (!transport.isOpen()) {
+ transport.open();
+ }
}
+
Review Comment:
remove empty line
##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java:
##########
@@ -3521,34 +3562,11 @@ public Session build() {
throw new IllegalArgumentException(
"You should specify either nodeUrls or (host + rpcPort), but not
both");
}
-
+ Session newSession = new Session(this);
if (nodeUrls != null) {
- Session newSession =
- new Session(
- nodeUrls,
- username,
- pw,
- fetchSize,
- zoneId,
- thriftDefaultBufferSize,
- thriftMaxFrameSize,
- enableRedirection,
- version);
newSession.setEnableQueryRedirection(true);
Review Comment:
move to constructor?
##########
iotdb-client/cli/src/main/java/org/apache/iotdb/cli/Cli.java:
##########
@@ -161,10 +174,16 @@ private static void executeSql() throws TException {
}
private static void receiveCommands(LineReader reader) throws TException {
+ if (useSsl != null && Boolean.parseBoolean(useSsl)) {
Review Comment:
same
##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/SessionConnection.java:
##########
@@ -118,17 +118,29 @@ public SessionConnection(Session session, ZoneId zoneId)
throws IoTDBConnectionE
initClusterConn();
}
- private void init(TEndPoint endPoint) throws IoTDBConnectionException {
+ private void init(TEndPoint endPoint, boolean useSSL, String trustStore,
String trustStorePwd)
+ throws IoTDBConnectionException {
RpcTransportFactory.setDefaultBufferCapacity(session.thriftDefaultBufferSize);
RpcTransportFactory.setThriftMaxFrameSize(session.thriftMaxFrameSize);
try {
- transport =
- RpcTransportFactory.INSTANCE.getTransport(
- // as there is a try-catch already, we do not need to use
TSocket.wrap
- endPoint.getIp(), endPoint.getPort(),
session.connectionTimeoutInMs);
- if (!transport.isOpen()) {
- transport.open();
+ if (useSSL) {
+ transport =
+ RpcTransportFactory.INSTANCE.getTransport(
+ endPoint.getIp(),
+ endPoint.getPort(),
+ session.connectionTimeoutInMs,
+ trustStore,
+ trustStorePwd);
+ } else {
+ transport =
+ RpcTransportFactory.INSTANCE.getTransport(
+ // as there is a try-catch already, we do not need to use
TSocket.wrap
+ endPoint.getIp(), endPoint.getPort(),
session.connectionTimeoutInMs);
+ if (!transport.isOpen()) {
Review Comment:
move to line 142
##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java:
##########
@@ -404,6 +484,40 @@ private Session constructNewSession() {
.thriftMaxFrameSize(thriftMaxFrameSize)
.enableRedirection(enableRedirection)
.version(version)
+ .useSSL(useSSL)
+ .trustStore(trustStore)
+ .trustStorePwd(trustStorePwd)
+ .build();
+ } else if (nodeUrls == null && !useSSL) {
+ session =
+ new Session.Builder()
+ .host(host)
+ .port(port)
+ .username(user)
+ .password(password)
+ .fetchSize(fetchSize)
+ .zoneId(zoneId)
+ .thriftDefaultBufferSize(thriftDefaultBufferSize)
+ .thriftMaxFrameSize(thriftMaxFrameSize)
+ .enableRedirection(enableRedirection)
+ .version(version)
+ .build();
+
+ } else if (nodeUrls != null && useSSL) {
Review Comment:
I feel like we can brute force the new parameters to be set in, without the
useSSL judgment?
##########
iotdb-core/datanode/src/assembly/resources/conf/iotdb-datanode.properties:
##########
@@ -254,4 +267,44 @@ dn_target_config_node_list=127.0.0.1:10710
# The type of internal reporter in metric module, used for checking flushed
point number
# Options: [MEMORY, IOTDB]
# Datatype: String
-# dn_metric_internal_reporter_type=MEMORY
\ No newline at end of file
+# dn_metric_internal_reporter_type=MEMORY
+
+####################
+### REST Service Configuration
Review Comment:
need to update doc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]