Repository navigation
Conversation
CI Fix and VerificationThe CI failure came from a test double intercepting only the legacy two-argument The focused sink test and Spotless check passed locally. For end-to-end verification, a temporary test-only adapter selected UDP and ran Current local and remote head: |
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #19357 +/- ##
============================================
+ Coverage 49.44% 50.58% +1.14%
+ Complexity 718 129 -589
============================================
Files 5656 5786 +130
Lines 418222 426060 +7838
Branches 55296 56535 +1239
============================================
+ Hits 206769 215519 +8750
+ Misses 211453 210541 -912 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| ReadWriteIOUtils.write(sliceReq.sliceIndex, outputStream); | ||
| ReadWriteIOUtils.write(sliceReq.sliceCount, outputStream); | ||
| final int orderIdHighBits = (int) (orderId >>> Integer.SIZE); |
There was a problem hiding this comment.
major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/sink/payload/thrift/request/PipeTransferSliceReq.java:131 — UDP slice order id high bits collide with legacy 32-bit order id after sender restart
The high 32 bits of the UDP slice order id are appended after the legacy 32-bit order id, and getOrderId() truncates to (int) orderId. nextUdpSliceOrderId() derives the id from udpRequestIdGenerator, which is seeded randomly per sink instance, so after a sender restart a new request can share the low 32 bits with an id already in retiredUdpResults. receiveSliceWithReordering then returns the retired STALE/DROPPED result, the receiver answers SUCCESS, and the new request's slices are
…[truncated]
Fix: Key retiredUdpResults (and the pending map) on the full 64-bit order id only, or make the retired-result lookup also compare the full id; do not let a truncated 32-bit match suppress a new request.
There was a problem hiding this comment.
Thanks for flagging this. Both pendingUdpRequests and retiredUdpResults are keyed by the full long UDP order ID, and the UDP receiver uses getUdpOrderId() for these lookups; the legacy getOrderId() value is not used as the map key. The existing testUdpSliceOrderUsesUpperBitsAcrossSenderRestarts uses IDs with identical low 32 bits and different high 32 bits, retires one, and verifies that the restarted ID is accepted while the retired ID remains stale. I could not reproduce the described collision in the current implementation, so no code change was needed for this comment.
| } | ||
| final TPipeTransferResp response = | ||
| receiveNestedRequest(req.get(), strictUnidirectional, udp); | ||
| if (udp |
There was a problem hiding this comment.
major iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java:1301 — UDP slice memory blocks leak when nested request returns TEMPORARY_UNAVAILABLE
reserveUdpSliceMemory allocates a PipeMemoryBlock per accepted slice into allocatedUdpSliceMemoryBlocks, but when the nested request returns PIPE_RECEIVER_TEMPORARY_UNAVAILABLE_EXCEPTION the code deliberately skips completeUdpRequest/clearUdpSliceMemoryBlocks (line 1301-1307) so the request can be retried. The blocks are only freed by the 15-minute expireUdpRequests sweep or handleExit, so repeated temporary-unavailable responses accumulate receiver memory for the whole timeout w
…[truncated]
Fix: Free the per-order blocks on the temporary-unavailable path (the slices are already buffered in the handler and will be re-reserved on retry), or cap the retained blocks per order id.
There was a problem hiding this comment.
Thanks for raising the memory-accounting concern. The receiver retains the assembled slice state so it can retry the same UDP order after TEMPORARY_UNAVAILABLE; releasing only its PipeMemoryBlocks would leave retained slice arrays unaccounted, while discarding the slices would prevent that retry. Retention is bounded by pipe_air_gap_receiver_udp_max_pending_request_count (32 by default), slice allocations are charged to the receiver memory manager, idle pending orders are evicted after pipeSinkTransferTimeoutMs (15 minutes by default), and receiver exit releases any remaining blocks. Active retries refresh the order's activity time, so its memory remains accounted while that retryable request is still active. No code change was needed for this comment.
| currentDatagramRequestId != null | ||
| && udpRequestDeduplicator != null | ||
| && req.type != PipeRequestType.TRANSFER_SLICE.getType(); | ||
| final long requestFingerprint = deduplicate ? ByteBuffer.wrap(data).getLong() : 0; |
There was a problem hiding this comment.
major iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/airgap/IoTDBAirGapReceiver.java:192 — ACK retry of a failed UDP request is deduplicated as already completed
sendOneDatagram retries the identical datagram (same requestId, same CRC fingerprint) up to udpRequestCount times. On the receiver, handleReq returning false (e.g. a non-retryable error status) still falls through to markCompleted only on success, but a request that succeeded on the receiver while its ACK was lost is fine; conversely a request whose first attempt returned a failure status is not marked, so retry works. However for TRANSFER_SLICE the dedup is skipped entirely and for
…[truncated]
Fix: Use the full datagram (request id + checksum + payload hash) as the dedup fingerprint, or include the request id in the fingerprint so distinct requests cannot collide.
There was a problem hiding this comment.
Thanks for the report. The completed-request cache now stores a SHA-256 digest of the full serialized request data, rather than comparing only its first eight bytes; the request ID remains the cache key. I added regression coverage for inputs with the same first eight bytes but different trailing data. Spotless and the focused IoTDBAirGapReceiverAgentTest run passed (10 tests).
|
Review round for PR #19357, reviewed head |
| IntStream.rangeClosed(1, CONNECTOR_AIR_GAP_UDP_REQUEST_COPY_COUNT_MAX_VALUE) | ||
| .mapToObj(String::valueOf) | ||
| .toArray(String[]::new); | ||
| validator |
There was a problem hiding this comment.
major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/sink/protocol/IoTDBAirGapSink.java:283 — request-copy-count attribute is always rejected by validateAttributeValueRange
validateAttributeValueRange first calls parameters.hasAttribute(key), which only matches the exact key or KeyReducer.shallowReduce/reduce(key) (e.g. air-gap.udp.request-copy-count), never the full connector.air-gap.udp.request-copy-count / sink.air-gap.udp.request-copy-count keys. Setting the documented connector.air-gap.udp.request-copy-count=2 therefore throws PipeParameterNotValidException ("parameter should be set") and the pipe cannot be created.
Fix: Validate with parameters.hasAnyAttributes(CONNECTOR_..., SINK_...) plus an explicit value check (like the sendIntervalMs/packetSize validators), or call validateAttributeValueRange with the reduced key air-gap.udp.request-copy-count.
|
|
||
| receiverSocket.setSoTimeout(1000); | ||
| long firstRequestId = -1L; | ||
| for (int i = 0; i < 3; i++) { |
There was a problem hiding this comment.
major iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/sink/protocol/airgap/IoTDBDataRegionAirGapSinkTest.java:202 — Strict-unidirectional UDP slice test expects 3 datagrams but default copy count sends 6
testStrictUnidirectionalUdpSendsAllSlicesWithoutAcknowledgements sets no request-copy-count, so udpRequestCopyCount defaults to 2 and sendBytesByUdp sends copyRounds * requestCount = 6 datagrams for the 2500-byte request. The loop still reads only 3 packets and asserts firstRequestId + i, so the test fails (and leaves 3 unread datagrams).
Fix: Set SINK_AIR_GAP_UDP_REQUEST_COPY_COUNT_KEY/CONNECTOR_... to 1 in this test, or read and assert all 6 datagrams (two identical rounds).




Summary
pipe_air_gap_receiver_udp_max_pending_request_count, default32); the least-recently-used incomplete request is evicted at the limit.1 ms; retain the default of2request copies. Copies are duplicate datagrams, not acknowledgement retries.Example
For a strict one-way UDP connector, use:
This sends two copies of each datagram at a 1 ms interval, with a configured packet limit of 1400 bytes; it does not wait for acknowledgements in strict one-way mode.
Two-host replay results
A fixed, preloaded 8,000,000-row historical dataset was replayed between two independent open-source 1C1D clusters. Each candidate used one concurrent Pipe, strict unidirectional UDP, 1400-byte packets, no external writes during measurement, and the same dataset. The reported sender byte rates and send counts are from the sender; receive counts and final SQL row counts are from the receiver.
The
1 ms / 2 copies / reorder 32setting completed the initial run and three repeats with no observed datagram loss and all rows present. The 5 ms result used one copy, so it is not a copy-for-copy comparison with the recommended default. A matching 5 ms / 2-copy trial was not run.The receiver UDP request queue capacity was 4,096 datagrams / 32 MiB, sampled once per second. It recorded
0/29full samples in each 1 ms / 2-copy trial; the longest run of full samples was zero. Historical replay was treated as sender backlog for this workload, but the sender's shared outbound queue occupancy was not independently sampled. These results therefore do not establish behavior with a continuously full receiver request queue, and one-second samples do not prove continuous occupancy between samples.Validation
PipeDescriptorTestandPipeTransferSliceReqBuilderTest: 19 tests passed, 0 failures or errors.