This is an automated email from the ASF dual-hosted git repository.

yongzao pushed a commit to branch addlogicalclockinterface
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e32836ba64b15a46fb0dfc52ff90fc4535dc1fd7
Author: YongzaoDan <[email protected]>
AuthorDate: Mon Apr 1 14:38:14 2024 +0800

    stash
---
 .../impl/DataNodeInternalRPCServiceImpl.java       | 22 ++++++++++++++++++++++
 .../src/main/thrift/datanode.thrift                |  1 +
 2 files changed, 23 insertions(+)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
index 7acd30dff78..124d01408bb 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
@@ -1398,6 +1398,7 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
     // Judging leader if necessary
     if (req.isNeedJudgeLeader()) {
       resp.setJudgedLeaders(getJudgedLeaders());
+      resp.setConsensusLogicalTimeMap(getLogicalClockMap());
     }
 
     // Sampling load if necessary
@@ -1495,6 +1496,27 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
     return result;
   }
 
+  private Map<TConsensusGroupId, Long> getLogicalClockMap() {
+    Map<TConsensusGroupId, Long> result = new HashMap<>();
+    DataRegionConsensusImpl.getInstance()
+        .getAllConsensusGroupIds()
+        .forEach(
+            groupId ->
+                result.put(
+                    groupId.convertToTConsensusGroupId(),
+                    
DataRegionConsensusImpl.getInstance().getLogicalClock(groupId)));
+
+    SchemaRegionConsensusImpl.getInstance()
+        .getAllConsensusGroupIds()
+        .forEach(
+            groupId ->
+                result.put(
+                    groupId.convertToTConsensusGroupId(),
+                    
SchemaRegionConsensusImpl.getInstance().getLogicalClock(groupId)));
+
+    return result;
+  }
+
   private double getMemory(String gaugeName) {
     double result = 0d;
     try {
diff --git a/iotdb-protocol/thrift-datanode/src/main/thrift/datanode.thrift 
b/iotdb-protocol/thrift-datanode/src/main/thrift/datanode.thrift
index 5e9987d2a50..4bd94309a9a 100644
--- a/iotdb-protocol/thrift-datanode/src/main/thrift/datanode.thrift
+++ b/iotdb-protocol/thrift-datanode/src/main/thrift/datanode.thrift
@@ -288,6 +288,7 @@ struct TDataNodeHeartbeatResp {
   10: optional list<binary> pipeMetaList
   11: optional string activateStatus
   12: optional set<common.TEndPoint> confirmedConfigNodeEndPoints
+  13: optional map<common.TConsensusGroupId, i64> consensusLogicalTimeMap
 }
 
 struct TPipeHeartbeatReq {

Reply via email to