This is an automated email from the ASF dual-hosted git repository.
neuyilan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new af5549d325 [IOTDB-3966] [IOTDB-4079]Show leadership when show Regions
&& fix region id duplicated (#6939)
af5549d325 is described below
commit af5549d3253dce4d4d1c4e853e65e15526e7cd40
Author: 任宇华 <[email protected]>
AuthorDate: Thu Aug 11 09:07:52 2022 +0800
[IOTDB-3966] [IOTDB-4079]Show leadership when show Regions && fix region id
duplicated (#6939)
---
.../iotdb/confignode/manager/ConfigManager.java | 22 ++-
.../iotdb/confignode/manager/load/LoadManager.java | 28 ++-
.../manager/load/balancer/RouteBalancer.java | 4 +
.../load/balancer/router/LazyGreedyRouter.java | 4 +
.../persistence/partition/PartitionInfo.java | 7 +-
.../partition/StorageGroupPartitionTable.java | 24 +--
.../thrift/ConfigNodeRPCServiceProcessor.java | 3 +-
.../Maintenance-Tools/Maintenance-Command.md | 192 ++++++++++-----------
.../Maintenance-Tools/Maintenance-Command.md | 191 ++++++++++----------
.../iotdb/commons/cluster/RegionRoleType.java | 37 ++++
.../iotdb/db/mpp/common/header/HeaderConstant.java | 4 +-
.../execution/config/metadata/ShowRegionTask.java | 1 +
.../src/main/thrift/confignode.thrift | 1 +
13 files changed, 300 insertions(+), 218 deletions(-)
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
index b8176c23b4..89ed6935c5 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
@@ -20,12 +20,14 @@
package org.apache.iotdb.confignode.manager;
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
+import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
import org.apache.iotdb.common.rpc.thrift.TDataNodeConfiguration;
import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TFlushReq;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
+import org.apache.iotdb.commons.cluster.RegionRoleType;
import org.apache.iotdb.commons.conf.CommonDescriptor;
import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.exception.IllegalPathException;
@@ -849,10 +851,26 @@ public class ConfigManager implements IManager {
}
@Override
- public DataSet showRegion(GetRegionInfoListPlan getRegionInfoListPlan) {
+ public RegionInfoListResp showRegion(GetRegionInfoListPlan
getRegionInfoListPlan) {
TSStatus status = confirmLeader();
if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
- return partitionManager.getRegionInfoList(getRegionInfoListPlan);
+ RegionInfoListResp regionInfoListResp =
+ (RegionInfoListResp)
partitionManager.getRegionInfoList(getRegionInfoListPlan);
+ regionInfoListResp
+ .getRegionInfoList()
+ .forEach(
+ regionInfo -> {
+ Map<TConsensusGroupId, Integer> allLeadership =
loadManager.getAllLeadership();
+ if (!allLeadership.isEmpty()) {
+ String regionType =
+ regionInfo.getDataNodeId()
+ ==
allLeadership.get(regionInfo.getConsensusGroupId())
+ ? RegionRoleType.Leader.toString()
+ : RegionRoleType.Follower.toString();
+ regionInfo.setRoleType(regionType);
+ }
+ });
+ return regionInfoListResp;
} else {
RegionInfoListResp regionResp = new RegionInfoListResp();
regionResp.setStatus(status);
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/LoadManager.java
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/LoadManager.java
index fca9a8267b..89a53e6df5 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/LoadManager.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/LoadManager.java
@@ -217,11 +217,29 @@ public class LoadManager {
*/
public Map<TConsensusGroupId, Integer> getAllLeadership() {
Map<TConsensusGroupId, Integer> result = new ConcurrentHashMap<>();
-
- regionGroupCacheMap.forEach(
- (consensusGroupId, regionGroupCache) ->
- result.put(consensusGroupId,
regionGroupCache.getLeaderDataNodeId()));
-
+ if (ConfigNodeDescriptor.getInstance()
+ .getConf()
+ .getDataRegionConsensusProtocolClass()
+ .equals(ConsensusFactory.MultiLeaderConsensus)) {
+ regionGroupCacheMap.forEach(
+ (consensusGroupId, regionGroupCache) -> {
+ if
(consensusGroupId.getType().equals(TConsensusGroupType.SchemaRegion)) {
+ result.put(consensusGroupId,
regionGroupCache.getLeaderDataNodeId());
+ }
+ });
+ routeBalancer
+ .getRouteMap()
+ .forEach(
+ (consensusGroupId, regionReplicaSet) -> {
+ result.put(
+ consensusGroupId,
+
regionReplicaSet.getDataNodeLocations().get(0).getDataNodeId());
+ });
+ } else {
+ regionGroupCacheMap.forEach(
+ (consensusGroupId, regionGroupCache) ->
+ result.put(consensusGroupId,
regionGroupCache.getLeaderDataNodeId()));
+ }
return result;
}
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
index 639170945e..af30d14378 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
@@ -109,4 +109,8 @@ public class RouteBalancer {
private LoadManager getLoadManager() {
return configManager.getLoadManager();
}
+
+ public Map<TConsensusGroupId, TRegionReplicaSet> getRouteMap() {
+ return lazyGreedyRouter.getRouteMap();
+ }
}
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/router/LazyGreedyRouter.java
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/router/LazyGreedyRouter.java
index c76c79d494..83a4732381 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/router/LazyGreedyRouter.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/router/LazyGreedyRouter.java
@@ -151,4 +151,8 @@ public class LazyGreedyRouter implements IRouter {
(dataNodeId, counter) -> (counter == null ? 1 : counter + 1));
routeMap.put(newRouteEntry.getRegionId(), newRouteEntry);
}
+
+ public Map<TConsensusGroupId, TRegionReplicaSet> getRouteMap() {
+ return routeMap;
+ }
}
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
index 1ca8831bf6..22dae748e5 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
@@ -104,7 +104,7 @@ public class PartitionInfo implements SnapshotProcessor {
public PartitionInfo() {
this.storageGroupPartitionTables = new ConcurrentHashMap<>();
- this.nextRegionGroupId = new AtomicInteger(0);
+ this.nextRegionGroupId = new AtomicInteger(-1);
// Ensure that the PartitionTables of the StorageGroups who've been
logically deleted
// are unreadable and un-writable
@@ -149,7 +149,7 @@ public class PartitionInfo implements SnapshotProcessor {
}
public int generateNextRegionGroupId() {
- return nextRegionGroupId.getAndIncrement();
+ return nextRegionGroupId.incrementAndGet();
}
// ======================================================
@@ -427,6 +427,7 @@ public class PartitionInfo implements SnapshotProcessor {
List<TRegionInfo> regionInfoList = new ArrayList<>();
if (storageGroupPartitionTables.isEmpty()) {
regionResp.setStatus(RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS));
+ regionResp.setRegionInfoList(new ArrayList<>());
return regionResp;
}
TShowRegionReq showRegionReq = regionsInfoPlan.getShowRegionReq();
@@ -753,7 +754,7 @@ public class PartitionInfo implements SnapshotProcessor {
}
public void clear() {
- nextRegionGroupId.set(0);
+ nextRegionGroupId.set(-1);
storageGroupPartitionTables.clear();
deletedRegionSet.clear();
}
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/StorageGroupPartitionTable.java
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/StorageGroupPartitionTable.java
index 418d5c5d79..3edab76a40 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/StorageGroupPartitionTable.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/StorageGroupPartitionTable.java
@@ -354,22 +354,22 @@ public class StorageGroupPartitionTable {
.getDataNodeLocations()
.forEach(
(dataNodeLocation) -> {
- TRegionInfo tRegionInfoList = new TRegionInfo();
- tRegionInfoList.setConsensusGroupId(replicaSet.getRegionId());
- tRegionInfoList.setStorageGroup(storageGroupName);
+ TRegionInfo regionInfo = new TRegionInfo();
+ regionInfo.setConsensusGroupId(replicaSet.getRegionId());
+ regionInfo.setStorageGroup(storageGroupName);
if (replicaSet.getRegionId().getType() ==
TConsensusGroupType.DataRegion) {
-
tRegionInfoList.setSeriesSlots(dataPartitionTable.getDataPartitionMap().size());
- tRegionInfoList.setTimeSlots(regionGroup.getCounter());
+
regionInfo.setSeriesSlots(dataPartitionTable.getDataPartitionMap().size());
+ regionInfo.setTimeSlots(regionGroup.getCounter());
} else if (replicaSet.getRegionId().getType() ==
TConsensusGroupType.SchemaRegion) {
- tRegionInfoList.setSeriesSlots(regionGroup.getCounter());
- tRegionInfoList.setTimeSlots(0);
+ regionInfo.setSeriesSlots(regionGroup.getCounter());
+ regionInfo.setTimeSlots(0);
}
- tRegionInfoList.setDataNodeId(dataNodeLocation.getDataNodeId());
-
tRegionInfoList.setClientRpcIp(dataNodeLocation.getClientRpcEndPoint().getIp());
-
tRegionInfoList.setClientRpcPort(dataNodeLocation.getClientRpcEndPoint().getPort());
+ regionInfo.setDataNodeId(dataNodeLocation.getDataNodeId());
+
regionInfo.setClientRpcIp(dataNodeLocation.getClientRpcEndPoint().getIp());
+
regionInfo.setClientRpcPort(dataNodeLocation.getClientRpcEndPoint().getPort());
// TODO: Wait for data migration. And then add the state
- tRegionInfoList.setStatus(RegionStatus.Up.getStatus());
- regionInfoList.add(tRegionInfoList);
+ regionInfo.setStatus(RegionStatus.Up.getStatus());
+ regionInfoList.add(regionInfo);
});
}
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
b/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
index 82ab4743cd..235d97a943 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
@@ -534,8 +534,7 @@ public class ConfigNodeRPCServiceProcessor implements
IConfigNodeRPCService.Ifac
@Override
public TShowRegionResp showRegion(TShowRegionReq showRegionReq) throws
TException {
GetRegionInfoListPlan getRegionInfoListPlan = new
GetRegionInfoListPlan(showRegionReq);
- RegionInfoListResp dataSet =
- (RegionInfoListResp) configManager.showRegion(getRegionInfoListPlan);
+ RegionInfoListResp dataSet =
configManager.showRegion(getRegionInfoListPlan);
TShowRegionResp showRegionResp = new TShowRegionResp();
showRegionResp.setStatus(dataSet.getStatus());
showRegionResp.setRegionInfoList(dataSet.getRegionInfoList());
diff --git a/docs/UserGuide/Maintenance-Tools/Maintenance-Command.md
b/docs/UserGuide/Maintenance-Tools/Maintenance-Command.md
index 323e3df90a..bc9e56869b 100644
--- a/docs/UserGuide/Maintenance-Tools/Maintenance-Command.md
+++ b/docs/UserGuide/Maintenance-Tools/Maintenance-Command.md
@@ -142,112 +142,112 @@ Currently, IoTDB supports Region query using the
following SQL:
- `SHOW DATA REGIONS`: Show all DataRegion distribution
- `SHOW (DATA|SCHEMA)? REGIONS OF STORAGE GROUP <sg1,sg2,...>`: Show region
distribution of specified storage groups
-```sql
+First, let's take a look at the distribution of Regions under three copies:
+
+```
IoTDB> create timeseries root.sg.d1.s1 with datatype=BOOLEAN,encoding=PLAIN
Msg: The statement is executed successfully.
IoTDB> create timeseries root.sg.d2.s1 with datatype=BOOLEAN,encoding=PLAIN
Msg: The statement is executed successfully.
IoTDB> create timeseries root.ln.d1.s1 with datatype=BOOLEAN,encoding=PLAIN
Msg: The statement is executed successfully.
+
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
5|127.0.0.1|6671|Follower|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
4|127.0.0.1|6669|Follower|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6667| Leader|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
5|127.0.0.1|6671|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
4|127.0.0.1|6669|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
3|127.0.0.1|6667| Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+Total line number = 6
+It costs 0.032s
+```
+
+Then take a look at the distribution of Regions under a single copy:
+
+
+```sql
IoTDB> show regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6671|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6667|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
5|127.0.0.1|6671|Leader|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
4|127.0.0.1|6669|Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
Total line number = 2
-It costs 0.035s
+It costs 0.128s
+```
+
+Show the distribution information of Schema Region and Data Region:
+```
IoTDB> insert into root.sg.d1(timestamp,s1) values(1,true)
Msg: The statement is executed successfully.
-IoTDB> show regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6671|
-| 1| DataRegion| Up| root.sg| 1| 1|
1|127.0.0.1|6669|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6667|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-Total line number = 3
-It costs 0.010s
-
IoTDB> insert into root.ln.d1(timestamp,s1) values(1,true)
Msg: The statement is executed successfully.
+
IoTDB> show data regions
-+--------+----------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time Slots|DataNodeId|
Host|Port|
-+--------+----------+------+-------------+------------+----------+----------+---------+----+
-| 1|DataRegion| Up| root.sg| 1| 1|
1|127.0.0.1|6669|
-| 2|DataRegion| Up| root.ln| 1| 1|
1|127.0.0.1|6669|
-+--------+----------+------+-------------+------------+----------+----------+---------+----+
++--------+----------+------+-------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status|storage group|Series Slots|Time Slots|DataNodeId|
Host|Port| Role|
++--------+----------+------+-------------+------------+----------+----------+---------+----+--------+
+| 2|DataRegion| Up| root.sg| 1| 1|
5|127.0.0.1|6671|Follower|
+| 2|DataRegion| Up| root.sg| 1| 1|
4|127.0.0.1|6669| Leader|
+| 2|DataRegion| Up| root.sg| 1| 1|
3|127.0.0.1|6667|Follower|
+| 3|DataRegion| Up| root.ln| 1| 1|
5|127.0.0.1|6671| Leader|
+| 3|DataRegion| Up| root.ln| 1| 1|
4|127.0.0.1|6669|Follower|
+| 3|DataRegion| Up| root.ln| 1| 1|
3|127.0.0.1|6667|Follower|
++--------+----------+------+-------------+------------+----------+----------+---------+----+--------+
Total line number = 2
It costs 0.011s
IoTDB> show schema regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6671|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6667|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
5|127.0.0.1|6671|Follower|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
4|127.0.0.1|6669| Leader|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6667|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
5|127.0.0.1|6671|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
4|127.0.0.1|6669|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
3|127.0.0.1|6667| Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
Total line number = 2
It costs 0.012s
-
-IoTDB> show regions of storage group root.sg1
-show regions of storage group root.sg1
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 10|SchemaRegion| Up| root.sg1| 1| 0|
4|127.0.0.1|6669|
-| 11| DataRegion| Up| root.sg1| 1| 1|
5|127.0.0.1|6671|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-Total line number = 2
-It costs 0.005s
+```
-IoTDB> show regions of storage group root.sg1, root.sg2
-show regions of storage group root.sg1, root.sg2
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 10|SchemaRegion| Up| root.sg1| 1| 0|
4|127.0.0.1|6669|
-| 11| DataRegion| Up| root.sg1| 1| 1|
5|127.0.0.1|6671|
-| 12|SchemaRegion| Up| root.sg2| 1| 0|
4|127.0.0.1|6669|
-| 13| DataRegion| Up| root.sg2| 1| 1|
4|127.0.0.1|6669|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-Total line number = 4
-It costs 0.005s
+Show region distribution of specified storage groups
-IoTDB> show regions of storage group root.*.sg_2
-show regions of storage group root.*.sg_2
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status| storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-| 14|SchemaRegion| Up|root.sg_1.sg_2| 1| 0|
3|127.0.0.1|6667|
-| 15| DataRegion| Up|root.sg_1.sg_2| 1| 1|
5|127.0.0.1|6671|
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
+```
+IoTDB> show regions of storage group root.sg
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
5|127.0.0.1|6671|Follower|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
4|127.0.0.1|6669| Leader|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6667|Follower|
+| 2| DataRegion| Up| root.sg| 1| 1|
5|127.0.0.1|6671|Follower|
+| 2| DataRegion| Up| root.sg| 1| 1|
4|127.0.0.1|6669| Leader|
+| 2| DataRegion| Up| root.sg| 1| 1|
3|127.0.0.1|6667|Follower|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
Total line number = 2
-It costs 0.004s
-
-IoTDB> show data regions of storage group root.*.sg_2
-show data regions of storage group root.*.sg_2
-+--------+----------+------+--------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status| storage group|Series Slots|Time Slots|DataNodeId|
Host|Port|
-+--------+----------+------+--------------+------------+----------+----------+---------+----+
-| 15|DataRegion| Up|root.sg_1.sg_2| 1| 1|
5|127.0.0.1|6671|
-+--------+----------+------+--------------+------------+----------+----------+---------+----+
-Total line number = 1
-It costs 0.004s
-
-IoTDB> show schema regions of storage group root.*.sg_2
-show schema regions of storage group root.*.sg_2
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status| storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-| 14|SchemaRegion| Up|root.sg_1.sg_2| 1| 0|
5|127.0.0.1|6671|
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-Total line number = 1
-It costs 0.102s
+It costs 0.005s
+
+IoTDB> create timeseries root.sgcc.wf01.d1.wt01 with
datatype=BOOLEAN,encoding=PLAIN
+Msg: The statement is executed successfully.
+IoTDB> show regions of storage group root.*.wf01
++--------+------------+------+--------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status| storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+--------------+------------+----------+----------+---------+----+--------+
+| 4|SchemaRegion| Up|root.sgcc.wf01| 1| 0|
5|127.0.0.1|6671| Leader|
+| 4|SchemaRegion| Up|root.sgcc.wf01| 1| 0|
4|127.0.0.1|6669|Follower|
+| 4|SchemaRegion| Up|root.sgcc.wf01| 1| 0|
3|127.0.0.1|6667|Follower|
++--------+------------+------+--------------+------------+----------+----------+---------+----+--------+
+Total line number = 3
+It costs 0.012s
```
+
## Monitoring tool for cluster Node distribution
### Show all DataNode information
@@ -268,12 +268,12 @@ Msg: The statement is executed successfully.
IoTDB> create timeseries root.ln.d1.s1 with datatype=BOOLEAN,encoding=PLAIN
Msg: The statement is executed successfully.
IoTDB> show regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
1|127.0.0.1|6667|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6668|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
1|127.0.0.1|6667|Leader|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6668|Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
Total line number = 2
It costs 0.013s
@@ -290,13 +290,13 @@ It costs 0.007s
IoTDB> insert into root.ln.d1(timestamp,s1) values(1,true)
Msg: The statement is executed successfully.
IoTDB> show regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
1|127.0.0.1|6667|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6668|
-| 2| DataRegion| Up| root.ln| 1| 1|
1|127.0.0.1|6667|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
1|127.0.0.1|6667|Leader|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6668|Leader|
+| 2| DataRegion| Up| root.ln| 1| 1|
1|127.0.0.1|6667|Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
Total line number = 3
It costs 0.008s
IoTDB> show datanodes
diff --git a/docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md
b/docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md
index f7885f55a1..8a83f7cb68 100644
--- a/docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md
+++ b/docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md
@@ -135,116 +135,113 @@ KILL QUERY <queryId>
- `SHOW REGIONS`: 展示所有 Region
- `SHOW SCHEMA REGIONS`: 展示所有 SchemaRegion 分布
- `SHOW DATA REGIONS`: 展示所有 DataRegion 分布
-- `SHOW (DATA|SCHEMA)? REGIONS OF STORAGE GROUP <sg1,sg2,...>`:
展示指定的存储组<sg1,sg2,...>对应的Region分布
+- `SHOW (DATA|SCHEMA)? REGIONS OF STORAGE GROUP <sg1,sg2,...>`:
展示指定的存储组<sg1,sg2,...>对应的Region分布。
+首先来看一下三副本下Region的分布情况:
-```sql
+```
IoTDB> create timeseries root.sg.d1.s1 with datatype=BOOLEAN,encoding=PLAIN
Msg: The statement is executed successfully.
IoTDB> create timeseries root.sg.d2.s1 with datatype=BOOLEAN,encoding=PLAIN
Msg: The statement is executed successfully.
IoTDB> create timeseries root.ln.d1.s1 with datatype=BOOLEAN,encoding=PLAIN
Msg: The statement is executed successfully.
+
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
5|127.0.0.1|6671|Follower|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
4|127.0.0.1|6669|Follower|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6667| Leader|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
5|127.0.0.1|6671|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
4|127.0.0.1|6669|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
3|127.0.0.1|6667| Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+Total line number = 6
+It costs 0.032s
+```
+
+然后再来看一下单副本下Region的分布情况:
+
+
+```sql
IoTDB> show regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6671|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6667|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
5|127.0.0.1|6671|Leader|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
4|127.0.0.1|6669|Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
Total line number = 2
-It costs 0.035s
+It costs 0.128s
+```
+查看Schema Region和Data Region的分布信息:
+```
IoTDB> insert into root.sg.d1(timestamp,s1) values(1,true)
Msg: The statement is executed successfully.
-IoTDB> show regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6671|
-| 1| DataRegion| Up| root.sg| 1| 1|
1|127.0.0.1|6669|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6667|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-Total line number = 3
-It costs 0.010s
-
IoTDB> insert into root.ln.d1(timestamp,s1) values(1,true)
Msg: The statement is executed successfully.
+
IoTDB> show data regions
-+--------+----------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time Slots|DataNodeId|
Host|Port|
-+--------+----------+------+-------------+------------+----------+----------+---------+----+
-| 1|DataRegion| Up| root.sg| 1| 1|
1|127.0.0.1|6669|
-| 2|DataRegion| Up| root.ln| 1| 1|
1|127.0.0.1|6669|
-+--------+----------+------+-------------+------------+----------+----------+---------+----+
++--------+----------+------+-------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status|storage group|Series Slots|Time Slots|DataNodeId|
Host|Port| Role|
++--------+----------+------+-------------+------------+----------+----------+---------+----+--------+
+| 2|DataRegion| Up| root.sg| 1| 1|
5|127.0.0.1|6671|Follower|
+| 2|DataRegion| Up| root.sg| 1| 1|
4|127.0.0.1|6669| Leader|
+| 2|DataRegion| Up| root.sg| 1| 1|
3|127.0.0.1|6667|Follower|
+| 3|DataRegion| Up| root.ln| 1| 1|
5|127.0.0.1|6671| Leader|
+| 3|DataRegion| Up| root.ln| 1| 1|
4|127.0.0.1|6669|Follower|
+| 3|DataRegion| Up| root.ln| 1| 1|
3|127.0.0.1|6667|Follower|
++--------+----------+------+-------------+------------+----------+----------+---------+----+--------+
Total line number = 2
It costs 0.011s
IoTDB> show schema regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6671|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6667|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
5|127.0.0.1|6671|Follower|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
4|127.0.0.1|6669| Leader|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6667|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
5|127.0.0.1|6671|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
4|127.0.0.1|6669|Follower|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
3|127.0.0.1|6667| Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
Total line number = 2
It costs 0.012s
+```
-IoTDB> show regions of storage group root.sg1
-show regions of storage group root.sg1
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 10|SchemaRegion| Up| root.sg1| 1| 0|
4|127.0.0.1|6669|
-| 11| DataRegion| Up| root.sg1| 1| 1|
5|127.0.0.1|6671|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-Total line number = 2
-It costs 0.005s
+展示指定的存储组<sg1,sg2,...>对应的Region分布:
-IoTDB> show regions of storage group root.sg1, root.sg2
-show regions of storage group root.sg1, root.sg2
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 10|SchemaRegion| Up| root.sg1| 1| 0|
4|127.0.0.1|6669|
-| 11| DataRegion| Up| root.sg1| 1| 1|
5|127.0.0.1|6671|
-| 12|SchemaRegion| Up| root.sg2| 1| 0|
4|127.0.0.1|6669|
-| 13| DataRegion| Up| root.sg2| 1| 1|
4|127.0.0.1|6669|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-Total line number = 4
+```
+IoTDB> show regions of storage group root.sg
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
5|127.0.0.1|6671|Follower|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
4|127.0.0.1|6669| Leader|
+| 0|SchemaRegion| Up| root.sg| 2| 0|
3|127.0.0.1|6667|Follower|
+| 2| DataRegion| Up| root.sg| 1| 1|
5|127.0.0.1|6671|Follower|
+| 2| DataRegion| Up| root.sg| 1| 1|
4|127.0.0.1|6669| Leader|
+| 2| DataRegion| Up| root.sg| 1| 1|
3|127.0.0.1|6667|Follower|
++--------+------------+------+-------------+------------+----------+----------+---------+----+--------+
+Total line number = 2
It costs 0.005s
-IoTDB> show regions of storage group root.*.sg_2
-show regions of storage group root.*.sg_2
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status| storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-| 14|SchemaRegion| Up|root.sg_1.sg_2| 1| 0|
3|127.0.0.1|6667|
-| 15| DataRegion| Up|root.sg_1.sg_2| 1| 1|
5|127.0.0.1|6671|
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-Total line number = 2
-It costs 0.004s
-
-IoTDB> show data regions of storage group root.*.sg_2
-show data regions of storage group root.*.sg_2
-+--------+----------+------+--------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status| storage group|Series Slots|Time Slots|DataNodeId|
Host|Port|
-+--------+----------+------+--------------+------------+----------+----------+---------+----+
-| 15|DataRegion| Up|root.sg_1.sg_2| 1| 1|
5|127.0.0.1|6671|
-+--------+----------+------+--------------+------------+----------+----------+---------+----+
-Total line number = 1
-It costs 0.004s
-
-
-IoTDB> show schema regions of storage group root.*.sg_2
-show schema regions of storage group root.*.sg_2
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status| storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-| 14|SchemaRegion| Up|root.sg_1.sg_2| 1| 0|
5|127.0.0.1|6671|
-+--------+------------+------+--------------+------------+----------+----------+---------+----+
-Total line number = 1
-It costs 0.102s
+IoTDB> create timeseries root.sgcc.wf01.d1.wt01 with
datatype=BOOLEAN,encoding=PLAIN
+Msg: The statement is executed successfully.
+IoTDB> show regions of storage group root.*.wf01
++--------+------------+------+--------------+------------+----------+----------+---------+----+--------+
+|RegionId| Type|Status| storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+--------------+------------+----------+----------+---------+----+--------+
+| 4|SchemaRegion| Up|root.sgcc.wf01| 1| 0|
5|127.0.0.1|6671| Leader|
+| 4|SchemaRegion| Up|root.sgcc.wf01| 1| 0|
4|127.0.0.1|6669|Follower|
+| 4|SchemaRegion| Up|root.sgcc.wf01| 1| 0|
3|127.0.0.1|6667|Follower|
++--------+------------+------+--------------+------------+----------+----------+---------+----+--------+
+Total line number = 3
+It costs 0.012s
```
+
## 集群节点分布式监控工具
### 查看DataNode节点信息
@@ -265,12 +262,12 @@ Msg: The statement is executed successfully.
IoTDB> create timeseries root.ln.d1.s1 with datatype=BOOLEAN,encoding=PLAIN
Msg: The statement is executed successfully.
IoTDB> show regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
1|127.0.0.1|6667|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6668|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
1|127.0.0.1|6667|Leader|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6668|Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
Total line number = 2
It costs 0.013s
@@ -287,13 +284,13 @@ It costs 0.007s
IoTDB> insert into root.ln.d1(timestamp,s1) values(1,true)
Msg: The statement is executed successfully.
IoTDB> show regions
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
-| 0|SchemaRegion| Up| root.sg| 2| 0|
1|127.0.0.1|6667|
-| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6668|
-| 2| DataRegion| Up| root.ln| 1| 1|
1|127.0.0.1|6667|
-+--------+------------+------+-------------+------------+----------+----------+---------+----+
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+|RegionId| Type|Status|storage group|Series Slots|Time
Slots|DataNodeId| Host|Port| Role|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
+| 0|SchemaRegion| Up| root.sg| 2| 0|
1|127.0.0.1|6667|Leader|
+| 1|SchemaRegion| Up| root.ln| 1| 0|
2|127.0.0.1|6668|Leader|
+| 2| DataRegion| Up| root.ln| 1| 1|
1|127.0.0.1|6667|Leader|
++--------+------------+------+-------------+------------+----------+----------+---------+----+------+
Total line number = 3
It costs 0.008s
IoTDB> show datanodes
diff --git
a/node-commons/src/main/java/org/apache/iotdb/commons/cluster/RegionRoleType.java
b/node-commons/src/main/java/org/apache/iotdb/commons/cluster/RegionRoleType.java
new file mode 100644
index 0000000000..1a9d59e1eb
--- /dev/null
+++
b/node-commons/src/main/java/org/apache/iotdb/commons/cluster/RegionRoleType.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.commons.cluster;
+
+/** Region Role for showing regions */
+public enum RegionRoleType {
+ // Region role type : Leader
+ Leader("Leader"),
+ // Region role type : Follower
+ Follower("Follower");
+
+ private final String status;
+
+ RegionRoleType(String status) {
+ this.status = status;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/common/header/HeaderConstant.java
b/server/src/main/java/org/apache/iotdb/db/mpp/common/header/HeaderConstant.java
index b47321aab2..b3ab46d8a2 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/common/header/HeaderConstant.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/common/header/HeaderConstant.java
@@ -78,6 +78,7 @@ public class HeaderConstant {
public static final String COLUMN_DATANODE_ID = "DataNodeId";
public static final String COLUMN_SERIES_SLOTS = "Series Slots";
public static final String COLUMN_TIME_SLOTS = "Time Slots";
+ public static final String COLUMN_ROLE = "Role";
// column names for show datanodes
public static final String COLUMN_DATA_REGION_NUM = "DataRegionNum";
@@ -258,7 +259,8 @@ public class HeaderConstant {
new ColumnHeader(COLUMN_TIME_SLOTS, TSDataType.INT64),
new ColumnHeader(COLUMN_DATANODE_ID, TSDataType.INT32),
new ColumnHeader(COLUMN_HOST, TSDataType.TEXT),
- new ColumnHeader(COLUMN_PORT, TSDataType.INT32)),
+ new ColumnHeader(COLUMN_PORT, TSDataType.INT32),
+ new ColumnHeader(COLUMN_ROLE, TSDataType.TEXT)),
true);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/ShowRegionTask.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/ShowRegionTask.java
index 64f25eaf7c..8b1c2459f6 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/ShowRegionTask.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/ShowRegionTask.java
@@ -79,6 +79,7 @@ public class ShowRegionTask implements IConfigTask {
builder.getColumnBuilder(6).writeInt(regionInfo.getDataNodeId());
builder.getColumnBuilder(7).writeBinary(Binary.valueOf(regionInfo.getClientRpcIp()));
builder.getColumnBuilder(8).writeInt(regionInfo.getClientRpcPort());
+
builder.getColumnBuilder(9).writeBinary(Binary.valueOf(regionInfo.getRoleType()));
builder.declarePosition();
}
}
diff --git a/thrift-confignode/src/main/thrift/confignode.thrift
b/thrift-confignode/src/main/thrift/confignode.thrift
index 5742d09dce..3b59f48bd0 100644
--- a/thrift-confignode/src/main/thrift/confignode.thrift
+++ b/thrift-confignode/src/main/thrift/confignode.thrift
@@ -295,6 +295,7 @@ struct TRegionInfo {
6: required i64 seriesSlots
7: required i64 timeSlots
8: optional string status
+ 9: optional string roleType
}
struct TShowRegionResp {