Skip to content

Commit 3af7a7b

Browse files
Fix retry offset calculation to use getRetryOffset() method
The critical bug was using getTotalEncodedBytesProcessed() for retry offset, which includes pending bytes. This caused gaps in the byte stream when combining pending + new data. The existing getRetryOffset() method correctly subtracts pending bytes to get the actual file position where new data should start, ensuring continuous byte streams across retries. Co-authored-by: gunjansingh-msft <[email protected]>
1 parent 12fe68d commit 3af7a7b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,10 +1407,9 @@ Mono<BlobDownloadAsyncResponse> downloadStreamWithResponse(BlobRange range, Down
14071407
if (decoderStateObj instanceof StorageContentValidationDecoderPolicy.DecoderState) {
14081408
DecoderState decoderState = (DecoderState) decoderStateObj;
14091409

1410-
// Use totalEncodedBytesProcessed to request NEW bytes from the server
1411-
// The pending buffer already contains bytes we've received, so we request
1412-
// starting from the next byte after what we've already received
1413-
long encodedOffset = decoderState.getTotalEncodedBytesProcessed();
1410+
// Use getRetryOffset() to get the correct offset for retry
1411+
// This accounts for pending bytes that have been received but not yet consumed
1412+
long encodedOffset = decoderState.getRetryOffset();
14141413
long remainingCount = finalCount - encodedOffset;
14151414
retryRange = new BlobRange(initialOffset + encodedOffset, remainingCount);
14161415

0 commit comments

Comments
 (0)