From ffdcffbfef1cab6544c1c599c283d5fa6c7a4aa4 Mon Sep 17 00:00:00 2001 From: Mostyn Bramley-Moore Date: Sat, 19 Feb 2022 13:54:01 +0100 Subject: [PATCH] Remote: handle early return of compressed blobs uploads This is an implementation of this REAPI spec update: https://github.com/bazelbuild/remote-apis/pull/213 Here's a bazel-remote build that can be used to test this change: https://github.com/buchgr/bazel-remote/pull/527 Fixes #14654 --- CONTRIBUTORS | 1 + .../google/devtools/build/lib/remote/ByteStreamUploader.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a95cecd8def926..6936c814fe7bd0 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -20,6 +20,7 @@ Shreya Bhattarai Kevin Bierhoff Klaas Boesche Phil Bordelon +Mostyn Bramley-Moore Jon Brandvein Volker Braun Thomas Broyer diff --git a/src/main/java/com/google/devtools/build/lib/remote/ByteStreamUploader.java b/src/main/java/com/google/devtools/build/lib/remote/ByteStreamUploader.java index a6a7c782bf16bb..a6d9458392587a 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/ByteStreamUploader.java +++ b/src/main/java/com/google/devtools/build/lib/remote/ByteStreamUploader.java @@ -323,7 +323,7 @@ ListenableFuture start() { // level/algorithm, so we cannot know the expected committed offset long committedSize = committedOffset.get(); long expected = chunker.getOffset(); - if (!chunker.hasNext() && committedSize != expected) { + if (!chunker.hasNext() && committedSize != expected || (chunker.isCompressed() && committedSize == -1)) { String message = format( "write incomplete: committed_size %d for %d total",