aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/worker/WorkerKey.java
diff options
context:
space:
mode:
authorGravatar philwo <philwo@google.com>2017-08-16 12:03:08 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-08-17 09:51:54 +0200
commit50c10141c63d6327b7acf565b98420eee3f7fea4 (patch)
tree249a6dd39c326163cd67718b3a3269ba358208f3 /src/main/java/com/google/devtools/build/lib/worker/WorkerKey.java
parent7b233c4604dc08ca4ca90eab59083a472f97a502 (diff)
When a worker can no longer be used, because one or more of its files on disk have changed since it was launched, print *which* files have changed.
RELNOTES: Improved logging when workers have to be restarted due to its files having changed. PiperOrigin-RevId: 165419664
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/worker/WorkerKey.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/worker/WorkerKey.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/worker/WorkerKey.java b/src/main/java/com/google/devtools/build/lib/worker/WorkerKey.java
index 69927d30e1..2939ba364e 100644
--- a/src/main/java/com/google/devtools/build/lib/worker/WorkerKey.java
+++ b/src/main/java/com/google/devtools/build/lib/worker/WorkerKey.java
@@ -23,6 +23,7 @@ import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.SortedMap;
/**
* Data container that uniquely identifies a kind of worker process and is used as the key for the
@@ -35,10 +36,14 @@ final class WorkerKey {
private final String mnemonic;
/**
- * This is used during validation whether a worker is still usable. It is not used to uniquely
- * identify a kind of worker, thus it is not to be used by the .equals() / .hashCode() methods.
+ * These are used during validation whether a worker is still usable. They are not used to
+ * uniquely identify a kind of worker, thus it is not to be used by the .equals() / .hashCode()
+ * methods.
*/
- private final HashCode workerFilesHash;
+ private final HashCode workerFilesCombinedHash;
+
+ private final SortedMap<PathFragment, HashCode> workerFilesWithHashes;
+
private final Map<PathFragment, Path> inputFiles;
private final Set<PathFragment> outputFiles;
private final boolean mustBeSandboxed;
@@ -48,7 +53,8 @@ final class WorkerKey {
Map<String, String> env,
Path execRoot,
String mnemonic,
- HashCode workerFilesHash,
+ HashCode workerFilesCombinedHash,
+ SortedMap<PathFragment, HashCode> workerFilesWithHashes,
Map<PathFragment, Path> inputFiles,
Set<PathFragment> outputFiles,
boolean mustBeSandboxed) {
@@ -56,7 +62,8 @@ final class WorkerKey {
this.env = ImmutableMap.copyOf(Preconditions.checkNotNull(env));
this.execRoot = Preconditions.checkNotNull(execRoot);
this.mnemonic = Preconditions.checkNotNull(mnemonic);
- this.workerFilesHash = Preconditions.checkNotNull(workerFilesHash);
+ this.workerFilesCombinedHash = Preconditions.checkNotNull(workerFilesCombinedHash);
+ this.workerFilesWithHashes = Preconditions.checkNotNull(workerFilesWithHashes);
this.inputFiles = Preconditions.checkNotNull(inputFiles);
this.outputFiles = Preconditions.checkNotNull(outputFiles);
this.mustBeSandboxed = mustBeSandboxed;
@@ -78,8 +85,12 @@ final class WorkerKey {
return mnemonic;
}
- public HashCode getWorkerFilesHash() {
- return workerFilesHash;
+ public HashCode getWorkerFilesCombinedHash() {
+ return workerFilesCombinedHash;
+ }
+
+ public SortedMap<PathFragment, HashCode> getWorkerFilesWithHashes() {
+ return workerFilesWithHashes;
}
public Map<PathFragment, Path> getInputFiles() {