Skip to content

Commit b899783

Browse files
coeuvrecopybara-github
authored andcommitted
Automated rollback of commit 3e464fc.
*** Reason for rollback *** Users might use a HTTP connection to a real remote cache, e.g.bazelbuild#18696 (comment). *** Original change description *** Disable BwoB if using HTTP cache. HTTP cache is generally configured to automatically delete old files. It doesn't support lease extension and doesn't understand the relationships between AC and CAS. Hence, they are incompatible. Fixes bazelbuild#18696. RELNOTES: Build without the Bytes is disabled when using HTTP cache. PiperOrigin-RevId: 671334333 Change-Id: I16e3ab50726b7ff2c81eeabc0670b57b581ce2e2
1 parent 6c31f69 commit b899783

File tree

4 files changed

+2
-65
lines changed

4 files changed

+2
-65
lines changed

src/main/java/com/google/devtools/build/lib/remote/RemoteActionContextProvider.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import static com.google.common.base.Preconditions.checkNotNull;
1717
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
1818

19-
import com.google.common.annotations.VisibleForTesting;
2019
import com.google.common.base.Preconditions;
2120
import com.google.common.util.concurrent.ListeningScheduledExecutorService;
2221
import com.google.devtools.build.lib.exec.ExecutionOptions;
@@ -225,11 +224,6 @@ public void registerSpawnCache(ModuleActionContextRegistry.Builder registryBuild
225224
registryBuilder.register(SpawnCache.class, spawnCache, "remote-cache");
226225
}
227226

228-
@VisibleForTesting
229-
RemoteOutputChecker getRemoteOutputChecker() {
230-
return remoteOutputChecker;
231-
}
232-
233227
/** Returns the remote cache. */
234228
RemoteCache getRemoteCache() {
235229
return remoteCache;

src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,6 @@ public void workspaceInit(
261261
credentialModule = Preconditions.checkNotNull(runtime.getBlazeModule(CredentialModule.class));
262262
}
263263

264-
private static String remoteOutputsModeToFlagName(RemoteOutputsMode remoteOutputsMode) {
265-
String flagName = "";
266-
switch (remoteOutputsMode) {
267-
case MINIMAL -> flagName = "--remote_download_minimal";
268-
case TOPLEVEL -> flagName = "--remote_download_toplevel";
269-
case ALL -> flagName = "--remote_download_all";
270-
}
271-
return flagName;
272-
}
273-
274264
@Override
275265
public void beforeCommand(CommandEnvironment env) throws AbruptExitException {
276266
Preconditions.checkState(actionContextProvider == null, "actionContextProvider must be null");
@@ -366,26 +356,10 @@ public void beforeCommand(CommandEnvironment env) throws AbruptExitException {
366356
.build()));
367357
}
368358

369-
var remoteOutputsMode = remoteOptions.remoteOutputsMode;
370-
if (enableHttpCache && remoteOutputsMode != RemoteOutputsMode.ALL) {
371-
// HTTP cache is generally configured to automatically delete old files. It doesn't support
372-
// lease extension and doesn't understand the relationships between AC and CAS. Hence, it's
373-
// incompatible with other RemoteOutputsMode.
374-
//
375-
// See https://github.com/bazelbuild/bazel/issues/18696.
376-
env.getReporter()
377-
.handle(
378-
Event.warn(
379-
String.format(
380-
"%s is incompatible with HTTP cache. Using --remote_download_all.",
381-
remoteOutputsModeToFlagName(remoteOutputsMode))));
382-
remoteOutputsMode = RemoteOutputsMode.ALL;
383-
}
384-
385359
// TODO(bazel-team): Consider adding a warning or more validation if the remoteDownloadRegex is
386360
// used without Build without the Bytes.
387361
ImmutableList.Builder<Pattern> patternsToDownloadBuilder = ImmutableList.builder();
388-
if (remoteOutputsMode != RemoteOutputsMode.ALL) {
362+
if (remoteOptions.remoteOutputsMode != RemoteOutputsMode.ALL) {
389363
for (RegexPatternOption patternOption : remoteOptions.remoteDownloadRegex) {
390364
patternsToDownloadBuilder.add(patternOption.regexPattern());
391365
}
@@ -395,7 +369,7 @@ public void beforeCommand(CommandEnvironment env) throws AbruptExitException {
395369
new RemoteOutputChecker(
396370
new JavaClock(),
397371
env.getCommandName(),
398-
remoteOutputsMode,
372+
remoteOptions.remoteOutputsMode,
399373
patternsToDownloadBuilder.build(),
400374
lastRemoteOutputChecker);
401375
remoteOutputChecker.maybeInvalidateSkyframeValues(env.getSkyframeExecutor().getEvaluator());

src/main/java/com/google/devtools/build/lib/remote/RemoteOutputChecker.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import static com.google.devtools.build.lib.packages.TargetUtils.isTestRuleName;
1919
import static com.google.devtools.build.lib.skyframe.CoverageReportValue.COVERAGE_REPORT_KEY;
2020

21-
import com.google.common.annotations.VisibleForTesting;
2221
import com.google.common.collect.ImmutableList;
2322
import com.google.common.collect.ImmutableSet;
2423
import com.google.devtools.build.lib.actions.ActionInput;
@@ -90,11 +89,6 @@ public RemoteOutputChecker(
9089
this.lastRemoteOutputChecker = lastRemoteOutputChecker;
9190
}
9291

93-
@VisibleForTesting
94-
RemoteOutputsMode getRemoteOutputsMode() {
95-
return outputsMode;
96-
}
97-
9892
// Skymeld-only.
9993
public void afterTopLevelTargetAnalysis(
10094
ConfiguredTarget configuredTarget,

src/test/java/com/google/devtools/build/lib/remote/RemoteModuleTest.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import com.google.devtools.build.lib.remote.circuitbreaker.FailureCircuitBreaker;
4747
import com.google.devtools.build.lib.remote.downloader.GrpcRemoteDownloader;
4848
import com.google.devtools.build.lib.remote.options.RemoteOptions;
49-
import com.google.devtools.build.lib.remote.options.RemoteOutputsMode;
5049
import com.google.devtools.build.lib.runtime.BlazeRuntime;
5150
import com.google.devtools.build.lib.runtime.BlazeServerStartupOptions;
5251
import com.google.devtools.build.lib.runtime.BlazeWorkspace;
@@ -541,30 +540,6 @@ public void bazelOutputService_noRemoteCache_exit() throws Exception {
541540
}
542541
}
543542

544-
@Test
545-
public void httpCacheWithOutputMinimal_overrideToAll() throws Exception {
546-
remoteOptions.remoteCache = "http://nonexistent.com";
547-
remoteOptions.remoteOutputsMode = RemoteOutputsMode.MINIMAL;
548-
549-
beforeCommand();
550-
551-
assertThat(
552-
remoteModule.getActionContextProvider().getRemoteOutputChecker().getRemoteOutputsMode())
553-
.isEqualTo(RemoteOutputsMode.ALL);
554-
}
555-
556-
@Test
557-
public void httpCacheWithOutputToplevel_overrideToAll() throws Exception {
558-
remoteOptions.remoteCache = "http://nonexistent.com";
559-
remoteOptions.remoteOutputsMode = RemoteOutputsMode.TOPLEVEL;
560-
561-
beforeCommand();
562-
563-
assertThat(
564-
remoteModule.getActionContextProvider().getRemoteOutputChecker().getRemoteOutputsMode())
565-
.isEqualTo(RemoteOutputsMode.ALL);
566-
}
567-
568543
private void beforeCommand() throws IOException, AbruptExitException {
569544
CommandEnvironment env = createTestCommandEnvironment(remoteModule, remoteOptions);
570545
remoteModule.beforeCommand(env);

0 commit comments

Comments
 (0)