)]}'
{
  "commit": "280ef6915b0f507218a073974825d6aa7effddee",
  "tree": "7260f80c142b9cb237636a47a7ce66ce3504a2c3",
  "parents": [
    "74fff5526600e8f8927ac6dda51191feeedee041"
  ],
  "author": {
    "name": "chiwang",
    "email": "chiwang@google.com",
    "time": "Mon May 09 08:20:19 2022 -0700"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Mon May 09 08:21:45 2022 -0700"
  },
  "message": "Remote: Prefetch input files into a temporary path first.\n\nWhen building with build without bytes and dynamic execution, we need prefetch input files for local actions. Sometimes, multiple local actions could share the same input files, so there could be a case where multiple call sites share the same download instance. If the local action is cancelled (due to remote branch wins), the download it requested should also be cancelled only if that download is not shared with other local action (or all the releated local actions are cancelled).\n\nBefore this change, the inputs are written to their final destination directly. This is fine if we can make sure no race or bug in the prefetcher. However, this is not true: https://github.com/bazelbuild/bazel/issues/15010.\n\nThe root cause is, when cancelling the downloads, sometimes, the partially downloaded files on the disk are not deleted.\n\nBy making the prefetcher download input to a temporary path first, we can:\n  1. Mitigate the race: only the final move step will potentially cause the race condition.\n  2. Provide a way to observe the race: if these is no race, all temporary files should be either moved or deleted. But when running with this change, many temporary files exist.\n\nWorking towards https://github.com/bazelbuild/bazel/issues/12454.\n\nPiperOrigin-RevId: 447473693\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c0d2981eca3d4a7ea4139a405c30041abed205c7",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/remote/AbstractActionInputPrefetcher.java",
      "new_id": "836022b18681fef95d3839ae0a981f471e20cc51",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/remote/AbstractActionInputPrefetcher.java"
    },
    {
      "type": "modify",
      "old_id": "ff40c8bda114d2f84c8ad5a591672e318730193b",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/remote/RemoteActionInputFetcher.java",
      "new_id": "eb8d255039105f6964c18d83c85d0511c4850730",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/remote/RemoteActionInputFetcher.java"
    },
    {
      "type": "modify",
      "old_id": "55c6ba1761cc89395ea3122907493d87945d6a6d",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java",
      "new_id": "afe2666401d41b8df1e3c7240d71f57cacce4306",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "321d686248044f3aba924f3872d606884b0e35b9",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/remote/util/TempPathGenerator.java"
    },
    {
      "type": "modify",
      "old_id": "970b7c2d2e0c34410626adec0ec2bbbb9b01922f",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/remote/RemoteActionInputFetcherTest.java",
      "new_id": "1d0d3dfcf1fe2671bb20b360dea6ca721cbab6db",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/remote/RemoteActionInputFetcherTest.java"
    }
  ]
}
