Repository navigation
Conversation
When S3 returns n > 0 bytes alongside an error, the previous code discarded those bytes while still advancing offsetReached by n. On retry, the new S3 request started from the advanced offset, skipping the discarded bytes and delivering a mix of data from two different stream positions into the same caller buffer. This caused block checksum mismatches in Greenplum AOCO tables stored in Yezzey/S3: the block header and its data came from non-contiguous stream positions. Fix: when n > 0 and err != nil, return the n bytes to the caller immediately and defer the reconnect to the next Read call via needReacquire=true. This follows the io.Reader contract: if bytes were read, they must be returned even when an error also occurred.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When S3 returns n > 0 bytes alongside an error, the previous code discarded those bytes while still advancing offsetReached by n. On retry, the new S3 request started from the advanced offset, skipping the discarded bytes and delivering a mix of data from two different stream positions into the same caller buffer.
This caused block checksum mismatches in Greenplum AOCO tables stored in Yezzey/S3: the block header and its data came from non-contiguous stream positions.
Fix: when n > 0 and err != nil, return the n bytes to the caller immediately and defer the reconnect to the next Read call via needReacquire=true. This follows the io.Reader contract: if bytes were read, they must be returned even when an error also occurred.