File tree Expand file tree Collapse file tree
src/main/java/com/google/devtools/build/lib/remote Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ Shreya Bhattarai <shreyax@google.com>
2020Kevin Bierhoff <kmb@google.com>
2121Klaas Boesche <klaasb@google.com>
2222Phil Bordelon <sunfall@google.com>
23+ Mostyn Bramley-Moore <mostyn@antipode.se>
2324Jon Brandvein <brandjon@google.com>
2425Volker Braun <vbraun.name@gmail.com>
2526Thomas Broyer <t.broyer@ltgt.net>
Original file line number Diff line number Diff line change @@ -323,14 +323,33 @@ ListenableFuture<Void> start() {
323323 // level/algorithm, so we cannot know the expected committed offset
324324 long committedSize = committedOffset .get ();
325325 long expected = chunker .getOffset ();
326- if (!chunker .hasNext () && committedSize != expected ) {
326+
327+ if (committedSize == expected ) {
328+ // Both compressed and uncompressed uploads can succeed
329+ // with this result.
330+ return immediateVoidFuture ();
331+ }
332+
333+ if (chunker .isCompressed ()) {
334+ if (committedSize == -1 ) {
335+ // Returned early, blob already available.
336+ return immediateVoidFuture ();
337+ }
338+
327339 String message =
328340 format (
329- "write incomplete: committed_size %d for %d total" ,
341+ "compressed write incomplete: committed_size %d is neither -1 nor total %d " ,
330342 committedSize , expected );
331343 return Futures .immediateFailedFuture (new IOException (message ));
332344 }
345+
346+ // Uncompressed upload failed.
347+ String message =
348+ format (
349+ "write incomplete: committed_size %d for %d total" , committedSize , expected );
350+ return Futures .immediateFailedFuture (new IOException (message ));
333351 }
352+
334353 return immediateVoidFuture ();
335354 },
336355 MoreExecutors .directExecutor ());
You can’t perform that action at this time.
0 commit comments