Repository navigation
Conversation
| sourceFile.getAbsolutePath())); | ||
| } | ||
| } | ||
| if (JVMCommonUtils.getDiskFreeRatio(targetFilePath.getAbsolutePath()) |
There was a problem hiding this comment.
major iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/util/LoadUtil.java:258 — Pipe async load aborts on a low selected disk without trying other listening dirs
The margin is enforced after selection instead of during it, so the selection still accepts a dir with freeRatio in (disk_space_warning_threshold, threshold+0.05]. With the default MIN_IO_FIRST strategy, MinIOSelector.selectTargetDirectory deterministically returns the listening dir on the source's mount point (no space check at all), so every sender retry of the same seal re-selects the same low disk and loadFilesToActiveDir throws again, even when another configured load_active_listening_dirs entry has ample space. The pipe async load then stalls indefinitely while the node is not read-only, and each retry forces a full TsFile re-transfer.
Fix: Make the disk selector margin-aware (e.g., extend the hasSpace predicate used by SequenceStrategy/MinIOSelector with the 0.05 margin, or loop over the configured listening dirs and skip those below the margin) so a low dir is not selected/thrown on while a healthier dir exists.
There was a problem hiding this comment.
Implemented in commit c8d73be5800. Async disk selection now applies the warning threshold plus the safety margin before choosing a target. When the source-mount directory is below that limit, the selector tries the configured listening directories and uses a healthy one instead. LoadUtilTest.testPipeAsyncLoadUsesSelectedDiskThresholdAcrossMultipleDisks covers this fallback.
| if (!LoadUtil.loadFilesToActiveDir(loadAttributes, absolutePaths, true)) { | ||
| throw new PipeException(DataNodePipeMessages.LOAD_ACTIVE_LISTENING_PIPE_DIR_IS_NOT); | ||
| } | ||
| } catch (final DiskSpaceInsufficientException e) { |
There was a problem hiding this comment.
minor iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java:919 — New DISK_SPACE_INSUFFICIENT mapping in loadTsFileAsync is untested
The added catch that converts DiskSpaceInsufficientException into RpcUtils.getStatus(e.getErrorCode(), e.getMessage()) has no test: IoTDBDataNodeReceiverTest contains no DISK_SPACE_INSUFFICIENT/DiskSpaceInsufficient assertion and no test stubs LoadUtil.loadFilesToActiveDir to throw. A regression here (wrong status code, unmarked retryable task, or lost staging file) would pass CI, since the retry/keep-files behaviour depends on the returned code being in StatusUtils.NEED_RETRY.
Fix: Add a test that stubs LoadUtil.loadFilesToActiveDir to throw DiskSpaceInsufficientException and asserts the seal response code is TSStatusCode.DISK_SPACE_INSUFFICIENT and that the retryable task keeps its staged files.
There was a problem hiding this comment.
Implemented in commit c8d73be5800. Added a receiver regression test that drives a V2 seal request while stubbing LoadUtil.loadFilesToActiveDir to throw DiskSpaceInsufficientException. It asserts the response code, retry classification, paused task state, and retained staged file. Both targeted test classes pass (14 tests total).
|
Review-comment updates for PR #19534 Findings: the async-load disk margin was checked only after directory selection, and the insufficient-space status mapping lacked receiver retry/staging coverage. The selector now skips low-space candidates and falls back to a healthy configured listening directory. Added receiver seal coverage for Verification: Reviewed PR head: |
| return new File(finalFolderManager.getNextFolder()); | ||
| } | ||
| for (int i = 0; i < dirs.length; i++) { | ||
| final String folder = finalFolderManager.getNextFolder(); |
There was a problem hiding this comment.
minor iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/util/LoadUtil.java:507 — Margin scan samples a shared unsynchronized folder cursor, so a healthy listening dir can be skipped
The new selection loop probes candidates through finalFolderManager.getNextFolder(), i.e. SequenceStrategy.nextFolderIndex()'s plain (non-volatile, unsynchronized) currentIndex read-modify-write on a FolderManager instance shared by all callers of the static loadDiskSelector (multiple IoTDBDataNodeReceiver instances via loadTsFileAsync, plus loadTsFilesToActiveDir from query threads). A concurrent nextFolderIndex() between two iterations makes the loop read one folder twice and never sample another, so the dirs.length iterations are not distinct and a dir above the margin can be missed: DiskSpaceInsufficientException is thrown although a healthy listening dir exists, costing a full TsFile re-transfer per retry.
Fix: Iterate the captured dirs array directly (skipping unavailable folders) instead of sampling the shared round-robin cursor, or synchronize the scan on the FolderManager.
There was a problem hiding this comment.
Fixed in 60bcd129795. The margin-aware scan now iterates the captured dirs array directly and uses an independent atomic round-robin index for its starting point. Concurrent calls no longer share the mutable FolderManager cursor during a candidate scan, so each invocation checks every configured directory once.
|
|
||
| try { | ||
| Assert.assertTrue( | ||
| LoadUtil.loadFilesToActiveDir( |
There was a problem hiding this comment.
minor iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/load/util/LoadUtilTest.java:178 — No test covers the rejection branch when every listening dir is below the margin
testPipeAsyncLoadUsesSelectedDiskThresholdAcrossMultipleDisks is the only test that drives the real selector with a margin, and it only stubs one healthy plus one low dir and asserts success (LoadUtil.java:506-511). Nothing asserts the throw new DiskSpaceInsufficientException(Arrays.asList(dirs)) fallback nor the post-selection guard at LoadUtil.java:262, and the receiver test stubs LoadUtil.loadFilesToActiveDir wholesale. Flipping the > comparison or dropping either guard keeps CI green while the feature stops rejecting low disks.
Fix: Add a case where every configured listening dir returns a free ratio <= warningThreshold+0.05 and assert DiskSpaceInsufficientException is thrown and the source TsFile still exists in the receiver dir.
There was a problem hiding this comment.
Added testPipeAsyncLoadRejectsWhenAllListeningDisksAreBelowThreshold. It sets one directory exactly at the warning threshold plus the safety margin and a second below it; the test verifies DiskSpaceInsufficientException and confirms the source TsFile remains. LoadUtilTest passes (14 tests).
|
Review-comment update for PR #19534 Findings: Fixed the shared-cursor race in threshold-aware disk selection and added rejection-path coverage for the all-low-space case. Changes: The scan now checks each configured directory using a separate atomic round-robin starting index, so concurrent use of the shared FolderManager cursor cannot skip candidates. Added Verification: Reviewed PR head: |
Summary
disk_space_warning_thresholdto Pipe async loads.DISK_SPACE_INSUFFICIENT, leaving source files intact for retry.Example
With the default
disk_space_warning_threshold = 0.05(5% free), the kernel cutoff is 5% free. The async-load guard rejects a selected disk at or below 10% free (for example, 8%) and accepts one with 20% free.Tests
LoadUtilTestandIoTDBDataNodeReceiverTest(37 tests passed)