-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[6.0.0] Only inject metadata for outputs that cannot be reconstructed…
… by skyf… (#16879) * Update RemoteActionFileSystem to apply permission changes to local files even if remote file exists. Previously, it only applies permission changes to local files when the remote one doesn't exist. It is fine because the call sites only use these method when remote file are missing. However, this isn't true with future changes. PiperOrigin-RevId: 490872822 Change-Id: I7a19d99cd828294cbafa7b5f3fdc368d64e556ec * Fix permission operations for the case of only remote directory. PiperOrigin-RevId: 491280334 Change-Id: I30afef9f069eca8aee4d983664f42b3961e95adf * Only inject metadata for outputs that cannot be reconstructed by skyframe later Currently, they are symlinks. For other outputs, let skyframe read action file system to construct the metadata. Before this change, we inject metadata of symlink outputs, tree outputs and file outputs inside `RemoteActionFileSystem#flush()` if these outputs are stored inside the in-memory fs. If the outputs are somehow generated in the local fs, skyframe will read the fs later to construct metadata for them. However, for tree outputs, skyframe always create an empty directory before action execution in the in-memory fs. So inside the `flush`, we always inject metadata for it. It means local tree outputs are ignored. We could update the code to also read local file system when reading tree files, but then the problem is how to construct metadata from file status which is well done by skyframe. So instead of injecting metadata by traversal the filesystem inside `flush`, we just let skyframe to do the job. Fixes #16789. Closes #16812. PiperOrigin-RevId: 491622005 Change-Id: I10434e6856a1b2a207f39e07122a9b646edf518c Co-authored-by: kshyanashree <109167932+kshyanashree@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
640 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/google/devtools/build/lib/actions/RemoteFileStatus.java
This file contains 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,28 @@ | ||
// Copyright 2022 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package com.google.devtools.build.lib.actions; | ||
|
||
import com.google.devtools.build.lib.actions.FileArtifactValue.RemoteFileArtifactValue; | ||
import com.google.devtools.build.lib.vfs.FileStatusWithDigest; | ||
|
||
/** | ||
* A FileStatus that exists remotely and provides remote metadata. | ||
* | ||
* <p>Filesystem may return implementation of this interface if the files are stored remotely. When | ||
* checking outputs of actions, Skyframe will inject the metadata returned by {@link | ||
* #getRemoteMetadata()} if the output file has {@link RemoteFileStatus}. | ||
*/ | ||
public interface RemoteFileStatus extends FileStatusWithDigest { | ||
RemoteFileArtifactValue getRemoteMetadata(); | ||
} |
This file contains 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 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 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.