xmg333 commented on PR #18463:
URL: 
https://github.com/apache/dolphinscheduler/pull/18463#issuecomment-5574362265

   Thanks for the review. Both findings are addressed.
   
   ### 1. Keep the remote log file stable during streaming
   
   Implemented the first option: `RemoteLogClient.streamWholeLog` now creates a 
private snapshot for each download.
   
   * The cache is copied to a unique temporary file 
(`<archive>.download-<uuid>`) under the striped lock, and streaming reads from 
the snapshot instead of the cache.
   * The snapshot is deleted after the transfer, including failure paths. A 
startup sweep also removes snapshots older than 1 hour.
   * This removes the race with a concurrent re-download truncating the cache. 
The existing short-read check remains as a defensive check.
   * The implementation documents the additional disk usage (~2x peak disk 
space per download).
   
   Added a regression test, 
`streamWholeLog_concurrentCacheRewriteDuringTransfer_activeDownloadUnaffected`, 
which reproduces the concurrent cache rewrite and verifies that the active 
download still receives the original content. The test fails with the previous 
implementation, so it covers the actual race.
   
   ### 2. Wait for async completion before asserting the response body
   
   Implemented as suggested. The success test now verifies 
`request().asyncStarted()`, captures the `MvcResult`, and uses 
`asyncDispatch(mvcResult)` before asserting the status, headers, and response 
body.
   


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