aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2015-09-24 21:12:05 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-09-25 14:40:23 +0000
commitde281a77a68490dba35063d901055ef248138d37 (patch)
tree68bf84f715a94793a622a4dcc19d37f62568cd07 /src/main/java
parent875c7a7b13b77ed65ceab1fe71d6c50e9647e36b (diff)
Prefetch and assert done on direct deps. Also print a more informative error message if a previously known direct dep isn't done.
-- MOS_MIGRATED_REVID=103880990
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java
index a2df93a2ed..c7f8db9f07 100644
--- a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java
+++ b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java
@@ -329,8 +329,17 @@ public final class ParallelEvaluator implements Evaluator {
builder.put(depKey, ValueOrExceptionUtils.ofNull());
continue;
}
- Preconditions.checkState(!directDeps.contains(depKey), "%s %s %s", skyKey, depKey,
- value);
+ if (directDeps.contains(depKey)) {
+ throw new IllegalStateException(
+ "Undone key "
+ + depKey
+ + " was already in deps of "
+ + skyKey
+ + "( dep: "
+ + graph.get(depKey)
+ + ", parent: "
+ + graph.get(skyKey));
+ }
addDep(depKey);
valuesMissing = true;
builder.put(depKey, ValueOrExceptionUtils.ofNull());
@@ -608,6 +617,20 @@ public final class ParallelEvaluator implements Evaluator {
NEEDS_EVALUATION
}
+ // Take advantage of graphs that cache batch requests and prefetch keys that will be needed.
+ private static void batchPrefetchAndAssertDone(
+ Set<SkyKey> keys, QueryableGraph graph, SkyKey keyForDebugging) {
+ Map<SkyKey, NodeEntry> batchMap = graph.getBatch(keys);
+ if (batchMap.size() != keys.size()) {
+ throw new IllegalStateException(
+ "Missing keys for " + keyForDebugging + ": " + Sets.difference(keys, batchMap.keySet()));
+ }
+ for (Map.Entry<SkyKey, NodeEntry> entry : batchMap.entrySet()) {
+ Preconditions.checkState(
+ entry.getValue().isDone(), "%s had not done %s", keyForDebugging, entry);
+ }
+ }
+
/**
* An action that evaluates a value.
*/
@@ -774,6 +797,7 @@ public final class ParallelEvaluator implements Evaluator {
Set<SkyKey> directDeps = state.getTemporaryDirectDeps();
Preconditions.checkState(!directDeps.contains(ErrorTransienceValue.key()),
"%s cannot have a dep on ErrorTransienceValue during building: %s", skyKey, state);
+ batchPrefetchAndAssertDone(directDeps, graph, skyKey);
// Get the corresponding SkyFunction and call it on this value.
SkyFunctionEnvironment env = new SkyFunctionEnvironment(skyKey, directDeps, visitor);
SkyFunctionName functionName = skyKey.functionName();