You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by zy...@apache.org on 2023/03/12 23:57:12 UTC

[iotdb] branch rc/1.1.0 updated (c9008d7c49 -> 113992805b)

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

zyk pushed a change to branch rc/1.1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git


    from c9008d7c49 [To rel/1.1][IOTDB-5240] Fix ConfigMTree snapshot deserialization while using template (#9248)
     new 498518686e [IOTDB-5619] Fix NPE in processing GroupByTagNode
     new cfe4dcdf25 add example of kill query in doc
     new 5963213013 [IOTDB-5644] Fix unexpected result when there are no select expressions after analyzed in query
     new 86c699eb3c [To rel/1.1][IOTDB-5653] replace first line /bin/sh with /bin/bash of all shell scripts (#9280)
     new d74d2f67de [To rel/1.1][IOTDB-5659] Fix dead lock condition in shutdown hook (#9275)
     new 10ea7ebdcf [IOTDB-4497][Doc] Improve NodeStatus definition
     new 0eb3c5d36c [IOTDB-5661] Update Docs
     new 113992805b Compatible with the client parameters on DataNode (#9272) (#9288)

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 cli/src/assembly/resources/sbin/start-cli.sh       |   2 +-
 cli/src/assembly/resources/tools/export-csv.sh     |   2 +-
 cli/src/assembly/resources/tools/export-tsfile.sh  |   2 +-
 cli/src/assembly/resources/tools/import-csv.sh     |   2 +-
 cli/src/assembly/resources/tools/load-tsfile.sh    |   2 +-
 docs/UserGuide/Cluster/Cluster-Maintenance.md      | 269 ++++++++++----------
 .../Maintenance-Tools/Maintenance-Command.md       |   7 +-
 docs/zh/UserGuide/Cluster/Cluster-Maintenance.md   | 270 +++++++++++----------
 .../Maintenance-Tools/Maintenance-Command.md       |   7 +-
 .../db/it/aggregation/IoTDBTagAggregationIT.java   |  55 ++++-
 .../IoTDBNoSelectExpressionAfterAnalyzedIT.java}   |  55 +++--
 .../src/assembly/resources/sbin/iotdb-common.sh    |   2 +-
 .../assembly/resources/sbin/start-standalone.sh    |   2 +-
 .../src/assembly/resources/sbin/stop-standalone.sh |   2 +-
 .../apache/iotdb/commons/conf/CommonConfig.java    |  10 +
 .../src/assembly/resources/sbin/rewrite-tsfile.sh  |   2 +-
 .../src/assembly/resources/sbin/remove-datanode.sh |   2 +-
 .../resources/tools/schema/print-schema-file.sh    |   2 +-
 .../resources/tools/schema/print-schema-log.sh     |   2 +-
 .../resources/tools/tsfile/print-iotdb-data-dir.sh |   2 +-
 .../resources/tools/tsfile/print-tsfile.sh         |   2 +-
 .../resources/tools/tsfile/settle-tsfile.sh        |   2 +-
 .../resources/tools/tsfile/split-tsfile-tool.sh    |   2 +-
 .../resources/tools/tsfile/validate-tsfile.sh      |   2 +-
 .../org/apache/iotdb/db/conf/IoTDBDescriptor.java  |  18 ++
 .../statemachine/DataRegionStateMachine.java       |   3 +-
 .../iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java  |  38 ++-
 .../db/mpp/plan/planner/OperatorTreeGenerator.java |   1 +
 .../db/mpp/plan/planner/SubPlanTypeExtractor.java  |  16 +-
 .../planner/plan/node/process/GroupByTagNode.java  |  27 +++
 .../apache/iotdb/db/service/IoTDBShutdownHook.java |   1 +
 .../plan/node/process/GroupByTagNodeSerdeTest.java |   2 +-
 server/src/test/resources/start-sync-test.sh       |   2 +-
 server/src/test/resources/stop-sync-test.sh        |   2 +-
 tools/check_sigs.sh                                |   2 +-
 tools/common.sh                                    |   2 +-
 tools/download_staged_release.sh                   |   2 +-
 37 files changed, 509 insertions(+), 314 deletions(-)
 copy integration-test/src/test/java/org/apache/iotdb/db/it/{path/IoTDBFullPathIT.java => query/IoTDBNoSelectExpressionAfterAnalyzedIT.java} (54%)


[iotdb] 02/08: add example of kill query in doc

Posted by zy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch rc/1.1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit cfe4dcdf25efff159134790c31b154db1b276277
Author: Weihao Li <60...@users.noreply.github.com>
AuthorDate: Thu Mar 9 20:20:19 2023 +0800

    add example of kill query in doc
---
 docs/UserGuide/Maintenance-Tools/Maintenance-Command.md    | 7 ++++++-
 docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/UserGuide/Maintenance-Tools/Maintenance-Command.md b/docs/UserGuide/Maintenance-Tools/Maintenance-Command.md
index 28e1051919..c981788b00 100644
--- a/docs/UserGuide/Maintenance-Tools/Maintenance-Command.md
+++ b/docs/UserGuide/Maintenance-Tools/Maintenance-Command.md
@@ -101,10 +101,15 @@ In addition to waiting for the query to time out passively, IoTDB also supports
 KILL QUERY <queryId>
 ```
 
-You can kill the specified query by specifying `queryId`.
+You can kill the specified query by specifying `queryId`. `queryId` is a string, so you need to put quotes around it.
 
 To get the executing `queryId`,you can use the [show queries](#show-queries) command, which will show the list of all executing queries.
 
+##### Example
+```sql
+kill query '20221205_114444_00003_5'
+```
+
 #### Kill all queries
 
 ```sql
diff --git a/docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md b/docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md
index 61759ce3f5..f56c9072a2 100644
--- a/docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md
+++ b/docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md
@@ -99,10 +99,15 @@ session.executeQueryStatement(String sql, long timeout)
 KILL QUERY <queryId>
 ```
 
-通过指定 `queryId` 可以中止指定的查询。
+通过指定 `queryId` 可以中止指定的查询,`queryId`是一个字符串,所以使用时需要添加引号。
 
 为了获取正在执行的查询 id,用户可以使用 [show queries](#show-queries) 命令,该命令将显示所有正在执行的查询列表。
 
+##### 示例
+```sql
+kill query '20221205_114444_00003_5'
+```
+
 #### 终止所有查询
 
 ```sql


[iotdb] 07/08: [IOTDB-5661] Update Docs

Posted by zy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch rc/1.1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 0eb3c5d36c3a83bf9a3918b888c3114785be034f
Author: Caideyipi <87...@users.noreply.github.com>
AuthorDate: Fri Mar 10 17:31:55 2023 +0800

    [IOTDB-5661] Update Docs
    
    [IOTDB-5661] Update Docs
---
 docs/UserGuide/Cluster/Cluster-Maintenance.md    | 254 ++++++++++++-----------
 docs/zh/UserGuide/Cluster/Cluster-Maintenance.md | 249 +++++++++++-----------
 2 files changed, 261 insertions(+), 242 deletions(-)

diff --git a/docs/UserGuide/Cluster/Cluster-Maintenance.md b/docs/UserGuide/Cluster/Cluster-Maintenance.md
index 5f3289a8a5..f10a4ed906 100644
--- a/docs/UserGuide/Cluster/Cluster-Maintenance.md
+++ b/docs/UserGuide/Cluster/Cluster-Maintenance.md
@@ -243,118 +243,120 @@ Currently, IoTDB supports show Region information by the following SQL:
 Show distribution of all Regions:
 ```
 IoTDB> show regions
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:20.011|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:20.395|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.637|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 12
 It costs 0.165s
 ```
 
+The SeriesSlotNum refers to the number of the seriesSlots in the region. In the same light, the TimeSlotNum means the number of the timeSlots in the region.
+
 Show the distribution of SchemaRegions or DataRegions:
 ```
 IoTDB> show data regions
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:20.011|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:20.395|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.011s
 
 IoTDB> show schema regions
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.637|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.012s
 ```
 
-Show Region distribution of specified StorageGroups:
+Show Region distribution of specified DataBases:
 ```
 IoTDB> show regions of database root.sg1
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+-- -----+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+-- -----+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.007s
 
 IoTDB> show regions of database root.sg1, root.sg2
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:20.011|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:20.395|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.637|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 12
 It costs 0.009s
 
 IoTDB> show data regions of database root.sg1, root.sg2
-+--------+----------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|      Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+----------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       2|DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       2|DataRegion|Running|root.sg2|          1|        1|         3| 127.0.0.1|   6669|Follower|
-+--------+----------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+----------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|      Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+----------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       2|DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:20.011|
+|       2|DataRegion|Running|root.sg2|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:20.395|
++--------+----------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.007s
 
 IoTDB> show schema regions of database root.sg1, root.sg2
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.637|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.009s
 ```
@@ -362,30 +364,30 @@ It costs 0.009s
 Show Region distribution on specified Nodes:
 ```
 IoTDB> show regions on nodeid 1
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 4
 It costs 0.165s
 
 IoTDB> show regions on nodeid 1, 2
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:19.011|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 8
 It costs 0.165s
 ```
@@ -393,24 +395,24 @@ It costs 0.165s
 Show Region distribution of specified StorageGroups on specified Nodes:
 ```
 IoTDB> show regions of database root.sg1 on nodeid 1
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 2
 It costs 0.165s
 
 IoTDB> show data regions of database root.sg1, root.sg2 on nodeid 1, 2 
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:19.011|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 4
 It costs 0.165s
 ```
@@ -434,10 +436,12 @@ other Running Regions of the same RegionGroup ensure the high availability of Re
 
 ## Show cluster slots information
 
-The cluster uses partitions for schema and data arrangement, the partition is defined as follows:
+The cluster uses partitions for schema and data arrangement, the partition defined as follows:
+
+- `SchemaPartition`: SeriesSlot
+- `DataPartition`: <SeriesSlot, SeriesTimeSlot>
 
-- `SchemaPartition`: series slot
-- `DataPartition`: <series slot, time slot>
+More details can be found in the [Cluster-Concept](./Cluster-Concept.md) document.
 
 The cluster slots information can be shown by the following SQLs:
 
@@ -446,9 +450,15 @@ The cluster slots information can be shown by the following SQLs:
 Show the DataRegion where a DataPartition(or all DataPartitions under a same series slot) resides in:
 - `SHOW DATA REGIONID OF root.sg WHERE SERIESSLOTID=s0 (AND TIMESLOTID=t0)`
 
-The "SERIESSLOTID=s0" can be substituted by "DEVICEID=xxx.xx.xx". Using this, the sql will calculate the seriesSlot corresponding to that deviceId.
+Specifications:
+
+1. The s0, t0 must be numbers. 
+   
+2. The "TimeSlotId" is short for "SeriesTimeSlotId".
+
+3. The "SERIESSLOTID=s0" can be substituted by "DEVICEID=xxx.xx.xx". Using this, the sql will calculate the seriesSlot corresponding to that deviceId.
 
-Also, the "TIMESLOTID=t0" can be replaced by "TIMESTAMP=t1". In this case, the sql will calculate the timeSlot the timestamp belongs to, which starts before the timeStamp and (implicitly) ends after it.
+4. The "TIMESLOTID=t0" can be replaced by "TIMESTAMP=t1". In this case, the sql will calculate the timeSlot the timestamp belongs to, which starts before the timeStamp and (implicitly) ends after it.
 
 Eg:
 ```
diff --git a/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md b/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md
index 6cbc46329a..ea7dd151d0 100644
--- a/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md
+++ b/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md
@@ -243,53 +243,54 @@ It costs 0.340s
 展示所有 Region 的分布:
 ```
 IoTDB> show regions
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:20.011|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:20.395|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.637|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 12
 It costs 0.165s
 ```
+其中,SeriesSlotNum 指的是 region 内 seriesSlot 的个数。同样地,TimeSlotNum 也指 region 内 timeSlot 的个数。
 
 展示 SchemaRegion 或 DataRegion 的分布:
 ```
 IoTDB> show data regions
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:20.011|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:20.395|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.011s
 
 IoTDB> show schema regions
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.637|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.012s
 ```
@@ -297,64 +298,64 @@ It costs 0.012s
 展示指定数据库 <sg1,sg2,...> 对应的 Region 分布:
 ```
 IoTDB> show regions of database root.sg1
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+-- -----+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+-- -----+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.007s
 
 IoTDB> show regions of database root.sg1, root.sg2
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:20.011|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:20.395|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.637|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 12
 It costs 0.009s
 
 IoTDB> show data regions of database root.sg1, root.sg2
-+--------+----------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|      Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+----------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       0|DataRegion|Running|root.sg1|          1|        1|         3| 127.0.0.1|   6669|Follower|
-|       2|DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       2|DataRegion|Running|root.sg2|          1|        1|         3| 127.0.0.1|   6669|Follower|
-+--------+----------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+----------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|      Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+----------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       0|DataRegion|Running|root.sg1|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.013|
+|       2|DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:20.011|
+|       2|DataRegion|Running|root.sg2|            1|          1|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:20.395|
++--------+----------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.007s
 
 IoTDB> show schema regions of database root.sg1, root.sg2
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         3| 127.0.0.1|   6669|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         3| 127.0.0.1|   6669|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         3| 127.0.0.1|   6669|  Leader|2023-03-07T17:32:18.398|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         3| 127.0.0.1|   6669|Follower|2023-03-07T17:32:19.637|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 6
 It costs 0.009s
 ```
@@ -362,30 +363,30 @@ It costs 0.009s
 展示指定节点 <id1,id2,...> 对应的 Region 分布:
 ```
 IoTDB> show regions on nodeid 1
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 4
 It costs 0.165s
 
 IoTDB> show regions on nodeid 1, 2
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         2| 127.0.0.1|   6668|Follower|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         1| 127.0.0.1|   6667|Follower|
-|       3|SchemaRegion|Running|root.sg2|          1|        0|         2| 127.0.0.1|   6668|  Leader|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:18.245|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:19.011|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:19.232|
+|       3|SchemaRegion|Running|root.sg2|            1|          0|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:19.450|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 8
 It costs 0.165s
 ```
@@ -393,24 +394,24 @@ It costs 0.165s
 展示指定数据库 <sg1,sg2,...> 在指定节点 <id1,id2,...> 对应的 Region 分布:
 ```
 IoTDB> show regions of database root.sg1 on nodeid 1
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       1|SchemaRegion|Running|root.sg1|          1|        0|         1| 127.0.0.1|   6667|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       1|SchemaRegion|Running|root.sg1|            1|          0|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.111|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 2
 It costs 0.165s
 
 IoTDB> show data regions of database root.sg1, root.sg2 on nodeid 1, 2 
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|RegionId|        Type| Status|Database|SeriesSlots|TimeSlots|DataNodeId|RpcAddress|RpcPort|    Role|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
-|       0|  DataRegion|Running|root.sg1|          1|        1|         1| 127.0.0.1|   6667|Follower|
-|       0|  DataRegion|Running|root.sg1|          1|        1|         2| 127.0.0.1|   6668|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         1| 127.0.0.1|   6667|  Leader|
-|       2|  DataRegion|Running|root.sg2|          1|        1|         2| 127.0.0.1|   6668|Follower|
-+--------+------------+-------+--------+-----------+---------+----------+----------+-------+--------+
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|RegionId|        Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|    Role|             CreateTime|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
+|       0|  DataRegion|Running|root.sg1|            1|          1|         1| 127.0.0.1|   6667|Follower|2023-03-07T17:32:18.520|
+|       0|  DataRegion|Running|root.sg1|            1|          1|         2| 127.0.0.1|   6668|  Leader|2023-03-07T17:32:18.749|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         1| 127.0.0.1|   6667|  Leader|2023-03-07T17:32:19.834|
+|       2|  DataRegion|Running|root.sg2|            1|          1|         2| 127.0.0.1|   6668|Follower|2023-03-07T17:32:19.011|
++--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
 Total line number = 4
 It costs 0.165s
 ```
@@ -435,8 +436,10 @@ Region 继承所在 DataNode 的状态,对 Region 各状态定义如下:
 
 集群使用分区来管理元数据和数据,分区定义如下:
 
-- **元数据分区**:序列槽
-- **数据分区**:<序列槽,时间分区槽>
+- **元数据分区**:SeriesSlot
+- **数据分区**:<SeriesSlot,SeriesTimeSlot>
+
+在文档[Cluster-Concept](./Cluster-Concept.md)中可以查看详细信息。
 
 可以使用以下 SQL 来查询分区对应信息:
 
@@ -445,9 +448,15 @@ Region 继承所在 DataNode 的状态,对 Region 各状态定义如下:
 展示一个数据分区(或一个序列槽下的所有数据分区)所在的 DataRegion:
 - `SHOW DATA REGIONID OF root.sg WHERE SERIESSLOTID=s0 (AND TIMESLOTID=t0)`
   
-其中,”SERIESSLOTID=s0”可以被替换为”DEVICEID=xxx.xx.xx“. 这样的话,sql会自动计算对应该设备id的序列槽。
+有如下几点说明:
+
+1. s0、t0均只能为数字。 
+   
+2. TimeSlotId 是 SeriesTimeSlotId 的简称。
+
+2. ”SERIESSLOTID=s0”可以被替换为”DEVICEID=xxx.xx.xx“。 这样的话,sql会自动计算对应该设备id的序列槽。
 
-同样的,"TIMESLOTID=t0"也可以被替换为"TIMESTAMP=t1"。这样,SQL会计算该时间戳对应的时间槽,也就是时间段包含该时间戳的时间槽。
+3. 同样的,"TIMESLOTID=t0"也可以被替换为"TIMESTAMP=t1"。这样,SQL会计算该时间戳对应的时间槽,也就是时间段包含该时间戳的时间槽。
 
 
 示例:


[iotdb] 01/08: [IOTDB-5619] Fix NPE in processing GroupByTagNode

Posted by zy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch rc/1.1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 498518686e7bc06ac5eaff1d1fe268989ea0444e
Author: BaiJian <er...@hotmail.com>
AuthorDate: Thu Mar 9 13:46:46 2023 +0800

    [IOTDB-5619] Fix NPE in processing GroupByTagNode
---
 .../db/it/aggregation/IoTDBTagAggregationIT.java   | 55 +++++++++++++++++++++-
 .../db/mpp/plan/planner/OperatorTreeGenerator.java |  1 +
 .../db/mpp/plan/planner/SubPlanTypeExtractor.java  | 16 ++++---
 .../planner/plan/node/process/GroupByTagNode.java  | 27 +++++++++++
 .../plan/node/process/GroupByTagNodeSerdeTest.java |  2 +-
 5 files changed, 92 insertions(+), 9 deletions(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java
index 9ca72958e5..acd72723a0 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java
@@ -45,11 +45,13 @@ import static org.junit.Assert.fail;
 @RunWith(IoTDBTestRunner.class)
 @Category({ClusterIT.class})
 public class IoTDBTagAggregationIT {
+  private final double E = 0.00001D;
   protected static final String[] DATASET =
       new String[] {
         "CREATE DATABASE root.sg.a;",
         "CREATE DATABASE root.sg.b;",
         "CREATE DATABASE root.sg2.c;",
+        "CREATE DATABASE root.case2;",
         "create timeseries root.sg.a.d1.t with datatype=FLOAT tags(k1=k1v1, k2=k2v1, k3=k3v1);",
         "create timeseries root.sg.b.d2.t with datatype=FLOAT tags(k1=k1v1, k2=k2v2);",
         "create timeseries root.sg.a.d3.t with datatype=FLOAT tags(k1=k1v2, k2=k2v1);",
@@ -72,7 +74,17 @@ public class IoTDBTagAggregationIT {
         "insert into root.sg.b.d4(time, t) values(10, 5.4);",
         "insert into root.sg.a.d5(time, t) values(10, 6.5);",
         "insert into root.sg.b.d6(time, t) values(10, 7.6);",
-        "insert into root.sg.a.d7(time, t) values(10, 8.7);"
+        "insert into root.sg.a.d7(time, t) values(10, 8.7);",
+
+        // test multi value with multi aggregation column
+        "create timeseries root.case2.d1.s1 with datatype=FLOAT tags(k1=v1);",
+        "create timeseries root.case2.d2.s1 with datatype=FLOAT tags(k1=v1);",
+        "create timeseries root.case2.d1.s2 with datatype=FLOAT tags(k1=v2);",
+        "create timeseries root.case2.d3.s1 with datatype=FLOAT tags(k1=v2);",
+        "insert into root.case2.d1(time, s1) values(10, 8.8);",
+        "insert into root.case2.d2(time, s1) values(10, 7.7);",
+        "insert into root.case2.d1(time, s2) values(10, 6.6);",
+        "insert into root.case2.d3(time, s1) values(10, 9.9);",
       };
 
   protected static final double DELTA = 0.001D;
@@ -527,4 +539,45 @@ public class IoTDBTagAggregationIT {
           e.getMessage().contains("Having clause is not supported yet in GROUP BY TAGS query"));
     }
   }
+
+  @Test
+  public void testWithEmptyGroupedTimeSeries() {
+    String query = "SELECT avg(s1), avg(s2) FROM root.case2.** GROUP BY TAGS(k1)";
+    // Expected result set:
+    // +--+-----------------+-----------------+
+    // |k1|          avg(s1)|          avg(s2)|
+    // +--+-----------------+-----------------+
+    // |v1|             8.25|             null|
+    // |v2|9.899999618530273|6.599999904632568|
+    // +--+-----------------+-----------------+
+    try (Connection connection = EnvFactory.getEnv().getConnection();
+        Statement statement = connection.createStatement()) {
+      try (ResultSet resultSet = statement.executeQuery(query)) {
+        Assert.assertEquals(3, resultSet.getMetaData().getColumnCount());
+        Set<String> groups = new HashSet<>();
+        for (int i = 0; i < 2; i++) {
+          Assert.assertTrue(resultSet.next());
+          String tagValue = resultSet.getString("k1");
+          switch (tagValue) {
+            case "v1":
+              Assert.assertEquals(8.25D, resultSet.getDouble("avg(s1)"), E);
+              Assert.assertEquals(0.0D, resultSet.getDouble("avg(s2)"), E);
+              break;
+            case "v2":
+              Assert.assertEquals(9.899999618530273D, resultSet.getDouble("avg(s1)"), E);
+              Assert.assertEquals(6.599999904632568D, resultSet.getDouble("avg(s2)"), E);
+              break;
+            default:
+              fail("Unexpected tag value: " + tagValue);
+          }
+          groups.add(tagValue);
+        }
+        Assert.assertEquals(2, groups.size());
+        Assert.assertFalse(resultSet.next());
+      }
+    } catch (SQLException e) {
+      e.printStackTrace();
+      fail(e.getMessage());
+    }
+  }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java
index 06031866fd..1c6377feb4 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java
@@ -1314,6 +1314,7 @@ public class OperatorTreeGenerator extends PlanVisitor<Operator, LocalExecutionP
     List<AggregationDescriptor> aggregationDescriptors =
         node.getTagValuesToAggregationDescriptors().values().stream()
             .flatMap(Collection::stream)
+            .filter(Objects::nonNull)
             .collect(Collectors.toList());
     long maxReturnSize =
         calculateMaxAggregationResultSize(
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/SubPlanTypeExtractor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/SubPlanTypeExtractor.java
index af88b10cf7..e80f721677 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/SubPlanTypeExtractor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/SubPlanTypeExtractor.java
@@ -36,7 +36,8 @@ import org.apache.iotdb.db.mpp.plan.planner.plan.node.source.LastQueryScanNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.source.SeriesAggregationScanNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.parameter.AggregationDescriptor;
 
-import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
 
 public class SubPlanTypeExtractor {
 
@@ -86,19 +87,19 @@ public class SubPlanTypeExtractor {
 
     @Override
     public Void visitAggregation(AggregationNode node, Void context) {
-      updateTypeProviderByAggregationDescriptor(node.getAggregationDescriptorList());
+      updateTypeProviderByAggregationDescriptor(node.getAggregationDescriptorList().stream());
       return visitPlan(node, context);
     }
 
     @Override
     public Void visitSlidingWindowAggregation(SlidingWindowAggregationNode node, Void context) {
-      updateTypeProviderByAggregationDescriptor(node.getAggregationDescriptorList());
+      updateTypeProviderByAggregationDescriptor(node.getAggregationDescriptorList().stream());
       return visitPlan(node, context);
     }
 
     @Override
     public Void visitGroupByLevel(GroupByLevelNode node, Void context) {
-      updateTypeProviderByAggregationDescriptor(node.getGroupByLevelDescriptors());
+      updateTypeProviderByAggregationDescriptor(node.getGroupByLevelDescriptors().stream());
       return visitPlan(node, context);
     }
 
@@ -106,7 +107,8 @@ public class SubPlanTypeExtractor {
     public Void visitGroupByTag(GroupByTagNode node, Void context) {
       node.getTagValuesToAggregationDescriptors()
           .values()
-          .forEach(this::updateTypeProviderByAggregationDescriptor);
+          .forEach(
+              v -> updateTypeProviderByAggregationDescriptor(v.stream().filter(Objects::nonNull)));
       return visitPlan(node, context);
     }
 
@@ -140,8 +142,8 @@ public class SubPlanTypeExtractor {
     // end region PlanNode of last query
 
     private void updateTypeProviderByAggregationDescriptor(
-        List<? extends AggregationDescriptor> aggregationDescriptorList) {
-      aggregationDescriptorList.stream()
+        Stream<? extends AggregationDescriptor> aggregationDescriptorList) {
+      aggregationDescriptorList
           .flatMap(aggregationDescriptor -> aggregationDescriptor.getInputExpressions().stream())
           .forEach(
               expression -> {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/process/GroupByTagNode.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/process/GroupByTagNode.java
index 2089696218..bb77acd56d 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/process/GroupByTagNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/process/GroupByTagNode.java
@@ -209,6 +209,31 @@ public class GroupByTagNode extends MultiChildProcessNode {
     return tagKeys;
   }
 
+  /**
+   * The CrossSeriesAggregationDescriptor may be null if there exists a key containing no
+   * timeSeries.
+   *
+   * <p>e.g. we have following timeSeries:
+   *
+   * <ul>
+   *   <li>root.sg.d1.s1(k1=v1)
+   *   <li>root.sg.d1.s2(k1=v1)
+   *   <li>root.sg.d2.s1(k1=v2)
+   *   <li>root.sg.d3.s1(k1=v2)
+   * </ul>
+   *
+   * Then the query <code>
+   * SELECT avg(s1), avg(s2) FROM root.sg.** GROUP BY TAGS(k1)
+   * </code>will generate a {@link GroupByTagNode} with the <code>TagValuesToAggregationDescriptors
+   * </code> as below: <code>
+   *   {
+   *     ["v1"]: [["avg(root.sg.d1.s1)"], ["avg(root.sg.d1.s2)"]],
+   *     ["v2"]: [["avg(root.sg.d2.s1)","avg(root.sg.d3.s1)"], null],
+   *   }
+   * </code>
+   *
+   * <p>So we should use it carefully with null values.
+   */
   public Map<List<String>, List<CrossSeriesAggregationDescriptor>>
       getTagValuesToAggregationDescriptors() {
     return tagValuesToAggregationDescriptors;
@@ -230,6 +255,8 @@ public class GroupByTagNode extends MultiChildProcessNode {
         byte isNotNull = ReadWriteIOUtils.readByte(byteBuffer);
         if (isNotNull == 1) {
           aggregationDescriptors.add(CrossSeriesAggregationDescriptor.deserialize(byteBuffer));
+        } else {
+          aggregationDescriptors.add(null);
         }
         numOfAggregationDescriptors -= 1;
       }
diff --git a/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/process/GroupByTagNodeSerdeTest.java b/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/process/GroupByTagNodeSerdeTest.java
index 0f35462af4..b0c0c139e5 100644
--- a/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/process/GroupByTagNodeSerdeTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/process/GroupByTagNodeSerdeTest.java
@@ -92,7 +92,7 @@ public class GroupByTagNodeSerdeTest {
     Map<List<String>, List<CrossSeriesAggregationDescriptor>> tagValuesToAggregationDescriptors =
         new HashMap<>();
     tagValuesToAggregationDescriptors.put(
-        Arrays.asList("v1", "v2"), Arrays.asList(s1MaxTime, s1Avg));
+        Arrays.asList("v1", "v2"), Arrays.asList(s1MaxTime, null, s1Avg));
     GroupByTagNode expectedNode =
         new GroupByTagNode(
             new PlanNodeId("TestGroupByTagNode"),


[iotdb] 08/08: Compatible with the client parameters on DataNode (#9272) (#9288)

Posted by zy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch rc/1.1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 113992805be7ea950b368ce58f8454e9c6571179
Author: YongzaoDan <33...@users.noreply.github.com>
AuthorDate: Fri Mar 10 19:28:37 2023 +0800

    Compatible with the client parameters on DataNode (#9272) (#9288)
---
 .../java/org/apache/iotdb/db/conf/IoTDBDescriptor.java | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index 0432754ab7..5efca9f11d 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -229,6 +229,14 @@ public class IoTDBDescriptor {
                     "dn_connection_timeout_ms", String.valueOf(conf.getConnectionTimeoutInMS()))
                 .trim()));
 
+    if (properties.getProperty("dn_core_client_count_for_each_node_in_client_manager", null)
+        != null) {
+      conf.setCoreClientNumForEachNode(
+          Integer.parseInt(
+              properties.getProperty("dn_core_connection_for_internal_service").trim()));
+      logger.warn(
+          "The parameter dn_core_connection_for_internal_service is out of date. Please rename it to dn_core_client_count_for_each_node_in_client_manager.");
+    }
     conf.setCoreClientNumForEachNode(
         Integer.parseInt(
             properties
@@ -237,6 +245,16 @@ public class IoTDBDescriptor {
                     String.valueOf(conf.getCoreClientNumForEachNode()))
                 .trim()));
 
+    if (properties.getProperty("dn_max_client_count_for_each_node_in_client_manager", null)
+        != null) {
+      conf.setMaxClientNumForEachNode(
+          Integer.parseInt(
+              properties
+                  .getProperty("dn_max_client_count_for_each_node_in_client_manager")
+                  .trim()));
+      logger.warn(
+          "The parameter dn_max_client_count_for_each_node_in_client_manager is out of date. Please rename it to dn_max_client_count_for_each_node_in_client_manager.");
+    }
     conf.setMaxClientNumForEachNode(
         Integer.parseInt(
             properties


[iotdb] 04/08: [To rel/1.1][IOTDB-5653] replace first line /bin/sh with /bin/bash of all shell scripts (#9280)

Posted by zy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch rc/1.1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 86c699eb3cfc12a6c63131109e6ee09bab67390b
Author: changxue2022 <11...@users.noreply.github.com>
AuthorDate: Fri Mar 10 11:22:13 2023 +0800

    [To rel/1.1][IOTDB-5653] replace first line /bin/sh with /bin/bash of all shell scripts (#9280)
---
 cli/src/assembly/resources/sbin/start-cli.sh                       | 2 +-
 cli/src/assembly/resources/tools/export-csv.sh                     | 2 +-
 cli/src/assembly/resources/tools/export-tsfile.sh                  | 2 +-
 cli/src/assembly/resources/tools/import-csv.sh                     | 2 +-
 cli/src/assembly/resources/tools/load-tsfile.sh                    | 2 +-
 node-commons/src/assembly/resources/sbin/iotdb-common.sh           | 2 +-
 node-commons/src/assembly/resources/sbin/start-standalone.sh       | 2 +-
 node-commons/src/assembly/resources/sbin/stop-standalone.sh        | 2 +-
 rewrite-tsfile-tool/src/assembly/resources/sbin/rewrite-tsfile.sh  | 2 +-
 server/src/assembly/resources/sbin/remove-datanode.sh              | 2 +-
 server/src/assembly/resources/tools/schema/print-schema-file.sh    | 2 +-
 server/src/assembly/resources/tools/schema/print-schema-log.sh     | 2 +-
 server/src/assembly/resources/tools/tsfile/print-iotdb-data-dir.sh | 2 +-
 server/src/assembly/resources/tools/tsfile/print-tsfile.sh         | 2 +-
 server/src/assembly/resources/tools/tsfile/settle-tsfile.sh        | 2 +-
 server/src/assembly/resources/tools/tsfile/split-tsfile-tool.sh    | 2 +-
 server/src/assembly/resources/tools/tsfile/validate-tsfile.sh      | 2 +-
 server/src/test/resources/start-sync-test.sh                       | 2 +-
 server/src/test/resources/stop-sync-test.sh                        | 2 +-
 tools/check_sigs.sh                                                | 2 +-
 tools/common.sh                                                    | 2 +-
 tools/download_staged_release.sh                                   | 2 +-
 22 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/cli/src/assembly/resources/sbin/start-cli.sh b/cli/src/assembly/resources/sbin/start-cli.sh
index d9650ce94e..e384cfa728 100755
--- a/cli/src/assembly/resources/sbin/start-cli.sh
+++ b/cli/src/assembly/resources/sbin/start-cli.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/cli/src/assembly/resources/tools/export-csv.sh b/cli/src/assembly/resources/tools/export-csv.sh
index 51bed92344..41daf679e3 100644
--- a/cli/src/assembly/resources/tools/export-csv.sh
+++ b/cli/src/assembly/resources/tools/export-csv.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/cli/src/assembly/resources/tools/export-tsfile.sh b/cli/src/assembly/resources/tools/export-tsfile.sh
index cb9d74765e..a19eec09f4 100644
--- a/cli/src/assembly/resources/tools/export-tsfile.sh
+++ b/cli/src/assembly/resources/tools/export-tsfile.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/cli/src/assembly/resources/tools/import-csv.sh b/cli/src/assembly/resources/tools/import-csv.sh
index e64643456a..c90365d30c 100644
--- a/cli/src/assembly/resources/tools/import-csv.sh
+++ b/cli/src/assembly/resources/tools/import-csv.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/cli/src/assembly/resources/tools/load-tsfile.sh b/cli/src/assembly/resources/tools/load-tsfile.sh
index 27facd0224..8e2cbc8102 100644
--- a/cli/src/assembly/resources/tools/load-tsfile.sh
+++ b/cli/src/assembly/resources/tools/load-tsfile.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/node-commons/src/assembly/resources/sbin/iotdb-common.sh b/node-commons/src/assembly/resources/sbin/iotdb-common.sh
index cc748e946d..3d99851e2c 100755
--- a/node-commons/src/assembly/resources/sbin/iotdb-common.sh
+++ b/node-commons/src/assembly/resources/sbin/iotdb-common.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/node-commons/src/assembly/resources/sbin/start-standalone.sh b/node-commons/src/assembly/resources/sbin/start-standalone.sh
index 7abbef918a..6d81239ab0 100644
--- a/node-commons/src/assembly/resources/sbin/start-standalone.sh
+++ b/node-commons/src/assembly/resources/sbin/start-standalone.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/node-commons/src/assembly/resources/sbin/stop-standalone.sh b/node-commons/src/assembly/resources/sbin/stop-standalone.sh
index 1bcb7626e6..d588fe902e 100644
--- a/node-commons/src/assembly/resources/sbin/stop-standalone.sh
+++ b/node-commons/src/assembly/resources/sbin/stop-standalone.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/rewrite-tsfile-tool/src/assembly/resources/sbin/rewrite-tsfile.sh b/rewrite-tsfile-tool/src/assembly/resources/sbin/rewrite-tsfile.sh
index 606ee545ee..2437774eb0 100644
--- a/rewrite-tsfile-tool/src/assembly/resources/sbin/rewrite-tsfile.sh
+++ b/rewrite-tsfile-tool/src/assembly/resources/sbin/rewrite-tsfile.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/assembly/resources/sbin/remove-datanode.sh b/server/src/assembly/resources/sbin/remove-datanode.sh
index 6bb08d25e8..ada9089aa4 100644
--- a/server/src/assembly/resources/sbin/remove-datanode.sh
+++ b/server/src/assembly/resources/sbin/remove-datanode.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/assembly/resources/tools/schema/print-schema-file.sh b/server/src/assembly/resources/tools/schema/print-schema-file.sh
index 8bc98a4285..1f7df6a107 100644
--- a/server/src/assembly/resources/tools/schema/print-schema-file.sh
+++ b/server/src/assembly/resources/tools/schema/print-schema-file.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/assembly/resources/tools/schema/print-schema-log.sh b/server/src/assembly/resources/tools/schema/print-schema-log.sh
index 6003249684..6730b23131 100644
--- a/server/src/assembly/resources/tools/schema/print-schema-log.sh
+++ b/server/src/assembly/resources/tools/schema/print-schema-log.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/assembly/resources/tools/tsfile/print-iotdb-data-dir.sh b/server/src/assembly/resources/tools/tsfile/print-iotdb-data-dir.sh
index 9deb80b9c4..131d67d362 100644
--- a/server/src/assembly/resources/tools/tsfile/print-iotdb-data-dir.sh
+++ b/server/src/assembly/resources/tools/tsfile/print-iotdb-data-dir.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/assembly/resources/tools/tsfile/print-tsfile.sh b/server/src/assembly/resources/tools/tsfile/print-tsfile.sh
index 35c26594f2..8864ca877e 100644
--- a/server/src/assembly/resources/tools/tsfile/print-tsfile.sh
+++ b/server/src/assembly/resources/tools/tsfile/print-tsfile.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/assembly/resources/tools/tsfile/settle-tsfile.sh b/server/src/assembly/resources/tools/tsfile/settle-tsfile.sh
index 384a82cf94..3071360468 100644
--- a/server/src/assembly/resources/tools/tsfile/settle-tsfile.sh
+++ b/server/src/assembly/resources/tools/tsfile/settle-tsfile.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/assembly/resources/tools/tsfile/split-tsfile-tool.sh b/server/src/assembly/resources/tools/tsfile/split-tsfile-tool.sh
index 0af432f7f8..0265cb4ac2 100644
--- a/server/src/assembly/resources/tools/tsfile/split-tsfile-tool.sh
+++ b/server/src/assembly/resources/tools/tsfile/split-tsfile-tool.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/assembly/resources/tools/tsfile/validate-tsfile.sh b/server/src/assembly/resources/tools/tsfile/validate-tsfile.sh
index f02121a573..c37bda1c1c 100644
--- a/server/src/assembly/resources/tools/tsfile/validate-tsfile.sh
+++ b/server/src/assembly/resources/tools/tsfile/validate-tsfile.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/test/resources/start-sync-test.sh b/server/src/test/resources/start-sync-test.sh
index 7ad92269c3..4754ce39e4 100644
--- a/server/src/test/resources/start-sync-test.sh
+++ b/server/src/test/resources/start-sync-test.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/server/src/test/resources/stop-sync-test.sh b/server/src/test/resources/stop-sync-test.sh
index cdddbf5b50..1e1ae6400b 100644
--- a/server/src/test/resources/stop-sync-test.sh
+++ b/server/src/test/resources/stop-sync-test.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
diff --git a/tools/check_sigs.sh b/tools/check_sigs.sh
index 6bf03a9c77..6e897e96f5 100755
--- a/tools/check_sigs.sh
+++ b/tools/check_sigs.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 ################################################################################
 ##
diff --git a/tools/common.sh b/tools/common.sh
index ef27f91977..68ced36a6b 100755
--- a/tools/common.sh
+++ b/tools/common.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 ################################################################################
 ##
diff --git a/tools/download_staged_release.sh b/tools/download_staged_release.sh
index cacd8be9bc..32708ccf67 100755
--- a/tools/download_staged_release.sh
+++ b/tools/download_staged_release.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 ################################################################################
 ##


[iotdb] 03/08: [IOTDB-5644] Fix unexpected result when there are no select expressions after analyzed in query

Posted by zy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch rc/1.1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 596321301301ce1aa7e939c0861b18d0ad72d0c6
Author: Weihao Li <60...@users.noreply.github.com>
AuthorDate: Fri Mar 10 10:48:59 2023 +0800

    [IOTDB-5644] Fix unexpected result when there are no select expressions after analyzed in query
---
 .../IoTDBNoSelectExpressionAfterAnalyzedIT.java    | 93 ++++++++++++++++++++++
 .../iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java  | 38 ++++++---
 2 files changed, 122 insertions(+), 9 deletions(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java
new file mode 100644
index 0000000000..8989d8a450
--- /dev/null
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java
@@ -0,0 +1,93 @@
+/*
+ * 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.db.it.query;
+
+import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.framework.IoTDBTestRunner;
+import org.apache.iotdb.itbase.category.ClusterIT;
+import org.apache.iotdb.itbase.category.LocalStandaloneIT;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import static org.apache.iotdb.db.it.utils.TestUtils.prepareData;
+import static org.apache.iotdb.db.it.utils.TestUtils.resultSetEqualTest;
+import static org.apache.iotdb.itbase.constant.TestConstant.DEVICE;
+import static org.apache.iotdb.itbase.constant.TestConstant.TIMESTAMP_STR;
+import static org.apache.iotdb.itbase.constant.TestConstant.count;
+import static org.apache.iotdb.itbase.constant.TestConstant.s1;
+import static org.apache.iotdb.itbase.constant.TestConstant.s2;
+
+@RunWith(IoTDBTestRunner.class)
+@Category({LocalStandaloneIT.class, ClusterIT.class})
+public class IoTDBNoSelectExpressionAfterAnalyzedIT {
+  private static final String[] SQLs =
+      new String[] {
+        "insert into root.sg.d1(time,s1) values(1,1)",
+        "insert into root.sg.d2(time,s1,s2) values(1,1,1)"
+      };
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+    EnvFactory.getEnv().initClusterEnvironment();
+    prepareData(SQLs);
+  }
+
+  @AfterClass
+  public static void tearDown() throws Exception {
+    EnvFactory.getEnv().cleanClusterEnvironment();
+  }
+
+  @Test
+  public void testAlignByDevice() {
+    String[] expectedHeader = new String[] {TIMESTAMP_STR};
+    String[] retArray = new String[] {};
+    resultSetEqualTest(
+        "select s2 from root.sg.d1 where s1>0 align by device", expectedHeader, retArray);
+
+    resultSetEqualTest(
+        "select count(s2) from root.sg.d1 where s1>0 align by device", expectedHeader, retArray);
+
+    // mix test
+    expectedHeader = new String[] {DEVICE, count(s1), count(s2)};
+    retArray = new String[] {"root.sg.d1,1,null,", "root.sg.d2,1,1,"};
+    resultSetEqualTest(
+        "select count(s1), count(s2) from root.sg.* where s1>0 align by device",
+        expectedHeader,
+        retArray);
+
+    expectedHeader = new String[] {TIMESTAMP_STR, DEVICE, s1, s2};
+    retArray = new String[] {"1,root.sg.d1,1.0,null,", "1,root.sg.d2,1.0,1.0,"};
+    resultSetEqualTest(
+        "select s1, s2 from root.sg.* where s1>0 align by device", expectedHeader, retArray);
+  }
+
+  @Test
+  public void testAlignByTime() {
+    String[] expectedHeader = new String[] {TIMESTAMP_STR};
+    String[] retArray = new String[] {};
+    resultSetEqualTest("select s2 from root.sg.d1 where s1>0", expectedHeader, retArray);
+
+    resultSetEqualTest("select count(s2) from root.sg.d1 where s1>0", expectedHeader, retArray);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
index 25953f8460..d46dfc0e9b 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
@@ -248,15 +248,7 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
 
       // If there is no leaf node in the schema tree, the query should be completed immediately
       if (schemaTree.isEmpty()) {
-        if (queryStatement.isSelectInto()) {
-          analysis.setRespDatasetHeader(
-              DatasetHeaderFactory.getSelectIntoHeader(queryStatement.isAlignByDevice()));
-        }
-        if (queryStatement.isLastQuery()) {
-          analysis.setRespDatasetHeader(DatasetHeaderFactory.getLastQueryHeader());
-        }
-        analysis.setFinishQueryAfterAnalyze(true);
-        return analysis;
+        return finishQuery(queryStatement, analysis);
       }
 
       // extract global time filter from query filter and determine if there is a value filter
@@ -285,7 +277,12 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
       List<Pair<Expression, String>> outputExpressions;
       if (queryStatement.isAlignByDevice()) {
         Set<PartialPath> deviceSet = analyzeFrom(queryStatement, schemaTree);
+
         outputExpressions = analyzeSelect(analysis, queryStatement, schemaTree, deviceSet);
+        if (deviceSet.isEmpty()) {
+          return finishQuery(queryStatement, analysis);
+        }
+
         analyzeDeviceToGroupBy(analysis, queryStatement, schemaTree, deviceSet);
         Map<String, Set<Expression>> deviceToAggregationExpressions = new HashMap<>();
         analyzeHaving(
@@ -306,6 +303,9 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
 
         outputExpressions = new ArrayList<>();
         outputExpressionMap.values().forEach(outputExpressions::addAll);
+        if (outputExpressions.isEmpty()) {
+          return finishQuery(queryStatement, analysis);
+        }
 
         analyzeGroupBy(analysis, queryStatement, schemaTree);
         analyzeHaving(analysis, queryStatement, schemaTree);
@@ -350,6 +350,18 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
     return analysis;
   }
 
+  private Analysis finishQuery(QueryStatement queryStatement, Analysis analysis) {
+    if (queryStatement.isSelectInto()) {
+      analysis.setRespDatasetHeader(
+          DatasetHeaderFactory.getSelectIntoHeader(queryStatement.isAlignByDevice()));
+    }
+    if (queryStatement.isLastQuery()) {
+      analysis.setRespDatasetHeader(DatasetHeaderFactory.getLastQueryHeader());
+    }
+    analysis.setFinishQueryAfterAnalyze(true);
+    return analysis;
+  }
+
   private void analyzeGlobalTimeFilter(Analysis analysis, QueryStatement queryStatement) {
     Filter globalTimeFilter = null;
     boolean hasValueFilter = false;
@@ -496,6 +508,7 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
     ColumnPaginationController paginationController =
         new ColumnPaginationController(
             queryStatement.getSeriesLimit(), queryStatement.getSeriesOffset(), false);
+    Set<PartialPath> noMeasurementDevices = new HashSet<>(deviceSet);
 
     for (ResultColumn resultColumn : queryStatement.getSelectComponent().getResultColumns()) {
       Expression selectExpression = resultColumn.getExpression();
@@ -508,6 +521,10 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
       for (PartialPath device : deviceSet) {
         List<Expression> selectExpressionsOfOneDevice =
             ExpressionAnalyzer.concatDeviceAndRemoveWildcard(selectExpression, device, schemaTree);
+        if (selectExpressionsOfOneDevice.isEmpty()) {
+          continue;
+        }
+        noMeasurementDevices.remove(device);
         for (Expression expression : selectExpressionsOfOneDevice) {
           Expression measurementExpression =
               ExpressionAnalyzer.getMeasurementExpression(expression);
@@ -568,6 +585,9 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
       }
     }
 
+    // remove devices without measurements to compute
+    deviceSet.removeAll(noMeasurementDevices);
+
     analysis.setDeviceToSelectExpressions(deviceToSelectExpressions);
     return outputExpressions;
   }


[iotdb] 06/08: [IOTDB-4497][Doc] Improve NodeStatus definition

Posted by zy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch rc/1.1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 10ea7ebdcf431c80bea9867adeb4d36be719fd50
Author: YongzaoDan <33...@users.noreply.github.com>
AuthorDate: Fri Mar 10 14:14:35 2023 +0800

    [IOTDB-4497][Doc] Improve NodeStatus definition
    
    [IOTDB-4497][Doc] Improve NodeStatus definition
---
 docs/UserGuide/Cluster/Cluster-Maintenance.md    | 15 +++++++++++++--
 docs/zh/UserGuide/Cluster/Cluster-Maintenance.md | 21 ++++++++++++++++-----
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/docs/UserGuide/Cluster/Cluster-Maintenance.md b/docs/UserGuide/Cluster/Cluster-Maintenance.md
index 0d61b46914..5f3289a8a5 100644
--- a/docs/UserGuide/Cluster/Cluster-Maintenance.md
+++ b/docs/UserGuide/Cluster/Cluster-Maintenance.md
@@ -136,8 +136,19 @@ The DataNode statuses are defined as follows:
   - The cluster is still readable and writable if some DataNodes are Removing
 - **ReadOnly**: The remaining disk space of DataNode is lower than disk_warning_threshold(default is 5%), the DataNode is readable but un-writable and cannot synchronize data.
   - The cluster is still readable and writable if some DataNodes are ReadOnly
-  - Schema, data and Database can be deleted in ReadOnly status
-  - Schema and data cannot be written to the cluster when all DataNodes are ReadOnly, but new Databases can still be created
+  - The schema and data in a ReadOnly DataNode is readable
+  - The schema and data in a ReadOnly DataNode is deletable
+  - A ReadOnly DataNode is creatable for schema, but un-writable for data
+  - Data cannot be written to the cluster when all DataNodes are ReadOnly, but new Databases and schema is still creatable
+
+**For a DataNode**, the following table describes the impact of schema read, write, and deletion in different status:
+
+| DataNode status | readable | creatable | deletable |
+|-----------------|----------|-----------|-----------|
+| Running         | yes      | yes       | yes       |
+| Unknown         | no       | no        | no        |
+| Removing        | no       | no        | no        |
+| ReadOnly        | yes      | yes       | yes       |
 
 **For a DataNode**, the following table describes the impact of data read, write, and deletion in different status:
 
diff --git a/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md b/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md
index 13d886631a..6cbc46329a 100644
--- a/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md
+++ b/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md
@@ -132,13 +132,24 @@ DataNode 的状态机如下图所示:
 
 - **Running**: DataNode 正常运行,可读可写
 - **Unknown**: DataNode 未正常上报心跳,ConfigNode 认为该 DataNode 不可读写
-  - 少数 DataNode Unknown 不影响集群读写
+  - 少数 Unknown DataNode 不影响集群读写
 - **Removing**: DataNode 正在移出集群,不可读写
-  - 少数 DataNode Removing 不影响集群读写 
+  - 少数 Removing DataNode 不影响集群读写 
 - **ReadOnly**: DataNode 磁盘剩余空间低于 disk_warning_threshold(默认 5%),DataNode 可读但不能写入,不能同步数据
-  - 少数 DataNode ReadOnly 不影响集群读写
-  - ReadOnly 状态下可以删除元数据和数据,可以删除 Database
-  - 所有 DataNode 处于 ReadOnly 状态时,集群不可写入元数据和数据,仍可以创建 Database
+  - 少数 ReadOnly DataNode 不影响集群读写
+  - ReadOnly DataNode 可以查询元数据和数据
+  - ReadOnly DataNode 可以删除元数据和数据
+  - ReadOnly DataNode 可以创建元数据,不能写入数据
+  - 所有 DataNode 处于 ReadOnly 状态时,集群不能写入数据,仍可以创建 Database 和元数据
+
+**对于一个 DataNode**,不同状态元数据查询、创建、删除的影响如下表所示:
+
+| DataNode 状态 | 可读  | 可创建 | 可删除 |
+|-------------|-----|-----|-----|
+| Running     | 是   | 是   | 是   |
+| Unknown     | 否   | 否   | 否   |
+| Removing    | 否   | 否   | 否   |
+| ReadOnly    | 是   | 是   | 是   |
 
 **对于一个 DataNode**,不同状态数据查询、写入、删除的影响如下表所示:
 


[iotdb] 05/08: [To rel/1.1][IOTDB-5659] Fix dead lock condition in shutdown hook (#9275)

Posted by zy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch rc/1.1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d74d2f67de19c22cde84be6a12d4122accca9a21
Author: William Song <48...@users.noreply.github.com>
AuthorDate: Fri Mar 10 13:25:17 2023 +0800

    [To rel/1.1][IOTDB-5659] Fix dead lock condition in shutdown hook (#9275)
---
 .../main/java/org/apache/iotdb/commons/conf/CommonConfig.java  | 10 ++++++++++
 .../db/consensus/statemachine/DataRegionStateMachine.java      |  3 ++-
 .../java/org/apache/iotdb/db/service/IoTDBShutdownHook.java    |  1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java b/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java
index a30d2dc974..bc6e07c36b 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java
@@ -116,6 +116,8 @@ public class CommonConfig {
   /** Status of current system. */
   private volatile NodeStatus status = NodeStatus.Running;
 
+  private volatile boolean isStopping = false;
+
   private volatile String statusReason = null;
 
   /** Disk Monitor */
@@ -360,4 +362,12 @@ public class CommonConfig {
   public void setTargetMLNodeEndPoint(TEndPoint targetMLNodeEndPoint) {
     this.targetMLNodeEndPoint = targetMLNodeEndPoint;
   }
+
+  public boolean isStopping() {
+    return isStopping;
+  }
+
+  public void setStopping(boolean stopping) {
+    isStopping = stopping;
+  }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java b/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
index 0c3d25725c..8fb012081b 100644
--- a/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
+++ b/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
@@ -83,7 +83,8 @@ public class DataRegionStateMachine extends BaseStateMachine {
 
   @Override
   public boolean isReadOnly() {
-    return CommonDescriptor.getInstance().getConfig().isReadOnly();
+    return CommonDescriptor.getInstance().getConfig().isReadOnly()
+        && !CommonDescriptor.getInstance().getConfig().isStopping();
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/service/IoTDBShutdownHook.java b/server/src/main/java/org/apache/iotdb/db/service/IoTDBShutdownHook.java
index 17d4662e6c..ef94e579f9 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/IoTDBShutdownHook.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/IoTDBShutdownHook.java
@@ -54,6 +54,7 @@ public class IoTDBShutdownHook extends Thread {
     }
 
     // reject write operations to make sure all tsfiles will be sealed
+    CommonDescriptor.getInstance().getConfig().setStopping(true);
     CommonDescriptor.getInstance().getConfig().setNodeStatus(NodeStatus.ReadOnly);
     // wait all wal are flushed
     WALManager.getInstance().waitAllWALFlushed();