mychaow commented on a change in pull request #1732:
URL: https://github.com/apache/iotdb/pull/1732#discussion_r505141002



##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
##########
@@ -230,20 +233,27 @@ public ReadOnlyMemChunk query(String deviceId, String 
measurement, TSDataType da
   }
 
   @Override
-  public void delete(String deviceId, String measurementId, long 
startTimestamp, long endTimestamp) {
-    Map<String, IWritableMemChunk> deviceMap = memTableMap.get(deviceId);
-    if (deviceMap != null) {
-      IWritableMemChunk chunk = deviceMap.get(measurementId);
-      if (chunk == null) {
-        return;
-      }
-      // If startTimestamp == Long.MIN_VALUE && endTimestamp == Long.MAX_VALUE,
-      // it means that the whole timeseries is deleted
-      if (startTimestamp == Long.MIN_VALUE && endTimestamp == Long.MAX_VALUE) {
-        deviceMap.remove(measurementId);
+  public void delete(PartialPath originalPath, PartialPath devicePath, long 
startTimestamp, long endTimestamp) {
+    Map<String, IWritableMemChunk> deviceMap = 
memTableMap.get(devicePath.getFullPath());
+    if (deviceMap == null) {
+      return;
+    }
+    if (originalPath.getNodes().length <= devicePath.getNodes().length ||

Review comment:
       hi, why clear the deviceMap?   if originalPath is root.ln.sg and 
devicePath is root.ln.sg.d1, we only need to delete the points in time range 
[89, 100], but the memChunk maybe have points in time range [0, 100].  Same as 
the second condition which check  the last path is *.

##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
##########
@@ -1467,26 +1473,30 @@ private void 
deleteDataInFiles(Collection<TsFileResource> tsFileResourceList, De
       // delete data in memory of unsealed file
       if (!tsFileResource.isClosed()) {
         TsFileProcessor tsfileProcessor = 
tsFileResource.getUnsealedFileProcessor();
-        tsfileProcessor.deleteDataInMemory(deletion);
+        tsfileProcessor.deleteDataInMemory(deletion, devicePaths);
       }
 
       // add a record in case of rollback
       updatedModFiles.add(tsFileResource.getModFile());
     }
   }
 
-  private void tryToDeleteLastCache(PartialPath deviceId, String 
measurementId, long startTime,
-      long endTime) throws WriteProcessException {
+  private void tryToDeleteLastCache(PartialPath deviceId, PartialPath 
originalPath,
+      long startTime, long endTime) throws WriteProcessException {
+    if (!IoTDBDescriptor.getInstance().getConfig().isLastCacheEnabled()) {
+      return;
+    }
     try {
       MManager manager = MManager.getInstance();

Review comment:
       help me change the MManager.getInstance() to IoTDB.metaManager




----------------------------------------------------------------
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.

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


Reply via email to