aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar laszlocsomor <laszlocsomor@google.com>2018-05-23 07:22:06 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-23 07:23:10 -0700
commit24be509e3a40a0ac661edaf825f6dcd5d9a94d47 (patch)
tree2572a605670ebce2a61346af2f107db96d674a61 /src/main/java
parent17735dd9b0bbde43d73a6539733b02b07bec6abc (diff)
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
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java13
1 files changed, 7 insertions, 6 deletions
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);