You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2021/07/16 03:39:42 UTC

[iotdb] branch resource_debug updated: log

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

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


The following commit(s) were added to refs/heads/resource_debug by this push:
     new 6aad61d  log
6aad61d is described below

commit 6aad61da569eb435ba20cd3d19a505a7b1eb2b4f
Author: HTHou <hh...@outlook.com>
AuthorDate: Fri Jul 16 11:38:36 2021 +0800

    log
---
 .../db/engine/storagegroup/StorageGroupProcessor.java    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index acf5331..9721446 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -739,6 +739,15 @@ public class StorageGroupProcessor {
     }
   }
 
+  private boolean checkSorted(long[] times) {
+    for (int i = 1; i < times.length; i++) {
+      if (times[i] < times[i - 1]) {
+        return false;
+      }
+    }
+    return true;
+  }
+
   /**
    * Insert a tablet (rows belonging to the same devices) into this storage group.
    *
@@ -746,6 +755,13 @@ public class StorageGroupProcessor {
    */
   @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
   public void insertTablet(InsertTabletPlan insertTabletPlan) throws BatchInsertionException {
+    if (!checkSorted(insertTabletPlan.getTimes())) {
+      logger.error("Tablet is not sorted!!!!!");
+      for (long time : insertTabletPlan.getTimes()) {
+        logger.error("Time: {}", time);
+      }
+      System.exit(1);
+    }
     writeLock();
     try {
       TSStatus[] results = new TSStatus[insertTabletPlan.getRowCount()];