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

zyk 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 1350323cf7 Remove all trigger code for old standalone from schema 
module (#8071)
1350323cf7 is described below

commit 1350323cf7f71becf70b230e9ccf3de03e5e4435
Author: Marcos_Zyk <[email protected]>
AuthorDate: Mon Nov 21 20:15:36 2022 +0800

    Remove all trigger code for old standalone from schema module (#8071)
    
    Remove all trigger code for old standalone from schema module (#8071)
---
 .../schemaregion/rocksdb/RSchemaRegion.java        | 10 ---
 .../metadata/tagSchemaRegion/TagSchemaRegion.java  | 10 ---
 .../iotdb/db/metadata/LocalSchemaProcessor.java    | 17 ----
 .../apache/iotdb/db/metadata/idtable/IDTable.java  | 20 -----
 .../db/metadata/idtable/IDTableHashmapImpl.java    | 33 --------
 .../db/metadata/idtable/entry/SchemaEntry.java     | 22 +----
 .../mnode/estimator/BasicMNodSizeEstimator.java    |  3 +-
 .../db/metadata/schemaregion/ISchemaRegion.java    |  7 --
 .../schemaregion/SchemaRegionMemoryImpl.java       | 22 +----
 .../schemaregion/SchemaRegionSchemaFileImpl.java   | 22 +----
 .../iotdb/db/metadata/idtable/IDTableTest.java     | 83 ------------------
 .../metadata/idtable/trigger_example/Counter.java  | 97 ----------------------
 12 files changed, 11 insertions(+), 335 deletions(-)

diff --git 
a/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/RSchemaRegion.java
 
b/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/RSchemaRegion.java
index fe67e2898c..7fae87633b 100644
--- 
a/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/RSchemaRegion.java
+++ 
b/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/RSchemaRegion.java
@@ -1875,16 +1875,6 @@ public class RSchemaRegion implements ISchemaRegion {
     throw new UnsupportedOperationException();
   }
 
-  @Override
-  public IMNode getMNodeForTrigger(PartialPath fullPath) throws 
MetadataException {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public void releaseMNodeAfterDropTrigger(IMNode imNode) throws 
MetadataException {
-    throw new UnsupportedOperationException();
-  }
-
   @Override
   public String toString() {
     return String.format("database:[%s]", storageGroupFullPath);
diff --git 
a/schema-engine-tag/src/main/java/org/apache/iotdb/db/metadata/tagSchemaRegion/TagSchemaRegion.java
 
b/schema-engine-tag/src/main/java/org/apache/iotdb/db/metadata/tagSchemaRegion/TagSchemaRegion.java
index 442e541781..996e9418cf 100644
--- 
a/schema-engine-tag/src/main/java/org/apache/iotdb/db/metadata/tagSchemaRegion/TagSchemaRegion.java
+++ 
b/schema-engine-tag/src/main/java/org/apache/iotdb/db/metadata/tagSchemaRegion/TagSchemaRegion.java
@@ -841,16 +841,6 @@ public class TagSchemaRegion implements ISchemaRegion {
     return 0;
   }
 
-  @Override
-  public IMNode getMNodeForTrigger(PartialPath fullPath) throws 
MetadataException {
-    throw new UnsupportedOperationException("getMNodeForTrigger");
-  }
-
-  @Override
-  public void releaseMNodeAfterDropTrigger(IMNode node) throws 
MetadataException {
-    throw new UnsupportedOperationException("releaseMNodeAfterDropTrigger");
-  }
-
   @Override
   public String toString() {
     return "TagSchemaRegion{"
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java 
b/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java
index 2685cab423..ea731d555f 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java
@@ -100,7 +100,6 @@ import static 
org.apache.iotdb.tsfile.common.constant.TsFileConstant.PATH_SEPARA
  *   <li>Interfaces for alias and tag/attribute operations
  *   <li>Interfaces only for Cluster module usage
  *   <li>Interfaces for lastCache operations
- *   <li>Interfaces for Trigger
  *   <li>TestOnly Interfaces
  * </ol>
  */
@@ -1136,22 +1135,6 @@ public class LocalSchemaProcessor {
   }
   // endregion
 
-  // region Interfaces for Trigger
-
-  public IMNode getMNodeForTrigger(PartialPath fullPath) throws 
MetadataException {
-    try {
-      return getBelongedSchemaRegion(fullPath).getMNodeForTrigger(fullPath);
-    } catch (StorageGroupNotSetException e) {
-      throw new PathNotExistException(fullPath.getFullPath());
-    }
-  }
-
-  public void releaseMNodeAfterDropTrigger(IMNode imNode) throws 
MetadataException {
-    
getBelongedSchemaRegion(imNode.getPartialPath()).releaseMNodeAfterDropTrigger(imNode);
-  }
-
-  // endregion
-
   // region TestOnly Interfaces
 
   @TestOnly
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTable.java 
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTable.java
index a067cf98b8..01529bfd8d 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTable.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTable.java
@@ -32,7 +32,6 @@ import 
org.apache.iotdb.db.metadata.idtable.entry.DiskSchemaEntry;
 import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
 import org.apache.iotdb.db.metadata.idtable.entry.SchemaEntry;
 import org.apache.iotdb.db.metadata.idtable.entry.TimeseriesID;
-import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
 import 
org.apache.iotdb.db.metadata.plan.schemaregion.write.ICreateAlignedTimeSeriesPlan;
 import 
org.apache.iotdb.db.metadata.plan.schemaregion.write.ICreateTimeSeriesPlan;
 import org.apache.iotdb.tsfile.read.TimeValuePair;
@@ -88,25 +87,6 @@ public interface IDTable {
    */
   // IDeviceID getSeriesSchemas(InsertPlan plan) throws MetadataException;
 
-  /**
-   * register trigger to the timeseries
-   *
-   * @param fullPath full path of the timeseries
-   * @param measurementMNode the timeseries measurement mnode
-   * @throws MetadataException if the timeseries is not exits
-   */
-  void registerTrigger(PartialPath fullPath, IMeasurementMNode 
measurementMNode)
-      throws MetadataException;
-
-  /**
-   * deregister trigger to the timeseries
-   *
-   * @param fullPath full path of the timeseries
-   * @param measurementMNode the timeseries measurement mnode
-   * @throws MetadataException if the timeseries is not exits
-   */
-  void deregisterTrigger(PartialPath fullPath, IMeasurementMNode 
measurementMNode)
-      throws MetadataException;
   /**
    * get last cache of the timeseies
    *
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTableHashmapImpl.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTableHashmapImpl.java
index 039059611c..090d338116 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTableHashmapImpl.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTableHashmapImpl.java
@@ -30,7 +30,6 @@ import 
org.apache.iotdb.db.metadata.idtable.entry.DiskSchemaEntry;
 import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
 import org.apache.iotdb.db.metadata.idtable.entry.SchemaEntry;
 import org.apache.iotdb.db.metadata.idtable.entry.TimeseriesID;
-import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
 import 
org.apache.iotdb.db.metadata.plan.schemaregion.write.ICreateAlignedTimeSeriesPlan;
 import 
org.apache.iotdb.db.metadata.plan.schemaregion.write.ICreateTimeSeriesPlan;
 import org.apache.iotdb.tsfile.read.TimeValuePair;
@@ -171,38 +170,6 @@ public class IDTableHashmapImpl implements IDTable {
     return new Pair<>(deletedNum, failedNames);
   }
 
-  /**
-   * register trigger to the timeseries
-   *
-   * @param fullPath full path of the timeseries
-   * @param measurementMNode the timeseries measurement mnode
-   * @throws MetadataException if the timeseries is not exits
-   */
-  @Override
-  public synchronized void registerTrigger(PartialPath fullPath, 
IMeasurementMNode measurementMNode)
-      throws MetadataException {
-    boolean isAligned = measurementMNode.getParent().isAligned();
-    DeviceEntry deviceEntry = 
getDeviceEntryWithAlignedCheck(fullPath.getDevice(), isAligned);
-
-    deviceEntry.getSchemaEntry(fullPath.getMeasurement()).setUsingTrigger();
-  }
-
-  /**
-   * deregister trigger to the timeseries
-   *
-   * @param fullPath full path of the timeseries
-   * @param measurementMNode the timeseries measurement mnode
-   * @throws MetadataException if the timeseries is not exits
-   */
-  @Override
-  public synchronized void deregisterTrigger(
-      PartialPath fullPath, IMeasurementMNode measurementMNode) throws 
MetadataException {
-    boolean isAligned = measurementMNode.getParent().isAligned();
-    DeviceEntry deviceEntry = 
getDeviceEntryWithAlignedCheck(fullPath.getDevice(), isAligned);
-
-    deviceEntry.getSchemaEntry(fullPath.getMeasurement()).setUnUsingTrigger();
-  }
-
   /**
    * get last cache of the timeseies
    *
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntry.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntry.java
index bf95324a4b..b938217f62 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntry.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntry.java
@@ -42,8 +42,7 @@ import static 
org.apache.iotdb.db.utils.EncodingInferenceUtils.getDefaultEncodin
  */
 public class SchemaEntry implements ILastCacheContainer {
 
-  /* 39 bits of disk pointer */
-  /* 1 bits indicate whether there is a trigger */
+  /* 40 bits of disk pointer */
   /*  1 byte of compressor  */
   /*   1 byte of encoding   */
   /*    1 byte of type      */
@@ -77,7 +76,7 @@ public class SchemaEntry implements ILastCacheContainer {
 
     lastTime = Long.MIN_VALUE;
 
-    schema |= (diskPos << 25);
+    schema |= (diskPos << 24);
   }
 
   public SchemaEntry(
@@ -105,7 +104,7 @@ public class SchemaEntry implements ILastCacheContainer {
               encoding.serialize(),
               compressionType.serialize(),
               isAligned);
-      schema |= (IDiskSchemaManager.serialize(diskSchemaEntry) << 25);
+      schema |= (IDiskSchemaManager.serialize(diskSchemaEntry) << 24);
     }
   }
 
@@ -115,7 +114,7 @@ public class SchemaEntry implements ILastCacheContainer {
    * @return disk pointer
    */
   public long getDiskPointer() {
-    return schema >> 25;
+    return schema >> 24;
   }
 
   /**
@@ -145,19 +144,6 @@ public class SchemaEntry implements ILastCacheContainer {
     return CompressionType.deserialize((byte) (schema >> 16));
   }
 
-  public boolean isUsingTrigger() {
-    return ((schema >> 24) & 1) == 1;
-  }
-
-  public void setUsingTrigger() {
-    schema |= (1 << 24);
-  }
-
-  public void setUnUsingTrigger() {
-    int mask = ~(1 << 24);
-    schema &= mask;
-  }
-
   public long getLastTime() {
     return lastTime;
   }
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/estimator/BasicMNodSizeEstimator.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/estimator/BasicMNodSizeEstimator.java
index 7c18ac1bb4..6cd167c328 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/estimator/BasicMNodSizeEstimator.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/estimator/BasicMNodSizeEstimator.java
@@ -34,7 +34,6 @@ public class BasicMNodSizeEstimator implements 
IMNodeSizeEstimator {
    *         <li>parent reference, 8B
    *         <li>fullPath reference, 8B
    *         <li>cacheEntry reference, 8B
-   *         <li>trigger reference, 8B
    *       </ol>
    *   <li>MapEntry in parent
    *       <ol>
@@ -44,7 +43,7 @@ public class BasicMNodSizeEstimator implements 
IMNodeSizeEstimator {
    *       </ol>
    * </ol>
    */
-  protected static final int NODE_BASE_SIZE = 100;
+  protected static final int NODE_BASE_SIZE = 92;
 
   /**
    * The basic extra memory occupied by an InternalMNode based on MNode 
occupation
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/ISchemaRegion.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/ISchemaRegion.java
index c195be9633..ed6bea2417 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/ISchemaRegion.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/ISchemaRegion.java
@@ -76,7 +76,6 @@ import java.util.function.Function;
  *   <li>Interfaces for alias and tag/attribute operations
  *   <li>Interfaces for InsertPlan process
  *   <li>Interfaces for Template operations
- *   <li>Interfaces for Trigger
  * </ol>
  */
 public interface ISchemaRegion {
@@ -415,10 +414,4 @@ public interface ISchemaRegion {
   int countPathsUsingTemplate(int templateId, PathPatternTree patternTree) 
throws MetadataException;
 
   // endregion
-
-  // region Interfaces for Trigger
-  IMNode getMNodeForTrigger(PartialPath fullPath) throws MetadataException;
-
-  void releaseMNodeAfterDropTrigger(IMNode node) throws MetadataException;
-  // endregion
 }
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
index 333ed72ffd..cb8cfa17cf 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
@@ -141,7 +141,6 @@ import static 
org.apache.iotdb.tsfile.common.constant.TsFileConstant.PATH_SEPARA
  *   <li>Interfaces for alias and tag/attribute operations
  *   <li>Interfaces and Implementation for InsertPlan process
  *   <li>Interfaces and Implementation for Template operations
- *   <li>Interfaces for Trigger
  * </ol>
  */
 @SuppressWarnings("java:S1135") // ignore todos
@@ -875,7 +874,7 @@ public class SchemaRegionMemoryImpl implements 
ISchemaRegion {
   }
 
   private void deleteSingleTimeseriesInternal(PartialPath p) throws 
MetadataException, IOException {
-    deleteOneTimeseriesUpdateStatisticsAndDropTrigger(p);
+    deleteOneTimeseriesUpdateStatistics(p);
     if (!isRecovering) {
       
writeToMLog(SchemaRegionPlanFactory.getDeleteTimeSeriesPlan(Collections.singletonList(p)));
     }
@@ -885,7 +884,7 @@ public class SchemaRegionMemoryImpl implements 
ISchemaRegion {
    * @param path full path from root to leaf node
    * @return After delete if the schema region is empty, return its path, 
otherwise return null
    */
-  private PartialPath 
deleteOneTimeseriesUpdateStatisticsAndDropTrigger(PartialPath path)
+  private PartialPath deleteOneTimeseriesUpdateStatistics(PartialPath path)
       throws MetadataException, IOException {
     Pair<PartialPath, IMeasurementMNode> pair =
         mtree.deleteTimeseriesAndReturnEmptyStorageGroup(path);
@@ -1767,20 +1766,6 @@ public class SchemaRegionMemoryImpl implements 
ISchemaRegion {
 
   // endregion
 
-  // region Interfaces for Trigger
-
-  @Override
-  public IMNode getMNodeForTrigger(PartialPath fullPath) throws 
MetadataException {
-    return mtree.getNodeByPath(fullPath);
-  }
-
-  @Override
-  public void releaseMNodeAfterDropTrigger(IMNode node) throws 
MetadataException {
-    // do nothing
-  }
-
-  // endregion
-
   private static class RecoverOperationResult {
 
     private static final RecoverOperationResult SUCCESS = new 
RecoverOperationResult(null);
@@ -1839,8 +1824,7 @@ public class SchemaRegionMemoryImpl implements 
ISchemaRegion {
         IDeleteTimeSeriesPlan deleteTimeSeriesPlan, SchemaRegionMemoryImpl 
context) {
       try {
         // since we only has one path for one DeleteTimeSeriesPlan
-        deleteOneTimeseriesUpdateStatisticsAndDropTrigger(
-            deleteTimeSeriesPlan.getDeletePathList().get(0));
+        
deleteOneTimeseriesUpdateStatistics(deleteTimeSeriesPlan.getDeletePathList().get(0));
         return RecoverOperationResult.SUCCESS;
       } catch (MetadataException | IOException e) {
         return new RecoverOperationResult(e);
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionSchemaFileImpl.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionSchemaFileImpl.java
index 1d09544452..7efd30df49 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionSchemaFileImpl.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionSchemaFileImpl.java
@@ -133,7 +133,6 @@ import static 
org.apache.iotdb.tsfile.common.constant.TsFileConstant.PATH_SEPARA
  *   <li>Interfaces for alias and tag/attribute operations
  *   <li>Interfaces and Implementation for InsertPlan process
  *   <li>Interfaces and Implementation for Template operations
- *   <li>Interfaces for Trigger
  * </ol>
  */
 @SuppressWarnings("java:S1135") // ignore todos
@@ -956,7 +955,7 @@ public class SchemaRegionSchemaFileImpl implements 
ISchemaRegion {
   }
 
   private void deleteSingleTimeseriesInternal(PartialPath p) throws 
MetadataException, IOException {
-    deleteOneTimeseriesUpdateStatisticsAndDropTrigger(p);
+    deleteOneTimeseriesUpdateStatistics(p);
     if (!isRecovering) {
       
writeToMLog(SchemaRegionPlanFactory.getDeleteTimeSeriesPlan(Collections.singletonList(p)));
     }
@@ -966,7 +965,7 @@ public class SchemaRegionSchemaFileImpl implements 
ISchemaRegion {
    * @param path full path from root to leaf node
    * @return After delete if the schema region is empty, return its path, 
otherwise return null
    */
-  private PartialPath 
deleteOneTimeseriesUpdateStatisticsAndDropTrigger(PartialPath path)
+  private PartialPath deleteOneTimeseriesUpdateStatistics(PartialPath path)
       throws MetadataException, IOException {
     Pair<PartialPath, IMeasurementMNode> pair =
         mtree.deleteTimeseriesAndReturnEmptyStorageGroup(path);
@@ -1771,20 +1770,6 @@ public class SchemaRegionSchemaFileImpl implements 
ISchemaRegion {
   }
   // endregion
 
-  // region Interfaces for Trigger
-
-  @Override
-  public IMNode getMNodeForTrigger(PartialPath fullPath) throws 
MetadataException {
-    return mtree.getNodeByPath(fullPath);
-  }
-
-  @Override
-  public void releaseMNodeAfterDropTrigger(IMNode node) throws 
MetadataException {
-    mtree.unPinMNode(node);
-  }
-
-  // endregion
-
   private static class RecoverOperationResult {
 
     private static final RecoverOperationResult SUCCESS = new 
RecoverOperationResult(null);
@@ -1844,8 +1829,7 @@ public class SchemaRegionSchemaFileImpl implements 
ISchemaRegion {
         IDeleteTimeSeriesPlan deleteTimeSeriesPlan, SchemaRegionSchemaFileImpl 
context) {
       try {
         // since we only has one path for one DeleteTimeSeriesPlan
-        deleteOneTimeseriesUpdateStatisticsAndDropTrigger(
-            deleteTimeSeriesPlan.getDeletePathList().get(0));
+        
deleteOneTimeseriesUpdateStatistics(deleteTimeSeriesPlan.getDeletePathList().get(0));
         return RecoverOperationResult.SUCCESS;
       } catch (MetadataException | IOException e) {
         return new RecoverOperationResult(e);
diff --git 
a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableTest.java 
b/server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableTest.java
index 836fc89092..8239fc8ca3 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableTest.java
@@ -22,7 +22,6 @@ package org.apache.iotdb.db.metadata.idtable;
 // import org.apache.iotdb.commons.exception.MetadataException;
 // import org.apache.iotdb.commons.path.PartialPath;
 // import org.apache.iotdb.db.conf.IoTDBDescriptor;
-// import 
org.apache.iotdb.db.engine.trigger.service.TriggerRegistrationService;
 // import org.apache.iotdb.db.exception.StorageEngineException;
 // import org.apache.iotdb.db.exception.metadata.DataTypeMismatchException;
 // import org.apache.iotdb.db.exception.query.QueryProcessException;
@@ -36,8 +35,6 @@ package org.apache.iotdb.db.metadata.idtable;
 // import org.apache.iotdb.db.qp.Planner;
 // import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
 // import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
-// import org.apache.iotdb.db.qp.physical.sys.CreateTriggerPlan;
-// import org.apache.iotdb.db.qp.physical.sys.DropTriggerPlan;
 // import org.apache.iotdb.db.service.IoTDB;
 // import org.apache.iotdb.db.utils.EnvironmentUtils;
 // import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
@@ -539,86 +536,6 @@ package org.apache.iotdb.db.metadata.idtable;
 //  }
 //
 //  @Test
-//  public void testTriggerAndInsert() {
-//    LocalSchemaProcessor schemaProcessor = IoTDB.schemaProcessor;
-//    try {
-//      long time = 1L;
-//
-//      schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-//      schemaProcessor.createTimeseries(
-//          new PartialPath("root.laptop.d1.non_aligned_device.s1"),
-//          TSDataType.valueOf("INT32"),
-//          TSEncoding.valueOf("RLE"),
-//          compressionType,
-//          Collections.emptyMap());
-//      schemaProcessor.createTimeseries(
-//          new PartialPath("root.laptop.d1.non_aligned_device.s2"),
-//          TSDataType.valueOf("INT64"),
-//          TSEncoding.valueOf("RLE"),
-//          compressionType,
-//          Collections.emptyMap());
-//
-//      Planner processor = new Planner();
-//
-//      String sql =
-//          "CREATE TRIGGER trigger1 BEFORE INSERT ON 
root.laptop.d1.non_aligned_device.s1 AS
-// 'org.apache.iotdb.db.metadata.idtable.trigger_example.Counter'";
-//
-//      CreateTriggerPlan plan = (CreateTriggerPlan) 
processor.parseSQLToPhysicalPlan(sql);
-//
-//      TriggerRegistrationService.getInstance().register(plan);
-//
-//      TSDataType[] dataTypes = new TSDataType[] {TSDataType.INT32, 
TSDataType.INT64};
-//      String[] columns = new String[2];
-//      columns[0] = "1";
-//      columns[1] = "2";
-//
-//      InsertRowPlan insertRowPlan =
-//          new InsertRowPlan(
-//              new PartialPath("root.laptop.d1.non_aligned_device"),
-//              time,
-//              new String[] {"s1", "s2"},
-//              dataTypes,
-//              columns,
-//              false);
-//      insertRowPlan.setMeasurementMNodes(
-//          new IMeasurementMNode[insertRowPlan.getMeasurements().length]);
-//
-//      // call getSeriesSchemasAndReadLockDevice
-//      IDTable idTable = IDTableManager.getInstance().getIDTable(new 
PartialPath("root.laptop"));
-//
-//      idTable.getSeriesSchemas(insertRowPlan);
-//
-//      // check SchemaProcessor
-//      IMeasurementMNode s1Node =
-//          schemaProcessor.getMeasurementMNode(
-//              new PartialPath("root.laptop.d1.non_aligned_device.s1"));
-//      assertEquals("s1", s1Node.getName());
-//      assertEquals(TSDataType.INT32, s1Node.getSchema().getType());
-//      assertNotNull(s1Node.getTriggerExecutor());
-//
-//      IMeasurementMNode s2Node =
-//          schemaProcessor.getMeasurementMNode(
-//              new PartialPath("root.laptop.d1.non_aligned_device.s2"));
-//      assertEquals("s2", s2Node.getName());
-//      assertEquals(TSDataType.INT64, s2Node.getSchema().getType());
-//      assertNull(s2Node.getTriggerExecutor());
-//
-//      // drop trigger
-//      String sql2 = "Drop trigger trigger1";
-//
-//      DropTriggerPlan plan2 = (DropTriggerPlan) 
processor.parseSQLToPhysicalPlan(sql2);
-//      TriggerRegistrationService.getInstance().deregister(plan2);
-//
-//      idTable.getSeriesSchemas(insertRowPlan);
-//      assertNull(s1Node.getTriggerExecutor());
-//    } catch (MetadataException | StorageEngineException | 
QueryProcessException e) {
-//      e.printStackTrace();
-//      fail("throw exception");
-//    }
-//  }
-//
-//  @Test
 //  public void testGetDiskSchemaEntries() {
 //    try {
 //      IDTable idTable = IDTableManager.getInstance().getIDTable(new 
PartialPath("root.laptop"));
diff --git 
a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/trigger_example/Counter.java
 
b/server/src/test/java/org/apache/iotdb/db/metadata/idtable/trigger_example/Counter.java
deleted file mode 100644
index 77145e9077..0000000000
--- 
a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/trigger_example/Counter.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.metadata.idtable.trigger_example;
-
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.engine.trigger.api.Trigger;
-import org.apache.iotdb.trigger.api.TriggerAttributes;
-import org.apache.iotdb.tsfile.utils.Binary;
-
-public class Counter implements Trigger {
-
-  public static final int BASE = 1377;
-
-  private int counter = 0;
-  private boolean isStopped = true;
-
-  @Override
-  public void onCreate(TriggerAttributes attributes) {
-    counter = BASE;
-    isStopped = false;
-  }
-
-  @Override
-  public void onStart() {
-    isStopped = false;
-  }
-
-  @Override
-  public void onStop() {
-    isStopped = true;
-  }
-
-  @Override
-  public Integer fire(long timestamp, Integer value, PartialPath path) {
-    ++counter;
-    return value;
-  }
-
-  @Override
-  public Long fire(long timestamp, Long value, PartialPath path) {
-    ++counter;
-    return value;
-  }
-
-  @Override
-  public Float fire(long timestamp, Float value, PartialPath path) {
-    ++counter;
-    return value;
-  }
-
-  @Override
-  public Double fire(long timestamp, Double value, PartialPath path) {
-    ++counter;
-    return value;
-  }
-
-  @Override
-  public Boolean fire(long timestamp, Boolean value, PartialPath path) {
-    ++counter;
-    return value;
-  }
-
-  @Override
-  public Binary fire(long timestamp, Binary value, PartialPath path) {
-    ++counter;
-    return value;
-  }
-
-  public void setCounter(int counter) {
-    this.counter = counter;
-  }
-
-  public int getCounter() {
-    return counter;
-  }
-
-  public boolean isStopped() {
-    return isStopped;
-  }
-}

Reply via email to