Skip to content

Commit 442155f

Browse files
justinhorvitzcopybara-github
authored andcommitted
Automated rollback of commit a0a0d09.
*** Reason for rollback *** b/235458248 *** Original change description *** Create a dedicated graph lookup reason for rewinding and add a wildcard to `createIfAbsentBatch` to match `getBatch`. PiperOrigin-RevId: 453933527 Change-Id: If633aa38c86ebf17ab7d0eac16c03117a66546cb
1 parent 8994250 commit 442155f

9 files changed

Lines changed: 23 additions & 18 deletions

File tree

src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ private boolean maybeHandleRestart(SkyKey key, NodeEntry entry, SkyValue returne
989989
}
990990

991991
Map<SkyKey, ? extends NodeEntry> additionalNodesToRestart =
992-
evaluatorContext.getBatchValues(key, Reason.REWINDING, additionalKeysToRestart);
992+
evaluatorContext.getBatchValues(key, Reason.INVALIDATION, additionalKeysToRestart);
993993

994994
ArrayList<SkyKey> missingNodes = null;
995995
for (SkyKey keyToRestart : additionalKeysToRestart) {

src/main/java/com/google/devtools/build/skyframe/InMemoryGraph.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static InMemoryGraph createEdgeless() {
3939

4040
@Override
4141
Map<SkyKey, ? extends NodeEntry> createIfAbsentBatch(
42-
@Nullable SkyKey requestor, Reason reason, Iterable<? extends SkyKey> keys);
42+
@Nullable SkyKey requestor, Reason reason, Iterable<SkyKey> keys);
4343

4444
@Nullable
4545
@Override

src/main/java/com/google/devtools/build/skyframe/InMemoryGraphImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected InMemoryNodeEntry newNodeEntry(SkyKey key) {
8282

8383
@Override
8484
public Map<SkyKey, NodeEntry> createIfAbsentBatch(
85-
@Nullable SkyKey requestor, Reason reason, Iterable<? extends SkyKey> keys) {
85+
@Nullable SkyKey requestor, Reason reason, Iterable<SkyKey> keys) {
8686
Map<SkyKey, NodeEntry> result = CompactHashMap.createWithExpectedSize(Iterables.size(keys));
8787
for (SkyKey key : keys) {
8888
result.put(key, nodeMap.computeIfAbsent(key, newNodeEntryFunction));

src/main/java/com/google/devtools/build/skyframe/ProcessableGraph.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ public interface ProcessableGraph extends QueryableGraph {
4545
* @param reason the reason the nodes are being requested.
4646
*/
4747
Map<SkyKey, ? extends NodeEntry> createIfAbsentBatch(
48-
@Nullable SkyKey requestor, Reason reason, Iterable<? extends SkyKey> keys)
49-
throws InterruptedException;
48+
@Nullable SkyKey requestor, Reason reason, Iterable<SkyKey> keys) throws InterruptedException;
5049

5150
/**
5251
* Like {@link QueryableGraph#getBatchAsync}, except it creates a new node for each key not

src/main/java/com/google/devtools/build/skyframe/QueryableGraph.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public interface QueryableGraph {
5353
*/
5454
Map<SkyKey, ? extends NodeEntry> getBatch(
5555
@Nullable SkyKey requestor, Reason reason, Iterable<? extends SkyKey> keys)
56-
throws InterruptedException;
56+
throws InterruptedException;
5757

5858
/**
5959
* A version of {@link #getBatch} that returns an {@link InterruptibleSupplier} to possibly
@@ -153,12 +153,6 @@ enum Reason {
153153
/** The node is being looked up merely to see if it is done or not. */
154154
DONE_CHECKING,
155155

156-
/**
157-
* The node is being looked up so that it can be {@linkplain
158-
* ThinNodeEntry.DirtyType#FORCE_REBUILD force rebuilt} by rewinding.
159-
*/
160-
REWINDING,
161-
162156
/**
163157
* The node is being looked up to service {@link WalkableGraph#getValue},
164158
* {@link WalkableGraph#getException}, {@link WalkableGraph#getMissingAndExceptions}, or

src/test/java/com/google/devtools/build/skyframe/DeterministicHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void remove(SkyKey key) {
115115

116116
@Override
117117
public Map<SkyKey, ? extends NodeEntry> createIfAbsentBatch(
118-
@Nullable SkyKey requestor, Reason reason, Iterable<? extends SkyKey> keys)
118+
@Nullable SkyKey requestor, Reason reason, Iterable<SkyKey> keys)
119119
throws InterruptedException {
120120
return makeDeterministic(super.createIfAbsentBatch(requestor, reason, keys));
121121
}

src/test/java/com/google/devtools/build/skyframe/DeterministicInMemoryGraph.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DeterministicInMemoryGraph extends DeterministicHelper.DeterministicProces
3030

3131
@Override
3232
public Map<SkyKey, ? extends NodeEntry> createIfAbsentBatch(
33-
@Nullable SkyKey requestor, Reason reason, Iterable<? extends SkyKey> keys) {
33+
@Nullable SkyKey requestor, Reason reason, Iterable<SkyKey> keys) {
3434
try {
3535
return super.createIfAbsentBatch(requestor, reason, keys);
3636
} catch (InterruptedException e) {

src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.google.common.base.Joiner;
1818
import com.google.common.base.MoreObjects;
1919
import com.google.common.collect.Maps;
20+
import com.google.common.collect.Maps.EntryTransformer;
2021
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
2122
import com.google.devtools.build.lib.util.GroupedList;
2223
import com.google.devtools.build.lib.util.GroupedList.GroupedListHelper;
@@ -54,6 +55,15 @@ public ProcessableGraph transform(ProcessableGraph graph) {
5455

5556
protected final Listener graphListener;
5657

58+
protected final EntryTransformer<SkyKey, ThinNodeEntry, NodeEntry> wrapEntry =
59+
new EntryTransformer<SkyKey, ThinNodeEntry, NodeEntry>() {
60+
@Nullable
61+
@Override
62+
public NotifyingNodeEntry transformEntry(SkyKey key, @Nullable ThinNodeEntry nodeEntry) {
63+
return wrapEntry(key, nodeEntry);
64+
}
65+
};
66+
5767
NotifyingHelper(Listener graphListener) {
5868
this.graphListener = new ErrorRecordingDelegatingListener(graphListener);
5969
}
@@ -86,7 +96,8 @@ static class NotifyingQueryableGraph implements QueryableGraph {
8696
notifyingHelper.graphListener.accept(key, EventType.GET_BATCH, Order.BEFORE, reason);
8797
}
8898
return Maps.transformEntries(
89-
delegate.getBatch(requestor, reason, keys), notifyingHelper::wrapEntry);
99+
delegate.getBatch(requestor, reason, keys),
100+
notifyingHelper.wrapEntry);
90101
}
91102

92103
@Nullable
@@ -118,13 +129,14 @@ public void remove(SkyKey key) {
118129

119130
@Override
120131
public Map<SkyKey, ? extends NodeEntry> createIfAbsentBatch(
121-
@Nullable SkyKey requestor, Reason reason, Iterable<? extends SkyKey> keys)
132+
@Nullable SkyKey requestor, Reason reason, Iterable<SkyKey> keys)
122133
throws InterruptedException {
123134
for (SkyKey key : keys) {
124135
notifyingHelper.graphListener.accept(key, EventType.CREATE_IF_ABSENT, Order.BEFORE, null);
125136
}
126137
return Maps.transformEntries(
127-
delegate.createIfAbsentBatch(requestor, reason, keys), notifyingHelper::wrapEntry);
138+
delegate.createIfAbsentBatch(requestor, reason, keys),
139+
notifyingHelper.wrapEntry);
128140
}
129141

130142
@Override

src/test/java/com/google/devtools/build/skyframe/NotifyingInMemoryGraph.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class NotifyingInMemoryGraph extends NotifyingHelper.NotifyingProcessableGraph
2626

2727
@Override
2828
public Map<SkyKey, ? extends NodeEntry> createIfAbsentBatch(
29-
@Nullable SkyKey requestor, Reason reason, Iterable<? extends SkyKey> keys) {
29+
@Nullable SkyKey requestor, Reason reason, Iterable<SkyKey> keys) {
3030
try {
3131
return super.createIfAbsentBatch(requestor, reason, keys);
3232
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)