From 24be509e3a40a0ac661edaf825f6dcd5d9a94d47 Mon Sep 17 00:00:00 2001 From: laszlocsomor Date: Wed, 23 May 2018 07:22:06 -0700 Subject: Automated rollback of commit 724bdbfa47576c67eeec5c74d594203fe05188c7. *** Reason for rollback *** Change introduced flakiness in //src/test/java/com/google/devtools/build/lib:actions_test Verified the culprit commit using: bazel test //src/test/java/com/google/devtools/build/lib:actions_test --runs_per_test=100 --notest_keep_going -t- See https://github.com/bazelbuild/bazel/issues/5242. *** Original change description *** Relax the threshold for calling getDigestInExclusiveMode(). If the policy goal is to minimize disk seeks, this should be equally good. RELNOTES: None. PiperOrigin-RevId: 197720793 --- .../devtools/build/lib/actions/cache/DigestUtils.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/google') diff --git a/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java b/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java index 32dbbcea2b..d16d1bae89 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java +++ b/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java @@ -237,12 +237,13 @@ public class DigestUtils { // All right, we have neither a fast nor a cached digest. Let's go through the costly process of // computing it from the file contents. - if (fileSize > 128 * 1024 && !MULTI_THREADED_DIGEST.get()) { - // We'll have to read file content in order to calculate the digest. - // We avoid overlapping this process for multiple large files, as - // seeking back and forth between them will result in an overall loss of - // throughput. Files shorter than the default readahead window of 128KB - // on Linux are assumed to be readable in one seek. + if (fileSize > 4096 && !MULTI_THREADED_DIGEST.get()) { + // We'll have to read file content in order to calculate the digest. In that case + // it would be beneficial to serialize those calculations since there is a high + // probability that MD5 will be requested for multiple output files simultaneously. + // Exception is made for small (<=4K) files since they will not likely to introduce + // significant delays (at worst they will result in two extra disk seeks by + // interrupting other reads). digest = getDigestInExclusiveMode(path); } else { digest = getDigestInternal(path); -- cgit v1.2.3