Support empty Skyframe-aware subgraphs during rewinding
Some Skyframe-aware actions may have empty rewinding subgraphs.
Rewinding should support this case.
RELNOTES: None.
@@ -333,6 +333,9 @@ public class ActionRewindStrategy {
MutableGraph<SkyKey> rewindGraph, ActionLookupData actionKey, SkyframeAwareAction action) {
ImmutableGraph<SkyKey> graph = action.getSkyframeDependenciesForRewinding(actionKey);
+ if (graph.nodes().isEmpty()) {
+ return ImmutableList.of();
+ }
assertSkyframeAwareRewindingGraph(graph, actionKey);
ImmutableList.Builder<Artifact> newlyVisitedArtifacts = ImmutableList.builder();
@@ -474,6 +477,12 @@ public class ActionRewindStrategy {
"SkyframeAwareAction's rewinding graph allows self loops. graph: %s, actionKey: %s",
graph,
actionKey);
+ Preconditions.checkArgument(
+ graph.nodes().contains(actionKey),
+ "SkyframeAwareAction's rewinding graph does not contain its action root. graph: %s, "
+ + "actionKey: %s",
+ graph,
+ actionKey);
Preconditions.checkArgument(
Iterables.size(Traverser.forGraph(graph).breadthFirst(actionKey)) == graph.nodes().size(),
"SkyframeAwareAction's rewinding graph has nodes unreachable from its action root. "
