-
Notifications
You must be signed in to change notification settings - Fork 237
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 write inconsistency in the gRPC implementation #990
base: master
Are you sure you want to change the base?
Conversation
/gcbrun |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #990 +/- ##
============================================
+ Coverage 76.73% 82.44% +5.71%
- Complexity 1640 1796 +156
============================================
Files 101 102 +1
Lines 7935 8027 +92
Branches 990 996 +6
============================================
+ Hits 6089 6618 +529
+ Misses 1409 1009 -400
+ Partials 437 400 -37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
: false; | ||
} | ||
|
||
public WriteObjectResponse closeStream() throws IOException { |
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.
Do we want this class to implement closeable java interface?
protected static final ImmutableSet<Code> TRANSIENT_ERRORS = | ||
ImmutableSet.of( | ||
Status.Code.DEADLINE_EXCEEDED, | ||
Status.Code.INTERNAL, |
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.
should we really retry in this case?
|
||
// Wait for streaming RPC to become ready for upload. | ||
// wait for 1 min for the channel to be ready. Else bail out | ||
if (!responseObserver.ready.await(60 * 1000, MILLISECONDS)) { |
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.
why one minute? Should we make this configurable.
channelOptions.getGrpcWriteMessageTimeout())); | ||
|
||
} catch (IOException e) { | ||
throw e; |
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.
why even catching?
} | ||
} | ||
|
||
public void writeChunk(WriteObjectRequest request) throws IOException { |
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.
why this need to be public?
if (TRANSIENT_ERRORS.contains(statusCode)) { | ||
transientError = t; | ||
} | ||
if (transientError == null) { |
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.
why not have else?
} | ||
|
||
public boolean isComplete() { | ||
return done.getCount() == 0 ? true : false; |
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.
just return?
} | ||
|
||
public boolean isReady() { | ||
return ready.getCount() == 0 ? true : false; |
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.
same here
} | ||
|
||
public boolean isComplete() { | ||
return done.getCount() < 1 ? true : false; |
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.
just return?
|
||
@Before | ||
public void setUp() throws Exception { | ||
MockitoAnnotations.initMocks(this); |
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.
We avoid using mocks in connector. Do we really need to use mocks?
Refactored gRPC write channel. Major changes
GoogleCloudStorageContentWriteStream
which manages a single writeObject stream.GoogleCloudStorageContentWriteStreamTest
to support more usecases likeGoogleCloudStorageContentWriteStream
to test the various behaviour of resumable writeObject stream.