-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add Bazel support for --rewind_lost_inputs
#25477
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
Closed
fmeum
wants to merge
6
commits into
bazelbuild:master
from
fmeum:action-rewinding-simple-concurrency
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
88d3582
Run Bazel's `RewindingTest` with remote execution
fmeum ec726d1
Support action rewinding in Bazel
fmeum 28ba587
Address comment by moving classes around
fmeum 18bba2e
Replace custom ReentrantReadWriteLock with StampedLock
fmeum 4533b36
Add comments
fmeum 6eaed0f
Rebase
fmeum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/com/google/devtools/build/lib/remote/ConcurrentArtifactPathTrie.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package com.google.devtools.build.lib.remote; | ||
|
|
||
| import com.google.common.base.Preconditions; | ||
| import com.google.devtools.build.lib.actions.ActionInput; | ||
| import com.google.devtools.build.lib.actions.Artifact; | ||
| import com.google.devtools.build.lib.vfs.PathFragment; | ||
| import java.util.concurrent.ConcurrentSkipListSet; | ||
|
|
||
| /** | ||
| * A specialized concurrent trie that stores paths of artifacts and allows checking whether a given | ||
| * path is contained in (in the case of a tree artifact) or exactly matches (in any other case) an | ||
| * artifact in the trie. | ||
| */ | ||
| final class ConcurrentArtifactPathTrie { | ||
| // Invariant: no path in this set is a prefix of another path. | ||
| private final ConcurrentSkipListSet<PathFragment> paths = | ||
| new ConcurrentSkipListSet<>(PathFragment.HIERARCHICAL_COMPARATOR); | ||
|
|
||
| /** | ||
| * Adds the given {@link ActionInput} to the trie. | ||
| * | ||
| * <p>The caller must ensure that no object's path passed to this method is a prefix of any | ||
| * previously added object's path. Bazel enforces this for non-aggregate artifacts. Callers must | ||
| * not pass in {@link Artifact.TreeFileArtifact}s (which have exec paths that have their parent | ||
| * tree artifact's exec path as a prefix) or non-Artifact {@link ActionInput}s that violate this | ||
| * invariant. | ||
| */ | ||
| void add(ActionInput input) { | ||
| Preconditions.checkArgument( | ||
| !(input instanceof Artifact.TreeFileArtifact), | ||
| "TreeFileArtifacts should not be added to the trie: %s", | ||
| input); | ||
| paths.add(input.getExecPath()); | ||
| } | ||
|
|
||
| /** Checks whether the given {@link PathFragment} is contained in an artifact in the trie. */ | ||
| boolean contains(PathFragment execPath) { | ||
| // By the invariant of this set, there is at most one prefix of execPath in the set. Since the | ||
| // comparator sorts all children of a path right after the path itself, if such a prefix | ||
| // exists, it must thus sort right before execPath (or be equal to it). | ||
| var floorPath = paths.floor(execPath); | ||
| return floorPath != null && execPath.startsWith(floorPath); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.