You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/07/12 05:20:03 UTC
[GitHub] [iotdb] Beyyes commented on a diff in pull request #6631: [IOTDB-3792] Show region tool support query condition of storage group
Beyyes commented on code in PR #6631:
URL: https://github.com/apache/iotdb/pull/6631#discussion_r918506699
##########
tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ReadWriteIOUtils.java:
##########
@@ -815,6 +815,19 @@ public static void writeStringList(List<String> list, ByteBuffer buffer) {
}
}
+ /** write string list with self define length. */
+ public static void writeStringList(List<String> list, OutputStream outputStream)
Review Comment:
Is this method not used?
##########
docs/UserGuide/Maintenance-Tools/Maintenance-Command.md:
##########
@@ -179,6 +180,61 @@ IoTDB> show schema regions
+--------+------------+------+-------------+------------+----------+----------+---------+----+
Total line number = 2
It costs 0.012s
+
+IoTDB> show regions of storage group root.sg1
Review Comment:
The commands from `show regions of storage group root.sg1` to the end lacks the timeseries created statement.
##########
confignode/src/test/java/org/apache/iotdb/confignode/persistence/PartitionInfoTest.java:
##########
@@ -147,47 +148,51 @@ public void testSnapshot() throws TException, IOException {
@Test
public void testShowRegion() {
- partitionInfo.generateNextRegionGroupId();
-
- // Set StorageGroup
- partitionInfo.setStorageGroup(new SetStorageGroupPlan(new TStorageGroupSchema("root.test")));
-
- // Create a SchemaRegion
- CreateRegionGroupsPlan createRegionGroupsPlan = new CreateRegionGroupsPlan();
- TRegionReplicaSet schemaRegionReplicaSet =
- generateTRegionReplicaSet(
- testFlag.SchemaPartition.getFlag(),
- generateTConsensusGroupId(
- testFlag.SchemaPartition.getFlag(), TConsensusGroupType.SchemaRegion));
- createRegionGroupsPlan.addRegionGroup("root.test", schemaRegionReplicaSet);
- partitionInfo.createRegionGroups(createRegionGroupsPlan);
-
- // Create a DataRegion
- createRegionGroupsPlan = new CreateRegionGroupsPlan();
- TRegionReplicaSet dataRegionReplicaSet =
- generateTRegionReplicaSet(
- testFlag.DataPartition.getFlag(),
- generateTConsensusGroupId(
- testFlag.DataPartition.getFlag(), TConsensusGroupType.DataRegion));
- createRegionGroupsPlan.addRegionGroup("root.test", dataRegionReplicaSet);
- partitionInfo.createRegionGroups(createRegionGroupsPlan);
-
+ for (int i = 0; i < 2; i++) {
+ partitionInfo.generateNextRegionGroupId();
+
+ // Set StorageGroup
+ partitionInfo.setStorageGroup(
+ new SetStorageGroupPlan(new TStorageGroupSchema("root.test" + i)));
+
+ // Create a SchemaRegion
+ CreateRegionGroupsPlan createRegionGroupsPlan = new CreateRegionGroupsPlan();
+ TRegionReplicaSet schemaRegionReplicaSet =
+ generateTRegionReplicaSet(
+ testFlag.SchemaPartition.getFlag(),
+ generateTConsensusGroupId(
+ testFlag.SchemaPartition.getFlag(), TConsensusGroupType.SchemaRegion));
+ createRegionGroupsPlan.addRegionGroup("root.test" + i, schemaRegionReplicaSet);
+ partitionInfo.createRegionGroups(createRegionGroupsPlan);
+
+ // Create a DataRegion
+ createRegionGroupsPlan = new CreateRegionGroupsPlan();
+ TRegionReplicaSet dataRegionReplicaSet =
+ generateTRegionReplicaSet(
+ testFlag.DataPartition.getFlag(),
+ generateTConsensusGroupId(
+ testFlag.DataPartition.getFlag(), TConsensusGroupType.DataRegion));
+ createRegionGroupsPlan.addRegionGroup("root.test" + i, dataRegionReplicaSet);
+ partitionInfo.createRegionGroups(createRegionGroupsPlan);
+ }
GetRegionInfoListPlan regionReq = new GetRegionInfoListPlan();
- regionReq.setRegionType(null);
+ TShowRegionReq showRegionReq = new TShowRegionReq();
+ showRegionReq.setConsensusGroupType(null);
+ regionReq.setShowRegionReq(showRegionReq);
RegionInfoListResp regionInfoList1 =
(RegionInfoListResp) partitionInfo.getRegionInfoList(regionReq);
- Assert.assertEquals(regionInfoList1.getRegionInfoList().size(), 10);
+ Assert.assertEquals(regionInfoList1.getRegionInfoList().size(), 20);
regionInfoList1
.getRegionInfoList()
.forEach(
(regionInfo) -> {
Assert.assertEquals(regionInfo.getClientRpcIp(), "127.0.0.1");
Review Comment:
```
.forEach(
(regionInfo) -> {
Assert.assertEquals(regionInfo.getClientRpcIp(), "127.0.0.1");
});
```
can be replaced by
```
.forEach(
(regionInfo) -> Assert.assertEquals(regionInfo.getClientRpcIp(), "127.0.0.1"));
```
Same as usage below.
##########
docs/UserGuide/Maintenance-Tools/Maintenance-Command.md:
##########
@@ -179,6 +180,61 @@ IoTDB> show schema regions
+--------+------------+------+-------------+------------+----------+----------+---------+----+
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|
Review Comment:
Time Slots is alyaws 0 in `SchemaRegion`, if it's better to replaced it with some other symbol like '/'?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org