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

Use atomic file move operations. #1155

Merged
merged 1 commit into from Dec 7, 2019
Merged

Conversation

@olafurpg
Copy link
Member

olafurpg commented Dec 5, 2019

Following up on #935 (comment)

Following up on #935 (comment)
)
} catch {
case NonFatal(_) =>
Files.move(tmp, path.toNIO, StandardCopyOption.REPLACE_EXISTING)

This comment has been minimized.

Copy link
@tgodzik

tgodzik Dec 5, 2019

Collaborator

So there is still a risk we will have a non-atomic operation? Shouldn't we retry the atomic move again or resign altogether.

This comment has been minimized.

Copy link
@olafurpg

olafurpg Dec 5, 2019

Author Member

Some file systems don’t support atomic moves so the best we can do is fall back to a normal move.

This comment has been minimized.

Copy link
@gabro

gabro Dec 5, 2019

Member

Could there be a more specific exception to catch here?

This comment has been minimized.

Copy link
@olafurpg

olafurpg Dec 6, 2019

Author Member

The docs don't specify what exception will be thrown so I didn't want to be too specific.

@tgodzik
tgodzik approved these changes Dec 5, 2019
Copy link
Collaborator

tgodzik left a comment

LGTM!

@olafurpg

This comment has been minimized.

Copy link
Member Author

olafurpg commented Dec 7, 2019

Ignoring unrelated CI failures.

 X tests.TreeViewLspSuite.no-op 3539ms 
  tests.TestFailedException: failed assertion at /Users/runner/runners/2.162.0/work/metals/metals/tests/unit/src/test/scala/tests/TreeViewLspSuite.scala:499
@olafurpg olafurpg merged commit eec6a2b into scalameta:master Dec 7, 2019
9 of 11 checks passed
9 of 11 checks passed
ubuntu-latest tests
Details
windows-latest tests windows-latest tests
Details
macOS-latest tests macOS-latest tests
Details
Sbt integration
Details
Maven integration
Details
Gradle integration
Details
Mill integration
Details
Pants integration
Details
Slow tests
Details
Scala cross tests
Details
Scalafmt/Scalacheck/Docs
Details
@olafurpg olafurpg deleted the olafurpg:atomic-move branch Dec 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.