diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/subscription/broker/consensus/ConsensusPrefetchingQueueWalBackpressureTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/subscription/broker/consensus/ConsensusPrefetchingQueueWalBackpressureTest.java index adcf18a50d82..e7699eb5e205 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/subscription/broker/consensus/ConsensusPrefetchingQueueWalBackpressureTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/subscription/broker/consensus/ConsensusPrefetchingQueueWalBackpressureTest.java @@ -373,11 +373,13 @@ private void assertWalGapRecoveryResumesRealtime( deliveredLocalSeq, event.getCommitContext().getWriterProgress().getLocalSeq()); assertTrue(queue.ack("consumer", event.getCommitContext())); } - assertEquals( - followerBeforePending ? oneTabletBytes : 0L, memoryManager.getUsedMemorySizeInBytes()); + // Ordered replay retains blocked writer heads as raw requests until they can be emitted. + assertEquals(0L, memoryManager.getUsedMemorySizeInBytes()); } assertEquals(requestCount, deliveredLocalSeq); if (followerBeforePending) { + assertTrue(queue.getRetainedRequestBytes() > 0L); + assertEquals(queue.getRetainedRequestBytes(), requestMemoryBlock.getUsedMemoryInBytes()); // The replicated writer's later timestamp lets local requests drain in order. Removing // the local writer then releases that final follower entry without reading it again. queue.setActiveWriterNodeIds(Collections.singleton(WRITER_NODE_ID + 1)); @@ -411,7 +413,7 @@ private void assertWalGapRecoveryResumesRealtime( missingWalGap ? Arrays.asList(2L, 3L, 4L, 5L, 6L, 7L, 8L) : (followerBeforePending - ? Arrays.asList(1L, -1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L) + ? Arrays.asList(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, -1L) : Arrays.asList(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L)), conversions); }