-
Notifications
You must be signed in to change notification settings - Fork 77
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
Conversation
private final class LazyServerStreamIterator implements Iterator<ReadObjectResponse>, Closeable { | ||
private ServerStream<ReadObjectResponse> serverStream; | ||
private Iterator<ReadObjectResponse> responseIterator; | ||
private final class ReadObjectObserver extends StateCheckingResponseObserver<ReadObjectResponse> { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is loosely modeled on the https://github.com/googleapis/sdk-platform-java/blob/2447513ce8a93632d2ff1878e717f4c914717bb3/gax-java/gax/src/main/java/com/google/api/gax/rpc/QueuingResponseObserver.java that was used previously
c8cf09f
to
6aa1ac1
Compare
…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.
6aa1ac1
to
4f3fd43
Compare
…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.
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.