Skip to content

Commit

Permalink
Tighten invariants around dirtiness checking. We should never need to…
Browse files Browse the repository at this point in the history
… create a child that's being checked by a parent (that was a legacy of when we delegated to enqueueChild), and such a child that is being checked should always be dirty or done, never fresh.

--
PiperOrigin-RevId: 149136909
MOS_MIGRATED_REVID=149136909
  • Loading branch information
janakdr authored and hermione521 committed Mar 6, 2017
1 parent 48e3825 commit a291e9b
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ private DirtyOutcome maybeHandleDirtyNode(NodeEntry state) throws InterruptedExc
// usual, but we can't, because then the ErrorTransienceValue would remain as a dep,
// which would be incorrect if, for instance, the value re-evaluated to a non-error.
state.forceRebuild();
graph.get(
skyKey, Reason.RDEP_REMOVAL, ErrorTransienceValue.KEY).removeReverseDep(skyKey);
graph
.get(skyKey, Reason.RDEP_REMOVAL, ErrorTransienceValue.KEY)
.removeReverseDep(skyKey);
return DirtyOutcome.NEEDS_EVALUATION;
}
if (!evaluatorContext.keepGoing()) {
Expand Down Expand Up @@ -307,14 +308,20 @@ private DirtyOutcome maybeHandleDirtyNode(NodeEntry state) throws InterruptedExc
// always the last dep).
state.addTemporaryDirectDepsGroupToDirtyEntry(directDepsToCheck);

// TODO(bazel-team): If this signals the current node, consider falling through to the
// VERIFIED_CLEAN case below directly, without scheduling a new Evaluate().
for (Map.Entry<SkyKey, ? extends NodeEntry> e :
graph
.createIfAbsentBatch(skyKey, Reason.ENQUEUING_CHILD, directDepsToCheck)
.entrySet()) {
Map<SkyKey, ? extends NodeEntry> oldChildren =
graph.getBatch(skyKey, Reason.ENQUEUING_CHILD, directDepsToCheck);
Preconditions.checkState(
oldChildren.size() == directDepsToCheck.size(),
"Not all old children were present: %s %s %s %s",
skyKey,
state,
directDepsToCheck,
oldChildren);
for (Map.Entry<SkyKey, ? extends NodeEntry> e : oldChildren.entrySet()) {
SkyKey directDep = e.getKey();
NodeEntry directDepEntry = e.getValue();
// TODO(bazel-team): If this signals the current node, consider falling through to the
// VERIFIED_CLEAN case below directly, without scheduling a new Evaluate().
enqueueChild(skyKey, state, directDep, directDepEntry, /*depAlreadyExists=*/ true);
}
return DirtyOutcome.ALREADY_PROCESSED;
Expand Down

0 comments on commit a291e9b

Please sign in to comment.