luoluoyuyu commented on PR #19258:
URL: https://github.com/apache/iotdb/pull/19258#issuecomment-6849798165

   All four items are fixed in `bc2958c`.
   
   **1. Every copy is atomic and overwrite-safe.** `increaseFileReference()` 
now routes the `.mod` / `.resource` copies through `copyFileAtomically()` too 
(the public copy in `increasePublicReference()` goes through the same 
`increaseFileReference()` path), and the helper deletes a stale 
`<target>.unfinished` before copying. The rename keeps `REPLACE_EXISTING`, so a 
partial copy left by a previous failure is replaced instead of failing every 
later pin with `FileAlreadyExistsException`. Covered by 
`testStaleCopiedFileIsReplacedInsteadOfFailingThePin()` (stale `.mod` copy + 
stale temporary file, pin succeeds) and 
`testAtomicCopyLeavesNothingBehindWhenItFails()` (missing source: no target, no 
temporary file).
   
   **2. Test coverage for the copy path.** You are right that the old test only 
exercised `commons`'s MD5 relink; it is renamed to 
`testStalePipeFileWithDifferentContentIsReplaced()` with a comment that matches 
what it verifies. `copyFileAtomically()` is now `@TestOnly` public and has the 
two tests above, so `ATOMIC_MOVE` is exercised by unit tests and not only by 
the manual run.
   
   **3. Missing pipe file fails the pin.** The self-link branch now checks 
`isFile()` and throws 
`EXCEPTION_FAILED_TO_PIN_THE_PIPE_FILE_ARG_BECAUSE_IT_DOES_NOT_EXIST_1741B8E4` 
(`en` + `zh`) when the pipe file of the requesting scope no longer exists, 
instead of returning it and registering a reference count for a missing file. 
Covered by `testMissingPipeFileFailsThePin()`, which also asserts that no 
reference count is left behind.
   
   **4. `refresh()`** is back to the lock-free fast path with a double-checked 
rebuild under the monitor.
   
   Local: `spotless:apply` clean, `en`/`zh` compile, 23 unit tests pass (7 
mapping + 16 manager). PR description updated: the atomic/overwrite-safe copy 
is now stated for every copy, and the missing-file failure is listed. CI is 
running on `bc2958c`. Still open: the manual multi-disk run before merge.
   


-- 
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]

Reply via email to