You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2025/02/07 12:06:01 UTC

(iotdb) branch MaintainAuth updated (f69aa983339 -> 447fa266bd2)

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

jackietien pushed a change to branch MaintainAuth
in repository https://gitbox.apache.org/repos/asf/iotdb.git


    from f69aa983339 Support authentication for maintain statement
     add bbaa63bbc13 Add maintenance commands for table model
     new d35db770eb5 Merge remote-tracking branch 'origin/master' into MaintainAuth
     new 66cea45d1fe Support authentication for maintain statement
     new 447fa266bd2 Support authentication for maintain statement

The 3 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:
 .../org/apache/iotdb/db/it/utils/TestUtils.java    |  3 +-
 .../it/IoTDBLoadConfigurationTableIT.java}         | 75 +++++++++----------
 .../it/IoTDBSetSystemStatusTableIT.java}           | 85 ++++++++++++----------
 .../it/query/recent/IoTDBMaintainAuthIT.java       | 82 +++++++++++++++------
 .../iotdb/db/queryengine/plan/Coordinator.java     |  4 +
 .../execution/config/TableConfigTaskVisitor.java   | 20 +++++
 .../plan/relational/sql/ast/AstVisitor.java        |  8 ++
 ...{StopRepairData.java => LoadConfiguration.java} |  6 +-
 .../{StartRepairData.java => SetSystemStatus.java} |  6 +-
 .../plan/relational/sql/parser/AstBuilder.java     | 29 +++++++-
 10 files changed, 204 insertions(+), 114 deletions(-)
 copy integration-test/src/test/java/org/apache/iotdb/relational/it/{query/old/builtinfunction/scalar/IoTDBCastFunctionTableSpecialIT.java => db/it/IoTDBLoadConfigurationTableIT.java} (58%)
 copy integration-test/src/test/java/org/apache/iotdb/relational/it/{query/old/builtinfunction/scalar/IoTDBCastFunctionTableSpecialIT.java => db/it/IoTDBSetSystemStatusTableIT.java} (52%)
 copy iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/{StopRepairData.java => LoadConfiguration.java} (84%)
 copy iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/{StartRepairData.java => SetSystemStatus.java} (86%)


(iotdb) 02/03: Support authentication for maintain statement

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

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

commit 66cea45d1fe95f5cdb632ffb2d8b2e8908da4e13
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Fri Feb 7 19:56:14 2025 +0800

    Support authentication for maintain statement
---
 .../it/query/recent/IoTDBMaintainAuthIT.java       | 52 ++++++++++++++++++++--
 1 file changed, 49 insertions(+), 3 deletions(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBMaintainAuthIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBMaintainAuthIT.java
index df340a46cd0..a46cccc1974 100644
--- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBMaintainAuthIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBMaintainAuthIT.java
@@ -188,16 +188,18 @@ public class IoTDBMaintainAuthIT {
 
     // case 12: show queries
     // user1 with select on information_schema.queries
-    tableExecuteTest("show queries", USER_1, PASSWORD);
+    expectedHeader =
+        new String[] {"query_id", "start_time", "datanode_id", "elapsed_time", "statement"};
+    tableQueryNoVerifyResultTest("SHOW QUERIES", expectedHeader, USER_1, PASSWORD, DATABASE_NAME);
     // user2 without select on information_schema.queries
     tableAssertTestFail(
-        "show queries",
+        "SHOW QUERIES",
         TSStatusCode.NO_PERMISSION.getStatusCode()
             + ": Access Denied: No permissions for this operation, please add privilege SELECT ON information_schema.queries",
         USER_2,
         PASSWORD);
 
-    // case 12: kill query
+    // case 13: kill query
     // user1 with MAINTAIN
     tableAssertTestFail(
         "kill query '20250206_093300_00001_100'",
@@ -211,5 +213,49 @@ public class IoTDBMaintainAuthIT {
             + ": Access Denied: No permissions for this operation, please add privilege MAINTAIN",
         USER_2,
         PASSWORD);
+
+    // case 14: load configuration
+    // user1 with MAINTAIN
+    tableExecuteTest("LOAD CONFIGURATION", USER_1, PASSWORD);
+    // user2 without MAINTAIN
+    tableAssertTestFail(
+        "LOAD CONFIGURATION",
+        TSStatusCode.NO_PERMISSION.getStatusCode()
+            + ": Access Denied: No permissions for this operation, please add privilege MAINTAIN",
+        USER_2,
+        PASSWORD);
+
+    // case 15: set system status
+    // user1 with MAINTAIN
+    tableExecuteTest("SET SYSTEM TO RUNNING", USER_1, PASSWORD);
+    // user2 without MAINTAIN
+    tableAssertTestFail(
+        "SET SYSTEM TO RUNNING",
+        TSStatusCode.NO_PERMISSION.getStatusCode()
+            + ": Access Denied: No permissions for this operation, please add privilege MAINTAIN",
+        USER_2,
+        PASSWORD);
+
+    // case 16: start repair data
+    // user1 with MAINTAIN
+    tableExecuteTest("START REPAIR DATA", USER_1, PASSWORD);
+    // user2 without MAINTAIN
+    tableAssertTestFail(
+        "START REPAIR DATA",
+        TSStatusCode.NO_PERMISSION.getStatusCode()
+            + ": Access Denied: No permissions for this operation, please add privilege MAINTAIN",
+        USER_2,
+        PASSWORD);
+
+    // case 17: stop repair data
+    // user1 with MAINTAIN
+    tableExecuteTest("STOP REPAIR DATA", USER_1, PASSWORD);
+    // user2 without MAINTAIN
+    tableAssertTestFail(
+        "STOP REPAIR DATA",
+        TSStatusCode.NO_PERMISSION.getStatusCode()
+            + ": Access Denied: No permissions for this operation, please add privilege MAINTAIN",
+        USER_2,
+        PASSWORD);
   }
 }


(iotdb) 01/03: Merge remote-tracking branch 'origin/master' into MaintainAuth

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

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

commit d35db770eb562511443a91b47e6f3f322269ed76
Merge: f69aa983339 bbaa63bbc13
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Fri Feb 7 19:47:24 2025 +0800

    Merge remote-tracking branch 'origin/master' into MaintainAuth

 .../it/db/it/IoTDBLoadConfigurationTableIT.java    | 85 +++++++++++++++++++
 .../it/db/it/IoTDBSetSystemStatusTableIT.java      | 95 ++++++++++++++++++++++
 .../iotdb/db/queryengine/plan/Coordinator.java     |  4 +
 .../execution/config/TableConfigTaskVisitor.java   | 20 +++++
 .../plan/relational/sql/ast/AstVisitor.java        |  8 ++
 .../plan/relational/sql/ast/LoadConfiguration.java | 34 ++++++++
 .../plan/relational/sql/ast/SetSystemStatus.java   | 34 ++++++++
 .../plan/relational/sql/parser/AstBuilder.java     | 29 ++++++-
 8 files changed, 305 insertions(+), 4 deletions(-)



(iotdb) 03/03: Support authentication for maintain statement

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

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

commit 447fa266bd29c6567b8f18b2962b0dddb956e1f4
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Fri Feb 7 20:05:52 2025 +0800

    Support authentication for maintain statement
---
 .../org/apache/iotdb/db/it/utils/TestUtils.java    |  3 +-
 .../it/query/recent/IoTDBMaintainAuthIT.java       | 32 ++++++++--------------
 2 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java
index 330a2475915..c39cfb6ce6d 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java
@@ -282,12 +282,11 @@ public class TestUtils {
   }
 
   public static void tableQueryNoVerifyResultTest(
-      String sql, String[] expectedHeader, String userName, String password, String database) {
+      String sql, String[] expectedHeader, String userName, String password) {
     try (Connection connection =
         EnvFactory.getEnv().getConnection(userName, password, BaseEnv.TABLE_SQL_DIALECT)) {
       connection.setClientInfo("time_zone", "+00:00");
       try (Statement statement = connection.createStatement()) {
-        statement.execute("use " + database);
         try (ResultSet resultSet = statement.executeQuery(sql)) {
           ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
           for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBMaintainAuthIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBMaintainAuthIT.java
index a46cccc1974..55004d9dcf6 100644
--- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBMaintainAuthIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBMaintainAuthIT.java
@@ -75,7 +75,7 @@ public class IoTDBMaintainAuthIT {
     // user1 with select on table1
     String[] expectedHeader = new String[] {"distribution plan"};
     tableQueryNoVerifyResultTest(
-        "explain select * from table1", expectedHeader, USER_1, PASSWORD, DATABASE_NAME);
+        "explain select * from test.table1", expectedHeader, USER_1, PASSWORD);
     // user2 without select on table1
     tableAssertTestFail(
         "explain select * from test.table1",
@@ -88,13 +88,9 @@ public class IoTDBMaintainAuthIT {
     // user1 with select on table1
     expectedHeader = new String[] {"Explain Analyze"};
     tableQueryNoVerifyResultTest(
-        "explain analyze select * from table1", expectedHeader, USER_1, PASSWORD, DATABASE_NAME);
+        "explain analyze select * from test.table1", expectedHeader, USER_1, PASSWORD);
     tableQueryNoVerifyResultTest(
-        "explain analyze verbose select * from table1",
-        expectedHeader,
-        USER_1,
-        PASSWORD,
-        DATABASE_NAME);
+        "explain analyze verbose select * from test.table1", expectedHeader, USER_1, PASSWORD);
     // user2 without select on table1
     tableAssertTestFail(
         "explain analyze select * from test.table1",
@@ -111,27 +107,24 @@ public class IoTDBMaintainAuthIT {
 
     // case 3: show current_sql_dialect
     expectedHeader = new String[] {"CurrentSqlDialect"};
-    tableQueryNoVerifyResultTest(
-        "SHOW CURRENT_SQL_DIALECT", expectedHeader, USER_2, PASSWORD, DATABASE_NAME);
+    tableQueryNoVerifyResultTest("SHOW CURRENT_SQL_DIALECT", expectedHeader, USER_2, PASSWORD);
 
     // case 4: show current_user
     expectedHeader = new String[] {"CurrentUser"};
-    tableQueryNoVerifyResultTest(
-        "SHOW CURRENT_USER", expectedHeader, USER_2, PASSWORD, DATABASE_NAME);
+    tableQueryNoVerifyResultTest("SHOW CURRENT_USER", expectedHeader, USER_2, PASSWORD);
 
     // case 5: show version
     expectedHeader = new String[] {"Version", "BuildInfo"};
-    tableQueryNoVerifyResultTest("SHOW VERSION", expectedHeader, USER_2, PASSWORD, DATABASE_NAME);
+    tableQueryNoVerifyResultTest("SHOW VERSION", expectedHeader, USER_2, PASSWORD);
 
     // case 6: show current_timestamp
     expectedHeader = new String[] {"CurrentTimestamp"};
-    tableQueryNoVerifyResultTest(
-        "SHOW CURRENT_TIMESTAMP", expectedHeader, USER_2, PASSWORD, DATABASE_NAME);
+    tableQueryNoVerifyResultTest("SHOW CURRENT_TIMESTAMP", expectedHeader, USER_2, PASSWORD);
 
     // case 7: show variables
     expectedHeader = new String[] {"Variable", "Value"};
     // user1 with MAINTAIN
-    tableQueryNoVerifyResultTest("SHOW VARIABLES", expectedHeader, USER_1, PASSWORD, DATABASE_NAME);
+    tableQueryNoVerifyResultTest("SHOW VARIABLES", expectedHeader, USER_1, PASSWORD);
     // user2 without MAINTAIN
     tableAssertTestFail(
         "SHOW VARIABLES",
@@ -143,8 +136,7 @@ public class IoTDBMaintainAuthIT {
     // case 8: show cluster_id
     expectedHeader = new String[] {"ClusterId"};
     // user1 with MAINTAIN
-    tableQueryNoVerifyResultTest(
-        "SHOW CLUSTER_ID", expectedHeader, USER_1, PASSWORD, DATABASE_NAME);
+    tableQueryNoVerifyResultTest("SHOW CLUSTER_ID", expectedHeader, USER_1, PASSWORD);
     // user2 without MAINTAIN
     tableAssertTestFail(
         "SHOW CLUSTER_ID",
@@ -190,7 +182,7 @@ public class IoTDBMaintainAuthIT {
     // user1 with select on information_schema.queries
     expectedHeader =
         new String[] {"query_id", "start_time", "datanode_id", "elapsed_time", "statement"};
-    tableQueryNoVerifyResultTest("SHOW QUERIES", expectedHeader, USER_1, PASSWORD, DATABASE_NAME);
+    tableQueryNoVerifyResultTest("SHOW QUERIES", expectedHeader, USER_1, PASSWORD);
     // user2 without select on information_schema.queries
     tableAssertTestFail(
         "SHOW QUERIES",
@@ -202,13 +194,13 @@ public class IoTDBMaintainAuthIT {
     // case 13: kill query
     // user1 with MAINTAIN
     tableAssertTestFail(
-        "kill query '20250206_093300_00001_100'",
+        "kill query '20250206_093300_00001_1'",
         TSStatusCode.NO_SUCH_QUERY.getStatusCode() + ": No such query",
         USER_1,
         PASSWORD);
     // user2 without MAINTAIN
     tableAssertTestFail(
-        "kill query '20250206_093300_00001_100'",
+        "kill query '20250206_093300_00001_1'",
         TSStatusCode.NO_PERMISSION.getStatusCode()
             + ": Access Denied: No permissions for this operation, please add privilege MAINTAIN",
         USER_2,