Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update grpc based ReadObject rpcs to remove race condition between cancellation and message handling #2708

Merged
merged 4 commits into from
Sep 20, 2024

Conversation

BenWhitehead
Copy link
Collaborator

Update GapicUnbufferedReadableByteChannel to manage the grpc stream itself rather than using the stream iterator provided by gax. This allows us to ensure the cancellation is observed and our draining performs before returning from close().

As a side effect of not using the gax stream iterator, we now must handle stream restarts ourselves. GrpcStorageOptions.ReadObjectResumptionStrategy has been removed entirely, while RetryingDependencies and ResultRetryAlgorithm are now plumbed all the way down to the GapicUnbufferedReadableByteChannel.

@BenWhitehead BenWhitehead added the owlbot:ignore instruct owl-bot to ignore a PR label Sep 13, 2024
@BenWhitehead BenWhitehead requested a review from a team as a code owner September 13, 2024 19:03
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: storage Issues related to the googleapis/java-storage API. labels Sep 13, 2024
private final class LazyServerStreamIterator implements Iterator<ReadObjectResponse>, Closeable {
private ServerStream<ReadObjectResponse> serverStream;
private Iterator<ReadObjectResponse> responseIterator;
private final class ReadObjectObserver extends StateCheckingResponseObserver<ReadObjectResponse> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, git thinks this class is a modification of the previous LazyServerStreamIterator except it's a whole new class.

Rather than comparing this class to what was there before, evaluate this class as brand new.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…en cancellation and message handling

Update GapicUnbufferedReadableByteChannel to manage the grpc stream itself rather than using the stream iterator provided by gax. This allows us to ensure the cancellation is observed and our draining performs before returning from close().

As a side effect of not using the gax stream iterator, we now must handle stream restarts ourselves. GrpcStorageOptions.ReadObjectResumptionStrategy has been removed entirely, while RetryingDependencies and ResultRetryAlgorithm are now plumbed all the way down to the GapicUnbufferedReadableByteChannel.
@sydney-munro sydney-munro added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 16, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 16, 2024
@BenWhitehead BenWhitehead merged commit 2c7f088 into main Sep 20, 2024
18 of 20 checks passed
@BenWhitehead BenWhitehead deleted the zc/gapic-removal branch September 20, 2024 15:43
lqiu96 pushed a commit that referenced this pull request Sep 23, 2024
…en cancellation and message handling (#2708)

Update GapicUnbufferedReadableByteChannel to manage the grpc stream itself rather than using the stream iterator provided by gax. This allows us to ensure the cancellation is observed and our draining performs before returning from close().

As a side effect of not using the gax stream iterator, we now must handle stream restarts ourselves. GrpcStorageOptions.ReadObjectResumptionStrategy has been removed entirely, while RetryingDependencies and ResultRetryAlgorithm are now plumbed all the way down to the GapicUnbufferedReadableByteChannel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage API. owlbot:ignore instruct owl-bot to ignore a PR size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants