Skip to content
Snippets Groups Projects
Unverified Commit 33854860 authored by Tiago Quelhas's avatar Tiago Quelhas Committed by GitHub
Browse files

[7.1.0] Ensure that the mtime of an AC entry is smaller, not larger, than the...

[7.1.0] Ensure that the mtime of an AC entry is smaller, not larger, than the CAS blobs it references. (#21416)

https://github.com/bazelbuild/bazel/commit/7a774ff7c5850e7bd57af840a0e097ad4ec25417
got the condition backwards. Note that referential integrity isn't
required for correct operation, but lack of it can slow things down
unnecessarily.

PiperOrigin-RevId: 608354674
Change-Id: If56bb9211a5167d5db9e8eceb6224269758acdb1
parent 61603f2b
No related merge requests found
......@@ -232,6 +232,9 @@ public class DiskCacheClient implements RemoteCacheClient {
}
return Futures.transformAsync(
// Update the mtime on the action result itself before any of the blobs it references.
// This ensures that the blobs are always newer than the action result, so that trimming the
// cache in LRU order cannot create dangling references.
Utils.downloadAsActionResult(actionKey, (digest, out) -> download(digest, out, Store.AC)),
actionResult -> {
if (actionResult == null) {
......@@ -249,11 +252,6 @@ public class DiskCacheClient implements RemoteCacheClient {
return immediateFuture(null);
}
// Update the mtime for the action result itself. This ensures that blobs are older than
// the action result, so that trimming the cache in LRU order will not create dangling
// references.
var unused = refresh(toPath(actionKey.getDigest(), Store.AC));
return immediateFuture(CachedActionResult.disk(actionResult));
},
MoreExecutors.directExecutor());
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment