From 5d0e5a7ba415b981390bf9579da644e1065b2a36 Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 6 Oct 2022 14:39:42 -0700 Subject: [PATCH] Reinstate previous behavior of notifying the graph listener of `GET_BATCH` for every `DEP_REQUESTED` call. Recent optimizations in https://github.com/bazelbuild/bazel/commit/62d1b0b2b6c9646855698b5d7f9515521bc37a45 and https://github.com/bazelbuild/bazel/commit/243c2b78f634097d8f68d1317070e920cd4b891d mean that deps can now be requested via `get()` instead of `getBatch()`. It is possible that existing regression tests are no longer WAI because they are not getting the `GET_BATCH` event (i.e. they are passing but not testing what they intend to). Restoring the previous behavior is much easier than hunting down every test that is affected. PiperOrigin-RevId: 479416036 Change-Id: Iea3ac0a2ad02313dc8e61084fa5f585763a5967f --- .../com/google/devtools/build/skyframe/NotifyingHelper.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java b/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java index f25d614455793c..da61f28fbd5703 100644 --- a/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java +++ b/src/test/java/com/google/devtools/build/skyframe/NotifyingHelper.java @@ -80,6 +80,12 @@ static class NotifyingProcessableGraph implements ProcessableGraph { @Override public NodeEntry get(@Nullable SkyKey requestor, Reason reason, SkyKey key) throws InterruptedException { + // Maintains behavior for tests written when all DEP_REQUESTED calls were made as batch + // requests. Now there are optimizations in SkyFunctionEnvironment for looking up deps + // individually, but older tests may be written to listen for a GET_BATCH event. + if (reason == Reason.DEP_REQUESTED) { + notifyingHelper.graphListener.accept(key, EventType.GET_BATCH, Order.BEFORE, reason); + } return notifyingHelper.wrapEntry(key, delegate.get(requestor, reason, key)); }