Caideyipi commented on code in PR #18833:
URL: https://github.com/apache/iotdb/pull/18833#discussion_r4346532845
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/deletion/persist/PageCacheDeletionBuffer.java:
##########
@@ -372,11 +377,15 @@ private void persistDeletion() throws IOException {
// For first deletion we use blocking take() method.
try {
DeletionResource firstDeletionResource = deletionResources.take();
- // Serialize deletion. The first serialization cannot fail because a
deletion cannot exceed
- // size of serializeBuffer.
- serializeDeletionToBatchBuffer(firstDeletionResource);
pendingDeletionsInOneTask.add(firstDeletionResource);
currentTaskDeletionCount++;
+ // A deletion can exceed the DAL buffer even when it is the first
entry in a batch.
+ // Include it in failure handling so it cannot be acknowledged without
being written.
+ if (!serializeDeletionToBatchBuffer(firstDeletionResource)) {
+ throw new IOException(
+ DataNodePipeMessages
+
.EXCEPTION_DELETION_RESOURCE_EXCEEDS_THE_DAL_BUFFER_SIZE_E2A17CAC);
+ }
Review Comment:
Yes, these states are handled on the failure path. The first resource is
registered in pendingDeletionsInOneTask and counted before the oversized check,
so the IOException reaches the same cleanup path: onPersistFailed is called,
currentTaskBatchSize is rolled back, pending state is cleared, and
currentTaskDeletionCount decrements the outstanding-resource count. The next
PersistTask therefore starts clean. I added assertions in e3a2f34 to verify the
failed callback occurs once and the failed resource never receives
onPersistSucceed. PageCacheDeletionBufferTest passes with 5 tests.
--
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]