Skip to content

Add pipe receiver memory protection#18090

Open
Caideyipi wants to merge 3 commits into
apache:masterfrom
Caideyipi:codex/pipe-receiver-memory-protection
Open

Add pipe receiver memory protection#18090
Caideyipi wants to merge 3 commits into
apache:masterfrom
Caideyipi:codex/pipe-receiver-memory-protection

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Description

  • Add DataNode receiver pipe memory accounting around compressed request decompression, sliced request buffering/assembly, and file-piece writes.
  • Release buffered slice memory on clear/exit/error paths and reject invalid/oversized slices before assembly.
  • Add a helper to estimate compressed request decompression size without consuming the request body.

Tests

  • mvn -pl iotdb-core/node-commons -Dtest=PipeTransferCompressedReqTest,PipeTransferSliceReqBuilderTest test
  • mvn -pl iotdb-core/datanode -am -DskipTests compile
  • mvn -pl iotdb-core/datanode -am -Dtest=IoTDBDataNodeReceiverTest -Dsurefire.failIfNoSpecifiedTests=false test
@Caideyipi Caideyipi force-pushed the codex/pipe-receiver-memory-protection branch from e8a0833 to 78ced86 Compare July 3, 2026 02:00

@jt2594838 jt2594838 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is worth noticing that for come-and-go requests, it already holds the Thrift FrameBuffer.
Therefore, if it is not cached by Pipe or uncompressed, there is no necessity to allocate Pipe memory for it.
Even if it is uncompressed, you may only need to allocate the part that exceeds the FrameBuffer.

Comment on lines +456 to +458
return new TPipeTransferResp(
getReceiverTemporaryUnavailableStatus(
"decompressing pipe transfer request", requestedMemorySizeInBytes, e));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 9213e48: the receiver OOM status text now uses the DataNode pipe i18n messages with English and Chinese entries.

Comment on lines +432 to +434
} catch (Exception ex) {
return PipeTransferFilePieceResp.toTPipeTransferResp(status);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception is not reflected in the status?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 9213e48: the returned status now keeps the receiver OOM context and includes the root-cause exception message instead of dropping it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants