Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRESOLVER-331] Make DefaultTrackingFileManager write directly to tracking files #259

Merged
merged 1 commit into from
Feb 26, 2023

Conversation

michael-o
Copy link
Member

No description provided.

@asfgit asfgit force-pushed the direct-write branch 2 times, most recently from 6d4ab15 to 4694f15 Compare February 26, 2023 19:20
@michael-o michael-o changed the title Direct write [MRESOLVER-331] Make DefaultTrackingFileManager write directly to tracking files Feb 26, 2023
@michael-o michael-o marked this pull request as ready for review February 26, 2023 20:03
@michael-o michael-o requested a review from cstamas February 26, 2023 20:03
@asfgit asfgit closed this in 23cd526 Feb 26, 2023
@asfgit asfgit merged commit 23cd526 into master Feb 26, 2023
@michael-o michael-o deleted the direct-write branch February 26, 2023 20:51
cstamas added a commit that referenced this pull request Nov 17, 2023
Fixes:
* move() call should NOT perform the move, as writer stream to tmp file may still be open
* move the file move logic to close, make it happen only when closing collocated temp file
* perform fsync before atomic move to ensure there is no OS dirty buffers related to newly written file
* on windows go with old code that for some reason works (avoid NIO2)
* on non-Win OS fsync the parent directory as well.

So, to recap:
* original issue is not related to locking at all, is about change done in 1.9 where file processor was altered to use nio2 atomic move (to prevent possibility of partial download being read by other process and prevent incomplete files in case of crash).  Maven LRM uses layout, so randomized temp files does not matter (if they remain after crash), as they would merely just clutter the local repository but not corrupt it.
* nuking local repo is part of healthy hygiene anyway
* seems windows (or java on windows) have issues with atomic fs ops
* resolver have no deps on p-u or any commons, api and util modules are zero dependency jars and should remain as such
* one thing bugs me still: why does the old code work? Or in reverse, the new why does not work? As opposed to "high frequency writes", this is not that case (fixed by @olamy ... Um, sorry @michael-o )

To explain this last bullet: there was https://issues.apache.org/jira/browse/MRESOLVER-325 with solution #259 that "seems similar", as originally this code was used by both, and in that case "high frequency atomic moves" was applicable. But this now happens seemingly on "install" and "cache" (download, place it in local repo) that has way less frequency that tracking file write....

---

https://issues.apache.org/jira/browse/MRESOLVER-372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants