Skip to content

Commit 194d601

Browse files
authored
Fix thrift 0.14.1 (#1)
* upgrade thrift version to 0.14.1
1 parent 5bc375e commit 194d601

File tree

189 files changed

+2460
-1163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+2460
-1163
lines changed

cli/src/main/java/org/apache/iotdb/tool/ExportCsv.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.apache.commons.cli.Option;
3838
import org.apache.commons.cli.Options;
3939
import org.apache.commons.cli.ParseException;
40-
import org.apache.thrift.transport.TTransportException;
4140

4241
import java.io.BufferedReader;
4342
import java.io.BufferedWriter;
@@ -132,8 +131,6 @@ public static void main(String[] args) throws IOException {
132131
System.out.println("Invalid args: " + e.getMessage());
133132
} catch (IoTDBConnectionException | StatementExecutionException e) {
134133
System.out.println("Connect failed because " + e.getMessage());
135-
} catch (TTransportException e) {
136-
System.out.println("Transport failed because " + e.getMessage());
137134
} finally {
138135
reader.close();
139136
if (session != null) {

cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.apache.commons.cli.Option;
3434
import org.apache.commons.cli.Options;
3535
import org.apache.commons.cli.ParseException;
36-
import org.apache.thrift.transport.TTransportException;
3736

3837
import java.io.BufferedReader;
3938
import java.io.File;
@@ -307,8 +306,6 @@ public static void importCsvFromFile(
307306
} catch (StatementExecutionException e) {
308307
System.out.println(
309308
"Encounter an error when executing the statement, because " + e.getMessage());
310-
} catch (TTransportException e) {
311-
System.out.println("Encounter an error when connecting to server, because " + e.getMessage());
312309
} finally {
313310
if (session != null) {
314311
try {

cluster/src/assembly/resources/conf/iotdb-cluster.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ internal_meta_port=9003
3838
# port for data service
3939
internal_data_port=40010
4040

41+
# port for cluster info API, 6567 by default
42+
#cluster_info_public_port=6567
43+
4144
# whether open port for server module (for debug purpose)
4245
# if true, the rpc_port of the single server will be changed to rpc_port (in iotdb-engines.properties) + 1
4346
# open_server_rpc_port=false

cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929
import org.apache.iotdb.cluster.rpc.thrift.Node;
3030
import org.apache.iotdb.cluster.server.MetaClusterServer;
3131
import org.apache.iotdb.cluster.server.Response;
32+
import org.apache.iotdb.cluster.server.clusterinfo.ClusterInfoServer;
3233
import org.apache.iotdb.cluster.utils.ClusterUtils;
3334
import org.apache.iotdb.db.conf.IoTDBConfigCheck;
3435
import org.apache.iotdb.db.conf.IoTDBConstant;
3536
import org.apache.iotdb.db.conf.IoTDBDescriptor;
3637
import org.apache.iotdb.db.exception.StartupException;
3738
import org.apache.iotdb.db.exception.query.QueryProcessException;
39+
import org.apache.iotdb.db.utils.TestOnly;
3840

3941
import org.apache.thrift.TException;
4042
import org.apache.thrift.async.TAsyncClientManager;
@@ -106,6 +108,9 @@ public static void main(String[] args) {
106108
preStartCustomize();
107109
metaServer.start();
108110
metaServer.buildCluster();
111+
// Currently, we do not register ClusterInfoService as a JMX Bean,
112+
// so we use startService() rather than start()
113+
ClusterInfoServer.getInstance().startService();
109114
} catch (TTransportException
110115
| StartupException
111116
| QueryProcessException
@@ -120,6 +125,9 @@ public static void main(String[] args) {
120125
preStartCustomize();
121126
metaServer.start();
122127
metaServer.joinCluster();
128+
// Currently, we do not register ClusterInfoService as a JMX Bean,
129+
// so we use startService() rather than start()
130+
ClusterInfoServer.getInstance().startService();
123131
} catch (TTransportException
124132
| StartupException
125133
| QueryProcessException
@@ -131,7 +139,7 @@ public static void main(String[] args) {
131139
} else if (MODE_REMOVE.equals(mode)) {
132140
try {
133141
doRemoveNode(args);
134-
} catch (IOException | TTransportException e) {
142+
} catch (IOException e) {
135143
logger.error("Fail to remove node in cluster", e);
136144
}
137145
} else {
@@ -202,7 +210,7 @@ private static void startServerCheck() throws StartupException {
202210
}
203211
}
204212

205-
private static void doRemoveNode(String[] args) throws IOException, TTransportException {
213+
private static void doRemoveNode(String[] args) throws IOException {
206214
if (args.length != 3) {
207215
logger.error("Usage: -r <ip> <metaPort>");
208216
return;
@@ -300,4 +308,9 @@ private int extractSerialNumInSGName(String storageGroupName) {
300308
}
301309
});
302310
}
311+
312+
@TestOnly
313+
public static void setMetaClusterServer(MetaClusterServer metaClusterServer) {
314+
metaServer = metaClusterServer;
315+
}
303316
}

cluster/src/main/java/org/apache/iotdb/cluster/client/DataClientProvider.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
import org.apache.thrift.TException;
3232
import org.apache.thrift.protocol.TProtocolFactory;
33-
import org.apache.thrift.transport.TTransportException;
3433

3534
import java.io.IOException;
3635

@@ -66,8 +65,7 @@ SyncClientPool getDataSyncClientPool() {
6665
* @param node the node to be connected
6766
* @param timeout timeout threshold of connection
6867
*/
69-
public AsyncDataClient getAsyncDataClient(Node node, int timeout)
70-
throws IOException, TTransportException {
68+
public AsyncDataClient getAsyncDataClient(Node node, int timeout) throws IOException {
7169
AsyncDataClient client = (AsyncDataClient) getDataAsyncClientPool().getClient(node);
7270
if (client == null) {
7371
throw new IOException("can not get client for node=" + node);

cluster/src/main/java/org/apache/iotdb/cluster/client/async/AsyncClientFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.apache.iotdb.cluster.rpc.thrift.RaftService;
2525

2626
import org.apache.thrift.async.TAsyncClientManager;
27-
import org.apache.thrift.transport.TTransportException;
2827
import org.slf4j.Logger;
2928
import org.slf4j.LoggerFactory;
3029

@@ -62,5 +61,5 @@ public abstract class AsyncClientFactory {
6261
* @throws IOException
6362
*/
6463
protected abstract RaftService.AsyncClient getAsyncClient(Node node, AsyncClientPool pool)
65-
throws IOException, TTransportException;
64+
throws IOException;
6665
}

cluster/src/main/java/org/apache/iotdb/cluster/client/async/AsyncClientPool.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.apache.iotdb.db.utils.TestOnly;
2828

2929
import org.apache.thrift.async.TAsyncMethodCall;
30-
import org.apache.thrift.transport.TTransportException;
3130
import org.slf4j.Logger;
3231
import org.slf4j.LoggerFactory;
3332

@@ -60,7 +59,7 @@ public AsyncClientPool(AsyncClientFactory asyncClientFactory) {
6059
* @return
6160
* @throws IOException
6261
*/
63-
public AsyncClient getClient(Node node) throws IOException, TTransportException {
62+
public AsyncClient getClient(Node node) throws IOException {
6463
return getClient(node, true);
6564
}
6665

@@ -76,8 +75,7 @@ public AsyncClient getClient(Node node) throws IOException, TTransportException
7675
* @return if the node can connect, return the client, otherwise null
7776
* @throws IOException if the node can not be connected
7877
*/
79-
public AsyncClient getClient(Node node, boolean activatedOnly)
80-
throws IOException, TTransportException {
78+
public AsyncClient getClient(Node node, boolean activatedOnly) throws IOException {
8179
ClusterNode clusterNode = new ClusterNode(node);
8280
if (activatedOnly && !NodeStatusManager.getINSTANCE().isActivated(node)) {
8381
return null;
@@ -135,7 +133,7 @@ private AsyncClient waitForClient(Deque<AsyncClient> clientStack, ClusterNode cl
135133
nodeClientNumMap.computeIfPresent(clusterNode, (n, oldValue) -> oldValue + 1);
136134
return asyncClient;
137135
}
138-
} catch (InterruptedException | TTransportException e) {
136+
} catch (InterruptedException e) {
139137
Thread.currentThread().interrupt();
140138
logger.warn("Interrupted when waiting for an available client of {}", clusterNode);
141139
return null;
@@ -203,7 +201,7 @@ void recreateClient(Node node) {
203201
try {
204202
AsyncClient asyncClient = asyncClientFactory.getAsyncClient(node, this);
205203
clientStack.push(asyncClient);
206-
} catch (IOException | TTransportException e) {
204+
} catch (IOException e) {
207205
logger.error("Cannot create a new client for {}", node, e);
208206
nodeClientNumMap.computeIfPresent(clusterNode, (n, cnt) -> cnt - 1);
209207
}

cluster/src/main/java/org/apache/iotdb/cluster/client/async/AsyncDataClient.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
import org.apache.iotdb.cluster.rpc.thrift.RaftService;
2525
import org.apache.iotdb.cluster.rpc.thrift.TSDataService.AsyncClient;
2626
import org.apache.iotdb.cluster.server.RaftServer;
27+
import org.apache.iotdb.rpc.TNonblockingSocketWrapper;
2728

2829
import org.apache.thrift.async.TAsyncClientManager;
2930
import org.apache.thrift.async.TAsyncMethodCall;
3031
import org.apache.thrift.protocol.TProtocolFactory;
31-
import org.apache.thrift.transport.TNonblockingSocket;
3232
import org.apache.thrift.transport.TNonblockingTransport;
33-
import org.apache.thrift.transport.TTransportException;
3433
import org.slf4j.Logger;
3534
import org.slf4j.LoggerFactory;
3635

@@ -62,12 +61,12 @@ public AsyncDataClient(
6261
TAsyncClientManager clientManager,
6362
Node node,
6463
AsyncClientPool pool)
65-
throws IOException, TTransportException {
64+
throws IOException {
6665
// the difference of the two clients lies in the port
6766
super(
6867
protocolFactory,
6968
clientManager,
70-
new TNonblockingSocket(
69+
TNonblockingSocketWrapper.wrap(
7170
node.getInternalIp(), node.getDataPort(), RaftServer.getConnectionTimeoutInMS()));
7271
this.node = node;
7372
this.pool = pool;
@@ -107,7 +106,7 @@ public FactoryAsync(org.apache.thrift.protocol.TProtocolFactory protocolFactory)
107106

108107
@Override
109108
public RaftService.AsyncClient getAsyncClient(Node node, AsyncClientPool pool)
110-
throws IOException, TTransportException {
109+
throws IOException {
111110
TAsyncClientManager manager = managers[clientCnt.incrementAndGet() % managers.length];
112111
manager = manager == null ? new TAsyncClientManager() : manager;
113112
return new AsyncDataClient(protocolFactory, manager, node, pool);
@@ -131,7 +130,7 @@ public SingleManagerFactory(org.apache.thrift.protocol.TProtocolFactory protocol
131130

132131
@Override
133132
public RaftService.AsyncClient getAsyncClient(Node node, AsyncClientPool pool)
134-
throws IOException, TTransportException {
133+
throws IOException {
135134
return new AsyncDataClient(protocolFactory, manager, node, pool);
136135
}
137136
}

cluster/src/main/java/org/apache/iotdb/cluster/client/async/AsyncDataHeartbeatClient.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
import org.apache.iotdb.cluster.rpc.thrift.RaftService;
2424
import org.apache.iotdb.cluster.server.RaftServer;
2525
import org.apache.iotdb.cluster.utils.ClusterUtils;
26+
import org.apache.iotdb.rpc.TNonblockingSocketWrapper;
2627

2728
import org.apache.thrift.async.TAsyncClientManager;
2829
import org.apache.thrift.protocol.TProtocolFactory;
29-
import org.apache.thrift.transport.TNonblockingSocket;
30-
import org.apache.thrift.transport.TTransportException;
3130

3231
import java.io.IOException;
3332

@@ -42,11 +41,11 @@ private AsyncDataHeartbeatClient(
4241
TAsyncClientManager clientManager,
4342
Node node,
4443
AsyncClientPool pool)
45-
throws IOException, TTransportException {
44+
throws IOException {
4645
super(
4746
protocolFactory,
4847
clientManager,
49-
new TNonblockingSocket(
48+
TNonblockingSocketWrapper.wrap(
5049
node.getInternalIp(),
5150
node.getDataPort() + ClusterUtils.DATA_HEARTBEAT_PORT_OFFSET,
5251
RaftServer.getConnectionTimeoutInMS()));
@@ -62,7 +61,7 @@ public FactoryAsync(TProtocolFactory protocolFactory) {
6261

6362
@Override
6463
public RaftService.AsyncClient getAsyncClient(Node node, AsyncClientPool pool)
65-
throws IOException, TTransportException {
64+
throws IOException {
6665
TAsyncClientManager manager = managers[clientCnt.incrementAndGet() % managers.length];
6766
manager = manager == null ? new TAsyncClientManager() : manager;
6867
return new AsyncDataHeartbeatClient(protocolFactory, manager, node, pool);

cluster/src/main/java/org/apache/iotdb/cluster/client/async/AsyncMetaClient.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323
import org.apache.iotdb.cluster.rpc.thrift.RaftService;
2424
import org.apache.iotdb.cluster.rpc.thrift.TSMetaService.AsyncClient;
2525
import org.apache.iotdb.cluster.server.RaftServer;
26+
import org.apache.iotdb.rpc.TNonblockingSocketWrapper;
2627

2728
import org.apache.thrift.async.TAsyncClientManager;
2829
import org.apache.thrift.async.TAsyncMethodCall;
2930
import org.apache.thrift.protocol.TProtocolFactory;
30-
import org.apache.thrift.transport.TNonblockingSocket;
3131
import org.apache.thrift.transport.TNonblockingTransport;
32-
import org.apache.thrift.transport.TTransportException;
3332
import org.slf4j.Logger;
3433
import org.slf4j.LoggerFactory;
3534

@@ -60,12 +59,12 @@ public AsyncMetaClient(
6059
TAsyncClientManager clientManager,
6160
Node node,
6261
AsyncClientPool pool)
63-
throws IOException, TTransportException {
62+
throws IOException {
6463
// the difference of the two clients lies in the port
6564
super(
6665
protocolFactory,
6766
clientManager,
68-
new TNonblockingSocket(
67+
TNonblockingSocketWrapper.wrap(
6968
node.getInternalIp(), node.getMetaPort(), RaftServer.getConnectionTimeoutInMS()));
7069
this.node = node;
7170
this.pool = pool;
@@ -98,7 +97,7 @@ public FactoryAsync(org.apache.thrift.protocol.TProtocolFactory protocolFactory)
9897

9998
@Override
10099
public RaftService.AsyncClient getAsyncClient(Node node, AsyncClientPool pool)
101-
throws IOException, TTransportException {
100+
throws IOException {
102101
TAsyncClientManager manager = managers[clientCnt.incrementAndGet() % managers.length];
103102
manager = manager == null ? new TAsyncClientManager() : manager;
104103
return new AsyncMetaClient(protocolFactory, manager, node, pool);

0 commit comments

Comments
 (0)