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

[Remote Cache] Don't delete tree artifacts on failure #6851

Closed
wants to merge 3 commits into from

Conversation

keith
Copy link
Member

@keith keith commented Dec 5, 2018

Previously if a remote cache request failed, bazel would cleanup all
directories that were marked as outputs for the action. These
directories wouldn't end up being re-created by bazel, and could lead to
failures if the actions didn't create the directories themselves. With
this patch bazel deletes all output files, and the child directories of
all output directories.

Fixes #6260

Previously if a remote cache request failed, bazel would cleanup all
directories that were marked as outputs for the action. These
directories wouldn't end up being re-created by bazel, and could lead to
failures if the actions didn't create the directories themselves. With
this patch bazel deletes all output files, and the child directories of
all output directories.
FileSystemUtils.deleteTree(execRoot.getRelative(directory.getPath()));
// Only delete the directories below the output directories because the output
// directories will not be re-created
FileSystemUtils.deleteTreesBelow(execRoot.getRelative(directory.getPath()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just had a thought, this method's name and documentation implies that it deletes only the subdirectories inside the given directory, but there may also be regular files rooted at this directory. @buchgr can you confirm that it deletes the files as well? I traced through the code, but wasn't sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there ever be regular files that weren't part of the output? The output ones are deleted above, but otherwise I can stop using this helper and directly loop over the children of this directory

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option would be to leave the original line, and call createDirectoryAndParents afterwards

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let @buchgr decide what's best.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line looks good to me. It deletes everything in a directory, including files symlinks and subdirectories. I agree that the naming could be improved.

@sergiocampama
Copy link
Contributor

@buchgr could this be prioritized? we're seeing errors that look similar to the original issue in https://buildkite.com/bazel/rules-apple-darwin/builds/237#049b31a0-3f26-4a84-abe0-971b3bccfe84

@buchgr
Copy link
Contributor

buchgr commented Dec 9, 2018

@keith Thanks a lot for the PR! I assume you test that this change fixes your issue? :-)

@keith
Copy link
Member Author

keith commented Dec 9, 2018

Thanks! Yes it does!

@buchgr
Copy link
Contributor

buchgr commented Dec 9, 2018

importing it. should be in master by tomorrow (need someone to lgtm internally).

@keith
Copy link
Member Author

keith commented Dec 9, 2018 via email

@bazel-io bazel-io closed this in 4392ba4 Dec 10, 2018
@keith keith deleted the ks/delete-below branch December 10, 2018 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants