Skip to content

Commit 2162b8d

Browse files
authored
[To dev/1.3] Update thrift to 0.23.0 (#18446)
1 parent 505b18a commit 2162b8d

15 files changed

Lines changed: 161 additions & 29 deletions

File tree

‎LICENSE-binary‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ org.eclipse.jetty:jetty-servlet:9.4.58.v20250814
236236
org.eclipse.jetty:jetty-util:9.4.58.v20250814
237237
com.google.code.findbugs:jsr305:3.0.2
238238
com.librato.metrics:librato-java:2.1.0
239-
org.apache.thrift:libthrift:0.14.1
239+
org.apache.thrift:libthrift:0.23.0
240240
io.dropwizard.metrics:metrics-core:4.2.19
241241
io.dropwizard.metrics:metrics-jvm:3.2.2
242242
com.librato.metrics:metrics-librato:5.1.0

‎integration-test/pom.xml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@
214214
<artifactId>jcip-annotations</artifactId>
215215
<scope>test</scope>
216216
</dependency>
217+
<dependency>
218+
<groupId>org.apache.httpcomponents</groupId>
219+
<artifactId>httpclient</artifactId>
220+
<scope>test</scope>
221+
</dependency>
222+
<dependency>
223+
<groupId>org.apache.httpcomponents</groupId>
224+
<artifactId>httpcore</artifactId>
225+
<scope>test</scope>
226+
</dependency>
217227
</dependencies>
218228
<build>
219229
<plugins>

‎iotdb-client/jdbc/src/main/feature/feature.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<bundle>mvn:org.apache.iotdb/service-rpc/${project.version}</bundle>
2828
<bundle>mvn:org.apache.iotdb/iotdb-thrift/${project.version}</bundle>
2929
<bundle>mvn:org.apache.iotdb/hadoop-tsfile/${project.version}</bundle>
30-
<bundle>mvn:org.apache.thrift/libthrift/0.14.1</bundle>
30+
<bundle>mvn:org.apache.thrift/libthrift/0.23.0</bundle>
3131
<bundle>mvn:org.xerial.snappy/snappy-java/1.1.8.4</bundle>
3232
<bundle>mvn:commons-io/commons-io/2.5</bundle>
3333
<bundle>wrap:mvn:org.apache.hadoop/hadoop-core/1.2.1</bundle>

‎iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TNonblockingSocketWrapper.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import java.nio.channels.SocketChannel;
2727

2828
/**
29-
* In Thrift 0.14.1, TNonblockingSocket's constructor throws a never-happened exception. So, we
30-
* screen the exception https://issues.apache.org/jira/browse/THRIFT-5412
29+
* TNonblockingSocket's constructor declares a TTransportException for compatibility, but this code
30+
* path is not expected to throw one. See https://issues.apache.org/jira/browse/THRIFT-5412.
3131
*/
3232
public class TNonblockingSocketWrapper {
3333

‎iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TSocketWrapper.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.apache.thrift.transport.TTransportException;
2525

2626
/**
27-
* In Thrift 0.14.1, TSocket's constructor throws a never-happened exception. So, we screen the
28-
* exception https://issues.apache.org/jira/browse/THRIFT-5412
27+
* TSocket's constructor declares a TTransportException for compatibility, but this code path is not
28+
* expected to throw one. See https://issues.apache.org/jira/browse/THRIFT-5412.
2929
*/
3030
public class TSocketWrapper {
3131

‎iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceHandler.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.iotdb.confignode.service.thrift;
1919

20+
import org.apache.iotdb.commons.service.NoopServerContext;
2021
import org.apache.iotdb.commons.service.metric.MetricService;
2122

2223
import org.apache.thrift.protocol.TProtocol;
@@ -37,7 +38,7 @@ public ConfigNodeRPCServiceHandler() {
3738
@Override
3839
public ServerContext createContext(TProtocol input, TProtocol output) {
3940
thriftConnectionNumber.incrementAndGet();
40-
return null;
41+
return NoopServerContext.INSTANCE;
4142
}
4243

4344
@Override

‎iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/service/IoTConsensusRPCServiceHandler.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package org.apache.iotdb.consensus.iot.service;
2121

22+
import org.apache.iotdb.commons.service.NoopServerContext;
23+
2224
import org.apache.thrift.protocol.TProtocol;
2325
import org.apache.thrift.server.ServerContext;
2426
import org.apache.thrift.server.TServerEventHandler;
@@ -37,7 +39,7 @@ public void preServe() {}
3739

3840
@Override
3941
public ServerContext createContext(TProtocol input, TProtocol output) {
40-
return null;
42+
return NoopServerContext.INSTANCE;
4143
}
4244

4345
@Override

‎iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/service/PipeConsensusRPCServiceHandler.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package org.apache.iotdb.consensus.pipe.service;
2121

22+
import org.apache.iotdb.commons.service.NoopServerContext;
23+
2224
import org.apache.thrift.protocol.TProtocol;
2325
import org.apache.thrift.server.ServerContext;
2426
import org.apache.thrift.server.TServerEventHandler;
@@ -37,7 +39,7 @@ public void preServe() {}
3739

3840
@Override
3941
public ServerContext createContext(TProtocol input, TProtocol output) {
40-
return null;
42+
return NoopServerContext.INSTANCE;
4143
}
4244

4345
@Override

‎iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/BaseServerContextHandler.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.apache.iotdb.db.protocol.thrift.handler;
2121

22+
import org.apache.iotdb.commons.service.NoopServerContext;
2223
import org.apache.iotdb.db.protocol.session.ClientSession;
2324
import org.apache.iotdb.db.protocol.session.SessionManager;
2425
import org.apache.iotdb.external.api.thrift.JudgableServerContext;
@@ -62,16 +63,17 @@ public ServerContext createContext(TProtocol in, TProtocol out) {
6263
getSessionManager().registerSession(new ClientSession(socket));
6364
if (factory != null) {
6465
context = factory.newServerContext(out, socket);
65-
if (!context.whenConnect()) {
66+
if (context != null && !context.whenConnect()) {
6667
return context;
6768
}
6869
}
69-
return context;
70+
return context == null ? NoopServerContext.INSTANCE : context;
7071
}
7172

7273
public void deleteContext(ServerContext context, TProtocol in, TProtocol out) {
7374
getSessionManager().removeCurrSession();
74-
if (context != null && factory != null) {
75+
76+
if (context instanceof JudgableServerContext) {
7577
((JudgableServerContext) context).whenDisconnect();
7678
}
7779
}

‎iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/InternalServiceThriftHandler.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.apache.iotdb.db.protocol.thrift.handler;
2121

22+
import org.apache.iotdb.commons.service.NoopServerContext;
2223
import org.apache.iotdb.commons.service.metric.MetricService;
2324

2425
import org.apache.thrift.protocol.TProtocol;
@@ -45,7 +46,7 @@ public void preServe() {
4546
@Override
4647
public ServerContext createContext(TProtocol tProtocol, TProtocol tProtocol1) {
4748
thriftConnectionNumber.incrementAndGet();
48-
return null;
49+
return NoopServerContext.INSTANCE;
4950
}
5051

5152
@Override

0 commit comments

Comments
 (0)