You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/03/15 08:10:19 UTC

[GitHub] [iotdb] cigarl commented on a change in pull request #5235: [IOTDB-2743] ttl cannot be set if storage group is not exist

cigarl commented on a change in pull request #5235:
URL: https://github.com/apache/iotdb/pull/5235#discussion_r826684447



##########
File path: server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
##########
@@ -1496,14 +1496,20 @@ private void operateUnloadFile(OperateFilePlan plan) throws QueryProcessExceptio
     }
   }
 
-  private void operateTTL(SetTTLPlan plan) throws QueryProcessException {
+  private void operateTTL(SetTTLPlan plan)
+      throws QueryProcessException, StorageGroupNotSetException {
     try {
       List<PartialPath> storageGroupPaths =
           IoTDB.metaManager.getMatchedStorageGroups(plan.getStorageGroup(), plan.isPrefixMatch());
+      if (storageGroupPaths.isEmpty()) {
+        throw new StorageGroupNotSetException(plan.getStorageGroup().getFullPath());
+      }
       for (PartialPath storagePath : storageGroupPaths) {
         IoTDB.metaManager.setTTL(storagePath, plan.getDataTTL());
         StorageEngine.getInstance().setTTL(storagePath, plan.getDataTTL());
       }
+    } catch (StorageGroupNotSetException e) {
+      throw e;

Review comment:
       `StorageGroupNotSetException `extends from `MetadataException`, and `MManager `throws `MetadataException`.
   The `StorageGroupNotSetException `here will be caught by `MetadataException`. So individually catch and throw it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org