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

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


The following commit(s) were added to refs/heads/TemplateAuth by this push:
     new b0d005b656f spotless
b0d005b656f is described below

commit b0d005b656f9246a960e37cbfeb9e5c487658234
Author: JackieTien97 <[email protected]>
AuthorDate: Tue Dec 5 20:00:54 2023 +0800

    spotless
---
 .../plan/analyze/schema/TemplateSchemaFetcher.java | 35 +++++++++++-----------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/TemplateSchemaFetcher.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/TemplateSchemaFetcher.java
index f44471a108d..13712383032 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/TemplateSchemaFetcher.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/TemplateSchemaFetcher.java
@@ -80,26 +80,25 @@ class TemplateSchemaFetcher {
       }
     }
 
-    // check the write_schema of missing measurements
-    long startTime = System.nanoTime();
-    try {
-      String userName = context.getSession().getUserName();
-      if (!AuthorityChecker.SUPER_USER.equals(userName)) {
-        TSStatus status =
-            AuthorityChecker.getTSStatus(
-                AuthorityChecker.checkFullPathListPermission(
-                    userName, checkedPaths, 
PrivilegeType.WRITE_SCHEMA.ordinal()),
-                checkedPaths,
-                PrivilegeType.WRITE_SCHEMA);
-        if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-          throw new RuntimeException(new IoTDBException(status.getMessage(), 
status.getCode()));
+    if (!extensionMeasurementList.isEmpty() && 
config.isAutoCreateSchemaEnabled()) {
+      // check the write_schema of missing measurements
+      long startTime = System.nanoTime();
+      try {
+        String userName = context.getSession().getUserName();
+        if (!AuthorityChecker.SUPER_USER.equals(userName)) {
+          TSStatus status =
+              AuthorityChecker.getTSStatus(
+                  AuthorityChecker.checkFullPathListPermission(
+                      userName, checkedPaths, 
PrivilegeType.WRITE_SCHEMA.ordinal()),
+                  checkedPaths,
+                  PrivilegeType.WRITE_SCHEMA);
+          if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) 
{
+            throw new RuntimeException(new IoTDBException(status.getMessage(), 
status.getCode()));
+          }
         }
+      } finally {
+        
PerformanceOverviewMetrics.getInstance().recordAuthCost(System.nanoTime() - 
startTime);
       }
-    } finally {
-      
PerformanceOverviewMetrics.getInstance().recordAuthCost(System.nanoTime() - 
startTime);
-    }
-
-    if (!extensionMeasurementList.isEmpty() && 
config.isAutoCreateSchemaEnabled()) {
       autoCreateSchemaExecutor.autoExtendTemplate(
           template.getName(), extensionMeasurementList, extensionDataTypeList, 
context);
     }

Reply via email to