Skip to content

Commit

Permalink
Only request grpc write when not complete
Browse files Browse the repository at this point in the history
If a queryWriteStatus yields a committedSize which leaves no content
remaining to be uploaded, immediately succeed a blob upload. This can
easily occur if a competing blob write completes asynchronously between
abnormal write termination and a query.
  • Loading branch information
George Gensure committed Nov 21, 2019
1 parent b3f54f6 commit 18e2d0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,13 @@ ListenableFuture<Void> start() {
AtomicLong committedOffset = new AtomicLong(0);
return Futures.transformAsync(
retrier.executeAsync(
() -> ctx.call(() -> callAndQueryOnFailure(committedOffset, progressiveBackoff)),
() -> {
if (committedOffset.get() < chunker.getSize()) {
return ctx.call(() -> callAndQueryOnFailure(committedOffset, progressiveBackoff));
} else {
return Futures.immediateFuture(null);
}
}
progressiveBackoff),
(result) -> {
long committedSize = committedOffset.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public Chunk next() throws IOException {
return new Chunk(blob, offsetBefore);
}

private long bytesLeft() {
public long bytesLeft() {
return getSize() - getOffset();
}

Expand Down

0 comments on commit 18e2d0c

Please sign in to comment.