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/06/27 14:21:47 UTC

[GitHub] [iotdb] qiaojialin commented on a diff in pull request #6453: [Iotdb-3469] Support set TTL in new cluster

qiaojialin commented on code in PR #6453:
URL: https://github.com/apache/iotdb/pull/6453#discussion_r907439845


##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java:
##########
@@ -727,4 +727,8 @@ public void addMetrics() {
     partitionManager.addMetrics();
     nodeManager.addMetrics();
   }
+
+  public boolean ifStorageGroupExist(String storageGroup) {
+    return clusterSchemaManager.getStorageGroupNames().contains(storageGroup.toString());

Review Comment:
   add confirmLeader()



##########
confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java:
##########
@@ -218,7 +221,32 @@ public TSStatus deleteStorageGroups(TDeleteStorageGroupsReq tDeleteReq) throws T
 
   @Override
   public TSStatus setTTL(TSetTTLReq req) throws TException {
-    return configManager.setTTL(new SetTTLReq(req.getStorageGroup(), req.getTTL()));
+    if (!configManager.ifStorageGroupExist(req.storageGroup)) {
+      return RpcUtils.getStatus(
+          TSStatusCode.STORAGE_GROUP_NOT_EXIST,
+          "storageGroup " + req.storageGroup + " does not exist");
+    }
+    TSStatus tsStatus = new TSStatus();
+    tsStatus = configManager.setTTL(new SetTTLReq(req.getStorageGroup(), req.getTTL()));
+    Set<TDataNodeLocation> dataNodeLocations =
+        configManager
+            .getPartitionManager()

Review Comment:
   call the getDataNodeLocatoinList in ConfigManager with confirmLeader()
   
   We need to read/write partition information through ConfigNode manager currently.



##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/PartitionManager.java:
##########
@@ -424,6 +425,9 @@ private void waitRegionCreation(List<String> waitingList, TConsensusGroupType co
     throw new TimeoutException("");
   }
 
+  public Set<TDataNodeLocation> getDataNodeLocation(String storageGroup, TConsensusGroupType type) {

Review Comment:
   add related function in ConfigManager with confirmLeader()



-- 
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