jt2594838 commented on code in PR #18634:
URL: https://github.com/apache/iotdb/pull/18634#discussion_r4003558100


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java:
##########
@@ -722,6 +722,10 @@ private void handleEncodingWithoutDeletedMeasurements(
                     alignedWorkingListForFlush.getValueIndex(sortedRowIndex))) 
{
               continue;
             }
+            // Keep value pages aligned with the time page when an entire 
timestamp is deleted.

Review Comment:
   Skip time-deleted rows while encoding aligned value pages so value positions 
remain aligned with the time page. This fixes the reproduced flush regression 
where later values shifted after DELETE plus FLUSH.



##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/MemTableFlushTaskTest.java:
##########
@@ -272,6 +272,80 @@ public void 
testAlignedFastPathKeepsPagesAndValuesAlignedAfterPartialSegmentSort
     }
   }
 
+  @Test
+  public void testAlignedFlushKeepsValuesAlignedAfterTimeDeletion() throws 
IOException {
+    // Deleted rows must be omitted from both time and value pages, including 
after sorting.

Review Comment:
   These tests cover both aligned flush encoding paths and page/chunk 
boundaries, proving deleted timestamps do not shift values and column-remapping 
remains correct.



##########
integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDeletionTableIT.java:
##########
@@ -358,6 +358,63 @@ public void testDeleteDataByAttributeFilter() throws 
SQLException {
     }
   }
 
+  /**
+   * Verifies that a deletion restricted by both an attribute and an exact 
timestamp remains
+   * effective after the affected data is flushed from the memtable.
+   */
+  @Test
+  public void testDeleteFromWhereAttributeAndTimeAfterFlush() throws 
SQLException {

Review Comment:
   This integration test reproduces the case1 SQL sequence and verifies row 
counts and exact values before and after FLUSH, guarding the user-visible 
regression.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to