HTHou opened a new pull request, #12445:
URL: https://github.com/apache/iotdb/pull/12445

   ## Description
   
   https://issues.apache.org/jira/browse/IOTDB-1667
   
   ## How to test
   
   Add a UT in DataRegionTest.
   Before this PR, syncDeleteDataFiles costs `101ms ~ 1121ms`.
   After this PR, syncDeleteDataFiles costs  about `12ms`.
   
   ```
     @Test
     public void testIoTDBTabletWriteAndDeleteDataRegion()
         throws QueryProcessException, IllegalPathException, 
WriteProcessException,
             TsFileProcessorException {
       String[] measurements = new String[2];
       measurements[0] = "s0";
       measurements[1] = "s1";
       TSDataType[] dataTypes = new TSDataType[2];
       dataTypes[0] = TSDataType.INT32;
       dataTypes[1] = TSDataType.INT64;
   
       MeasurementSchema[] measurementSchemas = new MeasurementSchema[2];
       measurementSchemas[0] = new MeasurementSchema("s0", TSDataType.INT32, 
TSEncoding.PLAIN);
       measurementSchemas[1] = new MeasurementSchema("s1", TSDataType.INT64, 
TSEncoding.PLAIN);
   
       long[] times = new long[100];
       Object[] columns = new Object[2];
       columns[0] = new int[100];
       columns[1] = new long[100];
   
       for (int r = 0; r < 100; r++) {
         times[r] = r;
         ((int[]) columns[0])[r] = 1;
         ((long[]) columns[1])[r] = 1;
       }
   
       InsertTabletNode insertTabletNode1 =
           new InsertTabletNode(
               new QueryId("test_write").genPlanNodeId(),
               new PartialPath("root.vehicle.d0"),
               false,
               measurements,
               dataTypes,
               measurementSchemas,
               times,
               null,
               columns,
               times.length);
   
       dataRegion.insertTablet(insertTabletNode1);
   
       for (int r = 50; r < 149; r++) {
         times[r - 50] = r;
         ((int[]) columns[0])[r - 50] = 1;
         ((long[]) columns[1])[r - 50] = 1;
       }
   
       InsertTabletNode insertTabletNode2 =
           new InsertTabletNode(
               new QueryId("test_write").genPlanNodeId(),
               new PartialPath("root.vehicle.d0"),
               false,
               measurements,
               dataTypes,
               measurementSchemas,
               times,
               null,
               columns,
               times.length);
   
       dataRegion.insertTablet(insertTabletNode2);
       long start = System.nanoTime();
       dataRegion.syncDeleteDataFiles();
       System.out.println(System.nanoTime() - start);
       Assert.assertEquals(0, SystemInfo.getInstance().getTotalMemTableSize());
   
       QueryDataSource queryDataSource =
           dataRegion.query(
               Collections.singletonList(new PartialPath(deviceId, 
measurementId)),
               deviceId,
               context,
               null,
               null);
   
       Assert.assertEquals(0, queryDataSource.getSeqResources().size());
       Assert.assertEquals(0, queryDataSource.getUnseqResources().size());
     }
   ```


-- 
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-unsubscr...@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to