Add a bit of logging for what was invalidated when modified output files are detected. Adding finer-grained logging is difficult because of the concurrent nature of the batch stat job. Hopefully this will be enough, if not something trickier will have to be done.
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
+
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
@@ -21,6 +22,7 @@ import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
+import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Range;
import com.google.common.collect.Sets;
@@ -255,7 +257,13 @@ public class FilesystemValueChecker {
interrupted = ExecutorUtil.interruptibleShutdown(executor);
}
Throwables.propagateIfPossible(wrapper.getFirstThrownError());
- logger.atInfo().log("Completed output file stat checks");
+ if (dirtyKeys.isEmpty()) {
+ logger.atInfo().log("Completed output file stat checks, no modified outputs found");
+ } else {
+ logger.atInfo().log(
+ "Completed output file stat checks, %d actions' outputs changed, first few: %s",
+ dirtyKeys.size(), Iterables.limit(dirtyKeys, 10));
+ }
if (interrupted) {
throw new InterruptedException();
}
@@ -263,15 +271,13 @@ public class FilesystemValueChecker {
}
private Runnable batchStatJob(
- final Collection<SkyKey> dirtyKeys,
- final List<Pair<SkyKey, ActionExecutionValue>> shard,
- final BatchStat batchStatter,
- final ImmutableSet<PathFragment> knownModifiedOutputFiles,
- final Supplier<NavigableSet<PathFragment>> sortedKnownModifiedOutputFiles,
+ Collection<SkyKey> dirtyKeys,
+ List<Pair<SkyKey, ActionExecutionValue>> shard,
+ BatchStat batchStatter,
+ ImmutableSet<PathFragment> knownModifiedOutputFiles,
+ Supplier<NavigableSet<PathFragment>> sortedKnownModifiedOutputFiles,
boolean trustRemoteArtifacts) {
- return new Runnable() {
- @Override
- public void run() {
+ return () -> {
Map<Artifact, Pair<SkyKey, ActionExecutionValue>> fileToKeyAndValue = new HashMap<>();
Map<Artifact, Pair<SkyKey, ActionExecutionValue>> treeArtifactsToKeyAndValue =
new HashMap<>();
@@ -332,6 +338,7 @@ public class FilesystemValueChecker {
.run();
return;
} catch (InterruptedException e) {
+ logger.atInfo().log("Interrupted doing batch stat");
// We handle interrupt in the main thread.
return;
}
@@ -357,6 +364,8 @@ public class FilesystemValueChecker {
dirtyKeys.add(key);
}
} catch (IOException e) {
+ logger.atWarning().withCause(e).log(
+ "Error for %s (%s %s %s)", artifact, stat, keyAndValue, lastKnownData);
// This is an unexpected failure getting a digest or symlink target.
modifiedOutputFilesCounter.getAndIncrement();
dirtyKeys.add(key);
@@ -376,6 +385,7 @@ public class FilesystemValueChecker {
try {
updateIntraBuildModifiedCounter(path.exists() ? path.getLastModifiedTime() : -1);
} catch (IOException e) {
+ logger.atWarning().withCause(e).log("Error for %s", entry);
// Do nothing here.
}
@@ -383,7 +393,6 @@ public class FilesystemValueChecker {
dirtyKeys.add(entry.getValue().getFirst());
}
}
- }
};
}
