-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Teach the FilesystemValueChecker about remote outputs #7269
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
import com.google.common.util.concurrent.ThreadFactoryBuilder; | ||
import com.google.devtools.build.lib.actions.Artifact; | ||
import com.google.devtools.build.lib.actions.ArtifactFileMetadata; | ||
import com.google.devtools.build.lib.actions.FileArtifactValue; | ||
import com.google.devtools.build.lib.concurrent.ExecutorUtil; | ||
import com.google.devtools.build.lib.concurrent.Sharder; | ||
import com.google.devtools.build.lib.concurrent.ThrowableRecordingRunnableWrapper; | ||
|
@@ -80,6 +81,7 @@ public class FilesystemValueChecker { | |
private static final Predicate<SkyKey> ACTION_FILTER = | ||
SkyFunctionName.functionIs(SkyFunctions.ACTION_EXECUTION); | ||
|
||
@Nullable | ||
private final TimestampGranularityMonitor tsgm; | ||
@Nullable | ||
private final Range<Long> lastExecutionTimeRange; | ||
|
@@ -398,6 +400,9 @@ private boolean treeArtifactIsDirty(Artifact artifact, TreeArtifactValue value) | |
try { | ||
Set<PathFragment> currentDirectoryValue = | ||
TreeArtifactValue.explodeDirectory(artifact.getPath()); | ||
if (currentDirectoryValue.isEmpty() && value.isRemote()) { | ||
return false; | ||
} | ||
Set<PathFragment> valuePaths = value.getChildPaths(); | ||
return !currentDirectoryValue.equals(valuePaths); | ||
} catch (IOException e) { | ||
|
@@ -417,6 +422,14 @@ private boolean actionValueIsDirtyWithDirectSystemCalls(ActionExecutionValue act | |
try { | ||
ArtifactFileMetadata fileMetadata = | ||
ActionMetadataHandler.fileMetadataFromArtifact(file, null, tsgm); | ||
FileArtifactValue fileValue = actionValue.getArtifactValue(file); | ||
boolean lastSeenRemotely = fileValue != null && fileValue.isRemote(); | ||
if (!fileMetadata.exists() && lastSeenRemotely) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the expected semantics when:
Is Bazel expected to notice the deletion in that case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It wouldn't notice it as an
|
||
// The output file does not exist in the output tree, but the last time we created it | ||
// it was stored remotely so there is no need to invalidate it. | ||
continue; | ||
} | ||
|
||
if (!fileMetadata.equals(lastKnownData)) { | ||
updateIntraBuildModifiedCounter( | ||
fileMetadata.exists() ? file.getPath().getLastModifiedTime(Symlinks.FOLLOW) : -1, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is
fileValue
null here? Is my understanding correct that this is for cases when we don't actually need to callstat()
to get the metadata of the output of an action?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. IIRC
fileValue
here is none null only for injected metadata.