Skip to content

Commit

Permalink
Implement handling of diffs which can skip ancestor directories.
Browse files Browse the repository at this point in the history
Implement a new diff checker which deduces affected `FileStateValue` and `DirectoryListingStateValue` keys from diffs which can skip ancestor directories in them. An extreme example of such diff would be one which only lists the leaf files when adding/deleting them (e.g. adding `a/b/c/d/file` where `a` does not currently exist).

Use the new algorithm for diffs marked as potentially missing ancestor directory entries.

The new logic has a very similar performance to the existing one with the difference of:

- adding new file with within new directories -- it does less stats since it deduces the directory from the leaf existence
- deleting a file -- it performs 1 extra stat since it cannot assume that the parent of a deleted file still exists
- unknown entries -- it tries to be lazy about stating those; we would only do that if that can prevent invalidation of a directory listing.

PiperOrigin-RevId: 389301057
  • Loading branch information
alexjski authored and copybara-github committed Aug 7, 2021
1 parent fe6645d commit 15c55d5
Show file tree
Hide file tree
Showing 30 changed files with 1,268 additions and 73 deletions.
9 changes: 8 additions & 1 deletion src/main/java/com/google/devtools/build/lib/skyframe/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1457,10 +1457,14 @@ java_library(

java_library(
name = "filesystem_value_checker",
srcs = ["FilesystemValueChecker.java"],
srcs = [
"FileSystemValueCheckerInferringAncestors.java",
"FilesystemValueChecker.java",
],
deps = [
":action_execution_value",
":action_metadata_handler",
":directory_listing_state_value",
":sky_functions",
":sky_value_dirtiness_checker",
":tree_artifact_value",
Expand All @@ -1469,11 +1473,14 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/concurrent",
"//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/build/lib/util:abrupt_exit_exception",
"//src/main/java/com/google/devtools/build/lib/util:detailed_exit_code",
"//src/main/java/com/google/devtools/build/lib/util/io",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//src/main/protobuf:failure_details_java_proto",
"//third_party:flogger",
"//third_party:guava",
"//third_party:jsr305",
Expand Down
Loading

0 comments on commit 15c55d5

Please sign in to comment.