This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a commit to branch object_type_crz
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/object_type_crz by this push:
new 8e8f98305bd seems finish
8e8f98305bd is described below
commit 8e8f98305bda86dbed1fb8b4e7b72e0229bac22e
Author: Yongzao <[email protected]>
AuthorDate: Thu Jul 10 18:00:56 2025 +0800
seems finish
---
.../protocol/thrift/impl/ClientRPCServiceImpl.java | 31 ++++++++++++++++++++++
.../thrift-datanode/src/main/thrift/client.thrift | 11 ++++----
2 files changed, 37 insertions(+), 5 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
index 5e5e488dabd..35a033cbd67 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
@@ -181,6 +181,8 @@ import org.apache.iotdb.service.rpc.thrift.TSSetTimeZoneReq;
import org.apache.iotdb.service.rpc.thrift.TSUnsetSchemaTemplateReq;
import org.apache.iotdb.service.rpc.thrift.TSyncIdentityInfo;
import org.apache.iotdb.service.rpc.thrift.TSyncTransportMetaInfo;
+import org.apache.iotdb.service.rpc.thrift.TTableDeviceLeaderReq;
+import org.apache.iotdb.service.rpc.thrift.TTableDeviceLeaderResp;
import io.airlift.units.Duration;
import io.jsonwebtoken.lang.Strings;
@@ -3092,6 +3094,35 @@ public class ClientRPCServiceImpl implements
IClientRPCServiceWithHandler {
return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
}
+ @Override
+ public TTableDeviceLeaderResp fetchDeviceLeader(TTableDeviceLeaderReq req)
throws TException {
+ IDeviceID deviceID =
+ Factory.DEFAULT_FACTORY.create(
+ req.getDeviceId().toArray(new String[req.getDeviceIdSize()]));
+ TTimePartitionSlot timePartitionSlot =
TimePartitionUtils.getTimePartitionSlot(req.getTime());
+ DataPartitionQueryParam queryParam =
+ new DataPartitionQueryParam(deviceID,
Collections.singletonList(timePartitionSlot));
+ DataPartition dataPartition =
+ partitionFetcher.getDataPartition(
+ Collections.singletonMap(req.getDbName(),
Collections.singletonList(queryParam)));
+ TRegionReplicaSet targetRegionReplicaSet =
+ dataPartition.getAllReplicaSets().stream().findFirst().orElse(null);
+ TEndPoint targetEndPoint =
+ targetRegionReplicaSet != null
+ ?
targetRegionReplicaSet.getDataNodeLocations().get(0).getClientRpcEndPoint()
+ : null;
+ TTableDeviceLeaderResp resp = new TTableDeviceLeaderResp();
+ resp.setStatus(new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));
+ if (targetEndPoint != null) {
+ resp.setIp(targetEndPoint.getIp());
+ resp.setPort(String.valueOf(targetEndPoint.getPort()));
+ } else {
+ resp.setIp("");
+ resp.setPort("");
+ }
+ return resp;
+ }
+
@Override
public TSStatus insertStringRecord(final TSInsertStringRecordReq req) {
final long t1 = System.nanoTime();
diff --git a/iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift
b/iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift
index acda4e9ea52..1420b80d043 100644
--- a/iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift
+++ b/iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift
@@ -549,14 +549,15 @@ struct TSConnectionInfoResp {
}
struct TTableDeviceLeaderReq {
- 1:required string dbName
- 2:required list<string> deviceId
- 3:required i64 time
+ 1: required string dbName
+ 2: required list<string> deviceId
+ 3: required i64 time
}
struct TTableDeviceLeaderResp {
- 1:required string ip
- 2:required string port
+ 1: required common.TSStatus status
+ 2: required string ip
+ 3: required string port
}
service IClientRPCService {