Automated rollback of commit 5fb12454ff1edadec4955099fb372134e752a457. *** Reason for rollback *** Breaks execution_phase_tests. See https://buildkite.com/bazel/bazel-bazel/builds/13269 for an example in postsubmit. RELNOTES: None PiperOrigin-RevId: 321109644
diff --git a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java index c38a86d..982afbb 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java +++ b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
@@ -38,7 +38,6 @@ import com.google.devtools.build.lib.syntax.EvalException; import com.google.devtools.build.lib.syntax.Printer; import com.google.devtools.build.lib.syntax.Sequence; -import com.google.devtools.build.lib.vfs.BulkDeleter; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.Root; import com.google.devtools.build.lib.vfs.Symlinks; @@ -351,15 +350,8 @@ * directory recursively removes the contents of the directory. * * @param execRoot the exec root in which this action is executed - * @param bulkDeleter a helper to bulk delete outputs to avoid delegating to the filesystem */ - protected void deleteOutputs(Path execRoot, @Nullable BulkDeleter bulkDeleter) - throws IOException, InterruptedException { - if (bulkDeleter != null) { - bulkDeleter.bulkDelete(Artifact.asPathFragments(getOutputs())); - return; - } - + protected void deleteOutputs(Path execRoot) throws IOException { for (Artifact output : getOutputs()) { deleteOutput(output.getPath(), output.getRoot()); } @@ -457,9 +449,8 @@ } @Override - public void prepare(Path execRoot, @Nullable BulkDeleter bulkDeleter) - throws IOException, InterruptedException { - deleteOutputs(execRoot, bulkDeleter); + public void prepare(Path execRoot) throws IOException { + deleteOutputs(execRoot); } @Override
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Action.java b/src/main/java/com/google/devtools/build/lib/actions/Action.java index 7cee09c..82eb5c1 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/Action.java +++ b/src/main/java/com/google/devtools/build/lib/actions/Action.java
@@ -17,7 +17,6 @@ import com.google.devtools.build.lib.actions.extra.ExtraActionInfo; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.concurrent.ThreadSafety.ConditionallyThreadCompatible; -import com.google.devtools.build.lib.vfs.BulkDeleter; import com.google.devtools.build.lib.vfs.Path; import java.io.IOException; import javax.annotation.Nullable; @@ -83,10 +82,8 @@ * or the permissions should be changed, so that they can be safely overwritten by the action. * * @throws IOException if there is an error deleting the outputs. - * @throws InterruptedException if the execution is interrupted */ - void prepare(Path execRoot, @Nullable BulkDeleter bulkDeleter) - throws IOException, InterruptedException; + void prepare(Path execRoot) throws IOException; /** * Executes this action. This method <i>unconditionally does the work of the Action</i>, although
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java b/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java index 4314764..df0ad4e 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java
@@ -60,7 +60,6 @@ import com.google.devtools.build.lib.util.Fingerprint; import com.google.devtools.build.lib.util.LoggingUtil; import com.google.devtools.build.lib.util.Pair; -import com.google.devtools.build.lib.vfs.BulkDeleter; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; @@ -478,9 +477,8 @@ * the test log base name with arbitrary prefix and extension. */ @Override - protected void deleteOutputs(Path execRoot, @Nullable BulkDeleter bulkDeleter) - throws IOException, InterruptedException { - super.deleteOutputs(execRoot, bulkDeleter); + protected void deleteOutputs(Path execRoot) throws IOException { + super.deleteOutputs(execRoot); // We do not rely on globs, as it causes quadratic behavior in --runs_per_test and test // shard count.
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java b/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java index f9ae52f..49a7837 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java
@@ -164,6 +164,7 @@ return s.getBytes(StandardCharsets.UTF_8); } + @Override public void prepare(Path execRoot) throws IOException { // The default implementation of this method deletes all output files; override it to keep // the old stableStatus around. This way we can reuse the existing file (preserving its mtime)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java index 1966050..46b6a4f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java
@@ -34,7 +34,6 @@ import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; import com.google.devtools.build.lib.util.DetailedExitCode; import com.google.devtools.build.lib.util.Fingerprint; -import com.google.devtools.build.lib.vfs.BulkDeleter; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.Symlinks; import java.io.IOException; @@ -65,12 +64,11 @@ } @Override - public void prepare(Path execRoot, @Nullable BulkDeleter bulkDeleter) - throws IOException, InterruptedException { + public void prepare(Path execRoot) throws IOException { if (includePath.isDirectory(Symlinks.NOFOLLOW)) { includePath.deleteTree(); } - super.prepare(execRoot, bulkDeleter); + super.prepare(execRoot); } @Override
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java index 03029fd..1bfb32f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
@@ -633,7 +633,7 @@ // Fall back to running with the full classpath. This requires first deleting potential // artifacts generated by the reduced action and clearing the metadata caches. try { - deleteOutputs(actionExecutionContext.getExecRoot(), /* bulkDeleter= */ null); + deleteOutputs(actionExecutionContext.getExecRoot()); } catch (IOException e) { throw toActionExecutionException( new EnvironmentalExecException(
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java index 8b127a4..f74cfdd 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java
@@ -430,17 +430,12 @@ workingDir = env.getExecRoot(); try { - testAction.prepare(env.getExecRoot(), /* bulkDeleter= */ null); + testAction.prepare(env.getExecRoot()); } catch (IOException e) { return reportAndCreateFailureResult( env, "Error while setting up test: " + e.getMessage(), Code.TEST_ENVIRONMENT_SETUP_FAILURE); - } catch (InterruptedException e) { - return reportAndCreateFailureResult( - env, - "Error while setting up test: " + e.getMessage(), - Code.TEST_ENVIRONMENT_SETUP_INTERRUPTED); } try {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java index cb0962c..b60c2ed 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
@@ -930,9 +930,7 @@ // This call generally deletes any files at locations that are declared outputs of the // action, although some actions perform additional work, while others intentionally // keep previous outputs in place. - action.prepare( - actionExecutionContext.getExecRoot(), - outputService != null ? outputService.bulkDeleter() : null); + action.prepare(actionExecutionContext.getExecRoot()); } catch (IOException e) { logger.atWarning().withCause(e).log( "failed to delete output files before executing action: '%s'", action);
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/BulkDeleter.java b/src/main/java/com/google/devtools/build/lib/vfs/BulkDeleter.java deleted file mode 100644 index 80b06987..0000000 --- a/src/main/java/com/google/devtools/build/lib/vfs/BulkDeleter.java +++ /dev/null
@@ -1,28 +0,0 @@ -// Copyright 2020 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package com.google.devtools.build.lib.vfs; - -import java.io.IOException; - -/** An interface for deleting outputs in bulk. */ -public interface BulkDeleter { - /** - * Bulk delete outputs. - * - * @param paths the paths to delete, relative to the exec root. - * @throws IOException on unexpected failure. - * @throws InterruptedException on interrupt. - */ - void bulkDelete(Iterable<PathFragment> paths) throws IOException, InterruptedException; -}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/OutputService.java b/src/main/java/com/google/devtools/build/lib/vfs/OutputService.java index cec1927..70dc472 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/OutputService.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/OutputService.java
@@ -208,9 +208,4 @@ throws IOException { throw new IllegalStateException("Path resolver not supported by this class"); } - - @Nullable - default BulkDeleter bulkDeleter() { - return null; - } }
diff --git a/src/main/protobuf/failure_details.proto b/src/main/protobuf/failure_details.proto index f940d18..1c513d4 100644 --- a/src/main/protobuf/failure_details.proto +++ b/src/main/protobuf/failure_details.proto
@@ -864,7 +864,6 @@ SCRIPT_WRITE_FAILURE = 12 [(metadata) = { exit_code: 6 }]; RUNFILES_DIRECTORIES_CREATION_FAILURE = 13 [(metadata) = { exit_code: 36 }]; RUNFILES_SYMLINKS_CREATION_FAILURE = 14 [(metadata) = { exit_code: 36 }]; - TEST_ENVIRONMENT_SETUP_INTERRUPTED = 15 [(metadata) = { exit_code: 8 }]; } Code code = 1;
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkActionTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkActionTest.java index baf695b..99639cc 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkActionTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkActionTest.java
@@ -154,7 +154,7 @@ Path extra = rootDirectory.getRelative("out/extra"); FileSystemUtils.createEmptyFile(extra); assertThat(extra.exists()).isTrue(); - action.prepare(rootDirectory, /*bulkDeleter=*/ null); + action.prepare(rootDirectory); assertThat(extra.exists()).isFalse(); }