You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xu...@apache.org on 2020/12/07 07:51:47 UTC

[iotdb] branch virtual_partition updated: forbidden set ttl

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

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


The following commit(s) were added to refs/heads/virtual_partition by this push:
     new 2deea20  forbidden set ttl
2deea20 is described below

commit 2deea208e0e5424816b01a3013d3c0ea34c314b0
Author: 151250176 <15...@smail.nju.edu.cn>
AuthorDate: Mon Dec 7 15:51:00 2020 +0800

    forbidden set ttl
---
 .../org/apache/iotdb/db/engine/StorageEngine.java  | 51 ++++++++++++----------
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
index 0502b5f..2a44afa 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
@@ -93,8 +93,6 @@ public class StorageEngine implements IService {
 
   private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
   private static final long TTL_CHECK_INTERVAL = 60 * 1000L;
-  private final VirtualPartitioner partitioner;
-
   /**
    * Time range for dividing storage group, the time unit is the same with IoTDB's
    * TimestampPrecision
@@ -107,6 +105,7 @@ public class StorageEngine implements IService {
   @ServerConfigConsistent
   private static boolean enablePartition =
       IoTDBDescriptor.getInstance().getConfig().isEnablePartition();
+  private final VirtualPartitioner partitioner;
   private final Logger logger;
   /**
    * a folder (system/storage_groups/ by default) that persist system info. Each Storage Processor
@@ -147,10 +146,9 @@ public class StorageEngine implements IService {
     // recover upgrade process
     UpgradeUtils.recoverUpgrade();
 
-    if(config.isEnableVirtualPartition()){
+    if (config.isEnableVirtualPartition()) {
       partitioner = HashVirtualPartitioner.getInstance();
-    }
-    else{
+    } else {
       partitioner = null;
     }
 
@@ -208,6 +206,25 @@ public class StorageEngine implements IService {
     StorageEngine.enablePartition = enablePartition;
   }
 
+  /**
+   * block insertion if the insertion is rejected by memory control
+   */
+  public static void blockInsertionIfReject() throws WriteProcessException {
+    long startTime = System.currentTimeMillis();
+    while (SystemInfo.getInstance().isRejected()) {
+      try {
+        TimeUnit.MILLISECONDS.sleep(config.getCheckPeriodWhenInsertBlocked());
+        if (System.currentTimeMillis() - startTime > config.getMaxWaitingTimeWhenInsertBlocked()) {
+          throw new WriteProcessException(
+              "System rejected over " + config.getMaxWaitingTimeWhenInsertBlocked() +
+                  "ms");
+        }
+      } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
+      }
+    }
+  }
+
   public boolean isAllSgReady() {
     return isAllSgReady.get();
   }
@@ -251,6 +268,7 @@ public class StorageEngine implements IService {
 
   /**
    * recover logic storage group processor
+   *
    * @param futures recover future task
    */
   private void recoverStorageGroupProcessor(List<Future<Void>> futures) {
@@ -278,6 +296,7 @@ public class StorageEngine implements IService {
 
   /**
    * recover virtual storage group processor
+   *
    * @param futures recover future task
    */
   private void recoverVirtualStorageGroupProcessor(List<Future<Void>> futures) {
@@ -745,6 +764,10 @@ public class StorageEngine implements IService {
   }
 
   public void setTTL(PartialPath storageGroup, long dataTTL) throws StorageEngineException {
+    if (config.isEnableVirtualPartition()) {
+      throw new UnsupportedOperationException(
+          "SET TTL is forbidden when enable virtual storage group partition");
+    }
     StorageGroupProcessor storageGroupProcessor = getProcessorDirectly(storageGroup);
     storageGroupProcessor.setDataTTL(dataTTL);
   }
@@ -934,22 +957,4 @@ public class StorageEngine implements IService {
       // forbidding instantiation
     }
   }
-
-  /**
-   * block insertion if the insertion is rejected by memory control
-   */
-  public static void blockInsertionIfReject() throws WriteProcessException {
-    long startTime = System.currentTimeMillis();
-    while (SystemInfo.getInstance().isRejected()) {
-      try {
-        TimeUnit.MILLISECONDS.sleep(config.getCheckPeriodWhenInsertBlocked());
-        if (System.currentTimeMillis() - startTime > config.getMaxWaitingTimeWhenInsertBlocked()) {
-          throw new WriteProcessException("System rejected over " + config.getMaxWaitingTimeWhenInsertBlocked() +
-              "ms");
-        }
-      } catch (InterruptedException e) {
-        Thread.currentThread().interrupt();
-      }
-    }
-  }
 }