From 3e3b71ae038bc9ac90456f93697c640ab9ed8a55 Mon Sep 17 00:00:00 2001 From: Jakob Buchgraber Date: Tue, 15 May 2018 18:37:16 +0200 Subject: [PATCH] remote/exec: always mark files executable. The main motivation for this change is to act as a workaround for #4751. Additionally, this reduces the number of stat() system calls significantly e.g. by 50% when building Bazel (600K vs 1.2M). --- .../build/lib/remote/TreeNodeRepository.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/remote/TreeNodeRepository.java b/src/main/java/com/google/devtools/build/lib/remote/TreeNodeRepository.java index 5012cb74d5a5ee..4aa38ed4ad58ee 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/TreeNodeRepository.java +++ b/src/main/java/com/google/devtools/build/lib/remote/TreeNodeRepository.java @@ -362,23 +362,21 @@ private synchronized Directory getOrComputeDirectory(TreeNode node) throws IOExc TreeNode child = entry.getChild(); if (child.isLeaf()) { ActionInput input = child.getActionInput(); + final Digest digest; if (input instanceof VirtualActionInput) { VirtualActionInput virtualInput = (VirtualActionInput) input; - Digest digest = digestUtil.compute(virtualInput); + digest = digestUtil.compute(virtualInput); virtualInputDigestCache.put(virtualInput, digest); // There may be multiple inputs with the same digest. In that case, we don't care which // one we get back from the digestVirtualInputCache later. digestVirtualInputCache.put(digest, virtualInput); - b.addFilesBuilder() - .setName(entry.getSegment()) - .setDigest(digest) - .setIsExecutable(false); } else { - b.addFilesBuilder() - .setName(entry.getSegment()) - .setDigest(DigestUtil.getFromInputCache(input, inputFileCache)) - .setIsExecutable(execRoot.getRelative(input.getExecPathString()).isExecutable()); + digest = DigestUtil.getFromInputCache(input, inputFileCache); } + b.addFilesBuilder() + .setName(entry.getSegment()) + .setDigest(digest) + .setIsExecutable(true); } else { Digest childDigest = Preconditions.checkNotNull(treeNodeDigestCache.get(child)); if (child.getActionInput() != null) {