diff --git a/src/main/java/com/google/devtools/build/lib/actions/cache/CompactPersistentActionCache.java b/src/main/java/com/google/devtools/build/lib/actions/cache/CompactPersistentActionCache.java index cb9ae97e453619..54bbe6471cd72f 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/cache/CompactPersistentActionCache.java +++ b/src/main/java/com/google/devtools/build/lib/actions/cache/CompactPersistentActionCache.java @@ -268,20 +268,18 @@ private static CompactPersistentActionCache logAndThrowOrRecurse( if (message != null) { e = new IOException(message, e); } - logger.atWarning().withCause(e).log("Failed to load action cache"); + logger.atWarning().withCause(e).log( + "Failed to load action cache, corrupted files to %s/*.bad", cacheRoot); reporterForInitializationErrors.handle( Event.error( "Error during action cache initialization: " + e.getMessage() - + ". Corrupted files were renamed to '" - + cacheRoot - + "/*.bad'. " - + "Bazel will now reset action cache data, potentially causing rebuilds")); + + ". Data will be reset, potentially causing target rebuilds")); if (alreadyFoundCorruption) { throw e; } return create( - cacheRoot, clock, reporterForInitializationErrors, /*alreadyFoundCorruption=*/ true); + cacheRoot, clock, reporterForInitializationErrors, /* alreadyFoundCorruption= */ true); } /** @@ -310,6 +308,7 @@ private static void renameCorruptedFiles(Path cacheRoot) { } private static final String FAILURE_PREFIX = "Failed action cache referential integrity check: "; + /** Throws IOException if indexer contains no data or integrity check has failed. */ private static void validateIntegrity(int indexerSize, byte[] validationRecord) throws IOException { @@ -546,7 +545,9 @@ private static RemoteFileArtifactValue decodeRemoteMetadata( digest, size, locationIndex, expireAtEpochMilli, materializationExecPath); } - /** @return action data encoded as a byte[] array. */ + /** + * @return action data encoded as a byte[] array. + */ private static byte[] encode(StringIndexer indexer, ActionCache.Entry entry) throws IOException { Preconditions.checkState(!entry.isCorrupted()); diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/CorruptedActionCacheTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/CorruptedActionCacheTest.java index 62dd9c56fb020d..3d4814feb2131d 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/CorruptedActionCacheTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/CorruptedActionCacheTest.java @@ -65,7 +65,6 @@ public void testCorruptionActionCacheErrorMessage() throws Exception { assertThat(buildTarget("//foo:foo").getSuccess()).isTrue(); assertThat(events.errors()).hasSize(1); events.assertContainsError("Error during action cache initialization"); - events.assertContainsError( - "Bazel will now reset action cache data, potentially causing rebuilds"); + events.assertContainsError("Data will be reset, potentially causing target rebuilds"); } }