Skip to content

Commit d00e34a

Browse files
haxorzcopybara-github
authored andcommitted
Add INFO log lines to all call paths to #handleAnalysisInvalidatingChange.
This way we have post-facto debugging information for why we dropped the analysis cache. In particular, this is useful for when the cause is a different build configuration; Blaze already prints a helpful configuration diff to stderr but the user might not have saved that or noticed it (and even comparing the full set of options we already log to INFO is a bit tedious). PiperOrigin-RevId: 544102574 Change-Id: Ia97ea099dea20ec97e38259db609867192fc65ff
1 parent 62afb4b commit d00e34a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.google.common.collect.Sets;
3030
import com.google.common.collect.Streams;
3131
import com.google.common.eventbus.EventBus;
32+
import com.google.common.flogger.GoogleLogger;
3233
import com.google.devtools.build.lib.actions.ActionAnalysisMetadata;
3334
import com.google.devtools.build.lib.actions.ActionKeyContext;
3435
import com.google.devtools.build.lib.actions.ActionLookupKey;
@@ -127,6 +128,8 @@
127128
* <p>Covers enough functionality to work as a substitute for {@code BuildView#configureTargets}.
128129
*/
129130
public final class SkyframeBuildView {
131+
private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();
132+
130133
private final ConfiguredTargetFactory factory;
131134
private final ArtifactFactory artifactFactory;
132135
private final SkyframeExecutor skyframeExecutor;
@@ -282,6 +285,7 @@ public void setConfiguration(
282285
Event.warn(
283286
"--discard_analysis_cache was used in the previous build, "
284287
+ "discarding analysis cache."));
288+
logger.atInfo().log("Discarding analysis cache because the previous invocation told us to");
285289
skyframeExecutor.handleAnalysisInvalidatingChange();
286290
} else {
287291
String diff = describeConfigurationDifference(configuration, maxDifferencesToShow);
@@ -291,6 +295,8 @@ public void setConfiguration(
291295
diff
292296
+ ", discarding analysis cache (this can be expensive, see"
293297
+ " https://bazel.build/advanced/performance/iteration-speed)."));
298+
logger.atInfo().log(
299+
"Discarding analysis cache because the build configuration changed: %s", diff);
294300
// Note that clearing the analysis cache is currently required for correctness. It is also
295301
// helpful to save memory.
296302
//

src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,6 +2574,7 @@ public WorkspaceInfoFromDiff sync(
25742574
syncPackageLoading(pathPackageLocator, commandId, clientEnv, tsgm, executors, options);
25752575

25762576
if (lastAnalysisDiscarded) {
2577+
logger.atInfo().log("Discarding analysis cache because the previous invocation told us to");
25772578
dropConfiguredTargetsNow(eventHandler);
25782579
lastAnalysisDiscarded = false;
25792580
}

0 commit comments

Comments
 (0)