You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2022/02/24 12:20:22 UTC

[iotdb] branch master updated: [IOTDB-2599] Fix example of insertAlignedTablet is incorrect (#5114)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2ac29f5  [IOTDB-2599] Fix example of insertAlignedTablet is incorrect (#5114)
2ac29f5 is described below

commit 2ac29f5bce9e0a4df7ac14960ec63e47c7260f92
Author: Haonan <hh...@outlook.com>
AuthorDate: Thu Feb 24 20:19:44 2022 +0800

    [IOTDB-2599] Fix example of insertAlignedTablet is incorrect (#5114)
---
 .../iotdb/AlignedTimeseriesSessionExample.java     | 24 +++-----
 .../iotdb/HybridTimeseriesSessionExample.java      | 14 ++---
 .../apache/iotdb/session/IoTDBSessionSimpleIT.java |  2 -
 .../java/org/apache/iotdb/session/Session.java     | 68 ++++++++++++----------
 .../org/apache/iotdb/session/pool/SessionPool.java | 42 +++++++++----
 .../session/IoTDBSessionVectorAggregationIT.java   |  3 +-
 .../iotdb/session/IoTDBSessionVectorInsertIT.java  |  1 -
 .../test/java/org/apache/iotdb/db/sql/Cases.java   |  8 +--
 .../apache/iotdb/tsfile/write/record/Tablet.java   | 10 ----
 9 files changed, 85 insertions(+), 87 deletions(-)

diff --git a/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java b/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java
index 82bb1c1..aa98341 100644
--- a/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java
+++ b/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java
@@ -303,7 +303,6 @@ public class AlignedTimeseriesSessionExample {
     schemaList.add(new MeasurementSchema("s2", TSDataType.INT32));
 
     Tablet tablet = new Tablet(ROOT_SG1_D1, schemaList);
-    tablet.setAligned(true);
     long timestamp = 1;
 
     for (long row = 1; row < 100; row++) {
@@ -314,7 +313,7 @@ public class AlignedTimeseriesSessionExample {
       tablet.addValue(schemaList.get(1).getMeasurementId(), rowIndex, new SecureRandom().nextInt());
 
       if (tablet.rowSize == tablet.getMaxRowNumber()) {
-        session.insertTablet(tablet, true);
+        session.insertAlignedTablet(tablet, true);
         tablet.reset();
       }
       timestamp++;
@@ -338,7 +337,6 @@ public class AlignedTimeseriesSessionExample {
     schemaList.add(new MeasurementSchema("s2", TSDataType.INT32));
 
     Tablet tablet = new Tablet(ROOT_SG1_D1_VECTOR2, schemaList);
-    tablet.setAligned(true);
     long[] timestamps = tablet.timestamps;
     Object[] values = tablet.values;
 
@@ -353,13 +351,13 @@ public class AlignedTimeseriesSessionExample {
       sensor2[row] = new SecureRandom().nextInt();
 
       if (tablet.rowSize == tablet.getMaxRowNumber()) {
-        session.insertTablet(tablet, true);
+        session.insertAlignedTablet(tablet, true);
         tablet.reset();
       }
     }
 
     if (tablet.rowSize != 0) {
-      session.insertTablet(tablet, true);
+      session.insertAlignedTablet(tablet, true);
       tablet.reset();
     }
 
@@ -375,7 +373,6 @@ public class AlignedTimeseriesSessionExample {
     schemaList.add(new MeasurementSchema("s2", TSDataType.INT32));
 
     Tablet tablet = new Tablet(ROOT_SG1_D1_VECTOR3, schemaList);
-    tablet.setAligned(true);
 
     long[] timestamps = tablet.timestamps;
     Object[] values = tablet.values;
@@ -400,14 +397,14 @@ public class AlignedTimeseriesSessionExample {
       }
 
       if (tablet.rowSize == tablet.getMaxRowNumber()) {
-        session.insertTablet(tablet, true);
+        session.insertAlignedTablet(tablet, true);
         tablet.reset();
         bitMaps[1].reset();
       }
     }
 
     if (tablet.rowSize != 0) {
-      session.insertTablet(tablet, true);
+      session.insertAlignedTablet(tablet, true);
       tablet.reset();
     }
 
@@ -559,9 +556,6 @@ public class AlignedTimeseriesSessionExample {
     Tablet tablet1 = new Tablet(ROOT_SG2_D1_VECTOR6, schemaList1, 100);
     Tablet tablet2 = new Tablet(ROOT_SG2_D1_VECTOR7, schemaList2, 100);
     Tablet tablet3 = new Tablet(ROOT_SG2_D1_VECTOR8, schemaList3, 100);
-    tablet1.setAligned(true);
-    tablet2.setAligned(true);
-    tablet3.setAligned(true);
 
     Map<String, Tablet> tabletMap = new HashMap<>();
     tabletMap.put(ROOT_SG2_D1_VECTOR6, tablet1);
@@ -584,7 +578,7 @@ public class AlignedTimeseriesSessionExample {
         tablet3.addValue(schemaList3.get(0).getSubMeasurementsList().get(i), row3, value);
       }
       if (tablet1.rowSize == tablet1.getMaxRowNumber()) {
-        session.insertTablets(tabletMap, true);
+        session.insertAlignedTablets(tabletMap, true);
         tablet1.reset();
         tablet2.reset();
         tablet3.reset();
@@ -593,7 +587,7 @@ public class AlignedTimeseriesSessionExample {
     }
 
     if (tablet1.rowSize != 0) {
-      session.insertTablets(tabletMap, true);
+      session.insertAlignedTablets(tabletMap, true);
       tablet1.reset();
       tablet2.reset();
       tablet3.reset();
@@ -623,7 +617,7 @@ public class AlignedTimeseriesSessionExample {
         sensor3[row3] = i;
       }
       if (tablet1.rowSize == tablet1.getMaxRowNumber()) {
-        session.insertTablets(tabletMap, true);
+        session.insertAlignedTablets(tabletMap, true);
 
         tablet1.reset();
         tablet2.reset();
@@ -632,7 +626,7 @@ public class AlignedTimeseriesSessionExample {
     }
 
     if (tablet1.rowSize != 0) {
-      session.insertTablets(tabletMap, true);
+      session.insertAlignedTablets(tabletMap, true);
       tablet1.reset();
       tablet2.reset();
       tablet3.reset();
diff --git a/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java b/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java
index 8186f81..d630482 100644
--- a/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java
+++ b/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java
@@ -36,7 +36,7 @@ import java.util.List;
 public class HybridTimeseriesSessionExample {
 
   private static Session session;
-  private static final String ROOT_SG1_D1_VECTOR1 = "root.sg_1.d1.vector";
+  private static final String ROOT_SG1_ALIGNEDDEVICE = "root.sg_1.aligned_device";
   private static final String ROOT_SG1_D1 = "root.sg_1.d1";
   private static final String ROOT_SG1_D2 = "root.sg_1.d2";
 
@@ -58,7 +58,7 @@ public class HybridTimeseriesSessionExample {
   }
 
   private static void selectTest() throws StatementExecutionException, IoTDBConnectionException {
-    SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg_1.d1");
+    SessionDataSet dataSet = session.executeQueryStatement("select ** from root.sg_1");
     System.out.println(dataSet.getColumnNames());
     while (dataSet.hasNext()) {
       System.out.println(dataSet.next());
@@ -75,19 +75,17 @@ public class HybridTimeseriesSessionExample {
     schemaList.add(new MeasurementSchema("s1", TSDataType.INT64));
     schemaList.add(new MeasurementSchema("s2", TSDataType.INT32));
 
-    Tablet tablet = new Tablet(ROOT_SG1_D1_VECTOR1, schemaList);
-    tablet.setAligned(true);
+    Tablet tablet = new Tablet(ROOT_SG1_ALIGNEDDEVICE, schemaList);
     long timestamp = minTime;
 
     for (long row = minTime; row < maxTime; row++) {
       int rowIndex = tablet.rowSize++;
       tablet.addTimestamp(rowIndex, timestamp);
-      tablet.addValue(schemaList.get(0).getSubMeasurementsList().get(0), rowIndex, row * 10 + 1L);
-      tablet.addValue(
-          schemaList.get(0).getSubMeasurementsList().get(1), rowIndex, (int) (row * 10 + 2));
+      tablet.addValue(schemaList.get(0).getMeasurementId(), rowIndex, row * 10 + 1L);
+      tablet.addValue(schemaList.get(1).getMeasurementId(), rowIndex, (int) (row * 10 + 2));
 
       if (tablet.rowSize == tablet.getMaxRowNumber()) {
-        session.insertTablet(tablet, true);
+        session.insertAlignedTablet(tablet, true);
         tablet.reset();
       }
       timestamp++;
diff --git a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
index 613f4af..7bc81c1 100644
--- a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
+++ b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
@@ -395,7 +395,6 @@ public class IoTDBSessionSimpleIT {
     schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT));
 
     Tablet tablet = new Tablet("root.sg1.d1", schemaList);
-    tablet.setAligned(true);
     long timestamp = System.currentTimeMillis();
 
     for (long row = 0; row < 10; row++) {
@@ -1266,7 +1265,6 @@ public class IoTDBSessionSimpleIT {
     schemaList.add(new MeasurementSchema("x", TSDataType.FLOAT));
     schemaList.add(new MeasurementSchema("y", TSDataType.FLOAT));
     Tablet tablet = new Tablet("root.sg.loc1.sector", schemaList);
-    tablet.setAligned(true);
 
     long timestamp = System.currentTimeMillis();
 
diff --git a/session/src/main/java/org/apache/iotdb/session/Session.java b/session/src/main/java/org/apache/iotdb/session/Session.java
index 38d5ce7..9a31211 100644
--- a/session/src/main/java/org/apache/iotdb/session/Session.java
+++ b/session/src/main/java/org/apache/iotdb/session/Session.java
@@ -1568,7 +1568,7 @@ public class Session {
    */
   public void insertTablet(Tablet tablet, boolean sorted)
       throws IoTDBConnectionException, StatementExecutionException {
-    TSInsertTabletReq request = genTSInsertTabletReq(tablet, sorted);
+    TSInsertTabletReq request = genTSInsertTabletReq(tablet, sorted, false);
     try {
       getSessionConnection(tablet.deviceId).insertTablet(request);
     } catch (RedirectException e) {
@@ -1588,8 +1588,7 @@ public class Session {
    */
   public void insertAlignedTablet(Tablet tablet)
       throws StatementExecutionException, IoTDBConnectionException {
-    tablet.setAligned(true);
-    insertTablet(tablet);
+    insertAlignedTablet(tablet, false);
   }
 
   /**
@@ -1600,11 +1599,15 @@ public class Session {
    */
   public void insertAlignedTablet(Tablet tablet, boolean sorted)
       throws IoTDBConnectionException, StatementExecutionException {
-    tablet.setAligned(true);
-    insertTablet(tablet, sorted);
+    TSInsertTabletReq request = genTSInsertTabletReq(tablet, sorted, true);
+    try {
+      getSessionConnection(tablet.deviceId).insertTablet(request);
+    } catch (RedirectException e) {
+      handleRedirection(tablet.deviceId, e.getEndPoint());
+    }
   }
 
-  private TSInsertTabletReq genTSInsertTabletReq(Tablet tablet, boolean sorted)
+  private TSInsertTabletReq genTSInsertTabletReq(Tablet tablet, boolean sorted, boolean isAligned)
       throws BatchExecutionException {
     if (!checkSorted(tablet)) {
       sortTablet(tablet);
@@ -1618,7 +1621,7 @@ public class Session {
     }
 
     request.setPrefixPath(tablet.deviceId);
-    request.setIsAligned(tablet.isAligned());
+    request.setIsAligned(isAligned);
     request.setTimestamps(SessionUtils.getTimeBuffer(tablet));
     request.setValues(SessionUtils.getValueBuffer(tablet));
     request.setSize(tablet.rowSize);
@@ -1648,9 +1651,10 @@ public class Session {
   public void insertTablets(Map<String, Tablet> tablets, boolean sorted)
       throws IoTDBConnectionException, StatementExecutionException {
     if (enableCacheLeader) {
-      insertTabletsWithLeaderCache(tablets, sorted);
+      insertTabletsWithLeaderCache(tablets, sorted, false);
     } else {
-      TSInsertTabletsReq request = genTSInsertTabletsReq(new ArrayList<>(tablets.values()), sorted);
+      TSInsertTabletsReq request =
+          genTSInsertTabletsReq(new ArrayList<>(tablets.values()), sorted, false);
       try {
         defaultSessionConnection.insertTablets(request);
       } catch (RedirectException ignored) {
@@ -1669,10 +1673,7 @@ public class Session {
    */
   public void insertAlignedTablets(Map<String, Tablet> tablets)
       throws IoTDBConnectionException, StatementExecutionException {
-    for (Tablet tablet : tablets.values()) {
-      tablet.setAligned(true);
-    }
-    insertTablets(tablets, false);
+    insertAlignedTablets(tablets, false);
   }
 
   /**
@@ -1684,42 +1685,47 @@ public class Session {
    */
   public void insertAlignedTablets(Map<String, Tablet> tablets, boolean sorted)
       throws IoTDBConnectionException, StatementExecutionException {
-    for (Tablet tablet : tablets.values()) {
-      tablet.setAligned(true);
+    if (enableCacheLeader) {
+      insertTabletsWithLeaderCache(tablets, sorted, true);
+    } else {
+      TSInsertTabletsReq request =
+          genTSInsertTabletsReq(new ArrayList<>(tablets.values()), sorted, true);
+      try {
+        defaultSessionConnection.insertTablets(request);
+      } catch (RedirectException ignored) {
+        // ignored
+      }
     }
-    insertTablets(tablets, sorted);
   }
 
-  private void insertTabletsWithLeaderCache(Map<String, Tablet> tablets, boolean sorted)
+  private void insertTabletsWithLeaderCache(
+      Map<String, Tablet> tablets, boolean sorted, boolean isAligned)
       throws IoTDBConnectionException, StatementExecutionException {
     Map<SessionConnection, TSInsertTabletsReq> tabletGroup = new HashMap<>();
     for (Entry<String, Tablet> entry : tablets.entrySet()) {
       final SessionConnection connection = getSessionConnection(entry.getKey());
       TSInsertTabletsReq request =
           tabletGroup.computeIfAbsent(connection, k -> new TSInsertTabletsReq());
-      updateTSInsertTabletsReq(request, entry.getValue(), sorted);
+      updateTSInsertTabletsReq(request, entry.getValue(), sorted, isAligned);
     }
 
     insertByGroup(tabletGroup, SessionConnection::insertTablets);
   }
 
-  private TSInsertTabletsReq genTSInsertTabletsReq(List<Tablet> tablets, boolean sorted)
-      throws BatchExecutionException {
+  private TSInsertTabletsReq genTSInsertTabletsReq(
+      List<Tablet> tablets, boolean sorted, boolean isAligned) throws BatchExecutionException {
     TSInsertTabletsReq request = new TSInsertTabletsReq();
     if (tablets.isEmpty()) {
       throw new BatchExecutionException("No tablet is inserting!");
     }
-    boolean isFirstTabletAligned = tablets.get(0).isAligned();
     for (Tablet tablet : tablets) {
-      if (isFirstTabletAligned != tablet.isAligned()) {
-        throw new BatchExecutionException("The tablets should be all aligned or non-aligned!");
-      }
-      updateTSInsertTabletsReq(request, tablet, sorted);
+      updateTSInsertTabletsReq(request, tablet, sorted, isAligned);
     }
     return request;
   }
 
-  private void updateTSInsertTabletsReq(TSInsertTabletsReq request, Tablet tablet, boolean sorted)
+  private void updateTSInsertTabletsReq(
+      TSInsertTabletsReq request, Tablet tablet, boolean sorted, boolean isAligned)
       throws BatchExecutionException {
     if (!checkSorted(tablet)) {
       sortTablet(tablet);
@@ -1727,10 +1733,7 @@ public class Session {
     request.addToPrefixPaths(tablet.deviceId);
     List<String> measurements = new ArrayList<>();
     List<Integer> dataTypes = new ArrayList<>();
-
-    if (tablet.isAligned()) {
-      request.setIsAligned(true);
-    }
+    request.setIsAligned(isAligned);
     for (IMeasurementSchema measurementSchema : tablet.getSchemas()) {
       measurements.add(measurementSchema.getMeasurementId());
       dataTypes.add(measurementSchema.getType().ordinal());
@@ -1757,7 +1760,7 @@ public class Session {
    */
   public void testInsertTablet(Tablet tablet, boolean sorted)
       throws IoTDBConnectionException, StatementExecutionException {
-    TSInsertTabletReq request = genTSInsertTabletReq(tablet, sorted);
+    TSInsertTabletReq request = genTSInsertTabletReq(tablet, sorted, false);
     defaultSessionConnection.testInsertTablet(request);
   }
 
@@ -1776,7 +1779,8 @@ public class Session {
    */
   public void testInsertTablets(Map<String, Tablet> tablets, boolean sorted)
       throws IoTDBConnectionException, StatementExecutionException {
-    TSInsertTabletsReq request = genTSInsertTabletsReq(new ArrayList<>(tablets.values()), sorted);
+    TSInsertTabletsReq request =
+        genTSInsertTabletsReq(new ArrayList<>(tablets.values()), sorted, false);
     defaultSessionConnection.testInsertTablets(request);
   }
 
diff --git a/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java b/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
index c5373b4..75ae7c0 100644
--- a/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
+++ b/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
@@ -466,8 +466,7 @@ public class SessionPool {
    */
   public void insertAlignedTablet(Tablet tablet)
       throws IoTDBConnectionException, StatementExecutionException {
-    tablet.setAligned(true);
-    insertTablet(tablet, false);
+    insertAlignedTablet(tablet, false);
   }
 
   /**
@@ -480,8 +479,21 @@ public class SessionPool {
    */
   public void insertAlignedTablet(Tablet tablet, boolean sorted)
       throws IoTDBConnectionException, StatementExecutionException {
-    tablet.setAligned(true);
-    insertTablet(tablet, sorted);
+    for (int i = 0; i < RETRY; i++) {
+      Session session = getSession();
+      try {
+        session.insertAlignedTablet(tablet, sorted);
+        putBack(session);
+        return;
+      } catch (IoTDBConnectionException e) {
+        // TException means the connection is broken, remove it and get a new one.
+        logger.warn("insertAlignedTablet failed", e);
+        cleanSessionAndMayThrowConnectionException(session, i, e);
+      } catch (StatementExecutionException | RuntimeException e) {
+        putBack(session);
+        throw e;
+      }
+    }
   }
 
   /**
@@ -501,10 +513,7 @@ public class SessionPool {
    */
   public void insertAlignedTablets(Map<String, Tablet> tablets)
       throws IoTDBConnectionException, StatementExecutionException {
-    for (Tablet tablet : tablets.values()) {
-      tablet.setAligned(true);
-    }
-    insertTablets(tablets, false);
+    insertAlignedTablets(tablets, false);
   }
 
   /**
@@ -538,10 +547,21 @@ public class SessionPool {
    */
   public void insertAlignedTablets(Map<String, Tablet> tablets, boolean sorted)
       throws IoTDBConnectionException, StatementExecutionException {
-    for (Tablet tablet : tablets.values()) {
-      tablet.setAligned(true);
+    for (int i = 0; i < RETRY; i++) {
+      Session session = getSession();
+      try {
+        session.insertAlignedTablets(tablets, sorted);
+        putBack(session);
+        return;
+      } catch (IoTDBConnectionException e) {
+        // TException means the connection is broken, remove it and get a new one.
+        logger.warn("insertAlignedTablets failed", e);
+        cleanSessionAndMayThrowConnectionException(session, i, e);
+      } catch (StatementExecutionException | RuntimeException e) {
+        putBack(session);
+        throw e;
+      }
     }
-    insertTablets(tablets, sorted);
   }
 
   /**
diff --git a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorAggregationIT.java b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorAggregationIT.java
index 8f86983..acbf279 100644
--- a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorAggregationIT.java
+++ b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorAggregationIT.java
@@ -220,7 +220,6 @@ public class IoTDBSessionVectorAggregationIT {
     schemaList.add(new MeasurementSchema("s2", TSDataType.INT32));
 
     Tablet tablet = new Tablet(ROOT_SG1_D1_VECTOR1, schemaList);
-    tablet.setAligned(true);
 
     for (long row = 1; row <= 100; row++) {
       int rowIndex = tablet.rowSize++;
@@ -229,7 +228,7 @@ public class IoTDBSessionVectorAggregationIT {
       tablet.addValue(schemaList.get(1).getMeasurementId(), rowIndex, (int) (row + 2));
 
       if (tablet.rowSize == tablet.getMaxRowNumber()) {
-        session.insertTablet(tablet, true);
+        session.insertAlignedTablet(tablet, true);
         tablet.reset();
       }
     }
diff --git a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorInsertIT.java b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorInsertIT.java
index b5bb7a2..54a8a40 100644
--- a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorInsertIT.java
+++ b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorInsertIT.java
@@ -271,7 +271,6 @@ public class IoTDBSessionVectorInsertIT {
     schemaList.add(new MeasurementSchema("s2", TSDataType.INT32));
 
     Tablet tablet = new Tablet(ROOT_SG1_D1_VECTOR1, schemaList);
-    tablet.setAligned(true);
     long timestamp = 0;
 
     for (long row = 0; row < 100; row++) {
diff --git a/testcontainer/src/test/java/org/apache/iotdb/db/sql/Cases.java b/testcontainer/src/test/java/org/apache/iotdb/db/sql/Cases.java
index 7f6dfcc..8440121 100644
--- a/testcontainer/src/test/java/org/apache/iotdb/db/sql/Cases.java
+++ b/testcontainer/src/test/java/org/apache/iotdb/db/sql/Cases.java
@@ -878,7 +878,6 @@ public abstract class Cases {
     schemaList.add(new MeasurementSchema("s3", TSDataType.FLOAT));
 
     Tablet tablet = new Tablet("root.sg6.d1.v1", schemaList);
-    tablet.setAligned(true);
 
     for (long row = 1; row <= 3; row++) {
       int rowIndex = tablet.rowSize++;
@@ -887,7 +886,7 @@ public abstract class Cases {
       tablet.addValue(schemaList.get(1).getMeasurementId(), rowIndex, 2);
       tablet.addValue(schemaList.get(2).getMeasurementId(), rowIndex, 3.0f);
     }
-    session.insertTablet(tablet, true);
+    session.insertAlignedTablet(tablet, true);
     tablet.reset();
 
     List<MeasurementSchema> schemaList1 = new ArrayList<>();
@@ -906,9 +905,6 @@ public abstract class Cases {
     Tablet tablet1 = new Tablet("root.sg7.d1.v1", schemaList1, 100);
     Tablet tablet2 = new Tablet("root.sg8.d1.v1", schemaList2, 100);
     Tablet tablet3 = new Tablet("root.sg9.d1.v1", schemaList3, 100);
-    tablet1.setAligned(true);
-    tablet2.setAligned(true);
-    tablet3.setAligned(true);
 
     Map<String, Tablet> tabletMap = new HashMap<>();
     tabletMap.put("root.sg7.d1.v1", tablet1);
@@ -928,7 +924,7 @@ public abstract class Cases {
         tablet3.addValue(schemaList3.get(i).getMeasurementId(), row3, values.get(i));
       }
     }
-    session.insertTablets(tabletMap, true);
+    session.insertAlignedTablets(tabletMap, true);
 
     tabletMap.clear();
 
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
index 81eb55d..5b7d0b8 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
@@ -63,8 +63,6 @@ public class Tablet {
   public int rowSize;
   /** the maximum number of rows for this tablet */
   private final int maxRowNumber;
-  /** whether this tablet store data of aligned timeseries or not */
-  private boolean isAligned;
 
   /**
    * Return a tablet with default specified row number. This is the standard constructor (all Tablet
@@ -301,12 +299,4 @@ public class Tablet {
     }
     return valueOccupation;
   }
-
-  public boolean isAligned() {
-    return isAligned;
-  }
-
-  public void setAligned(boolean aligned) {
-    isAligned = aligned;
-  }
 }