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
feat: Add a flushAll() method that will flush all the inflight request and make sure all responses returned #492
Merged
+151
−35
Conversation
This file contains 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
weizhengli1992
reviewed
Aug 14, 2020
...d-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriter.java
Outdated
Show resolved
Hide resolved
...d-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriter.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #492 +/- ##
============================================
+ Coverage 78.11% 78.67% +0.56%
- Complexity 642 662 +20
============================================
Files 58 59 +1
Lines 3687 3789 +102
Branches 235 255 +20
============================================
+ Hits 2880 2981 +101
- Misses 687 692 +5
+ Partials 120 116 -4
Continue to review full report at Codecov.
|
weizhengli1992
reviewed
Aug 15, 2020
...d-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriter.java
Show resolved
Hide resolved
That's a design detail, a choice of either make flush wait or append wait.
For now, let's keep it simple by asking append wait. In the final
operation, user has to make sure flush is called last.
…On Sat, Aug 15, 2020 at 9:51 AM weizhengli1992 ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriter.java
<#492 (comment)>
:
> @@ -265,6 +273,28 @@ public Boolean expired() {
return outstandingAppend.appendResult;
}
+ /**
+ * This is the general flush method for asynchronise append operation. When you have outstanding
+ * append requests, calling flush will make sure all outstanding append requests completed and
+ * successful. Otherwise there will be an exception thrown.
+ *
+ * @throws Exception
+ */
+ public void flushAll() throws Exception {
+ writeAllOutstanding();
+ synchronized (messagesWaiter) {
I had this discussion with Bigang previously and we decided to keep allow
user to append instead of block. Just wait for all pending stream before
the time user call FlushAll() but keep accepting new requests. (Flush all
will not wait for new requests).
Do you think this make sense to this case as well?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#492 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHGYVETCS7BHII7DNPCA3R3SA24HJANCNFSM4P74BZSQ>
.
--
Thanks.
Yiru
|
weizhengli1992
approved these changes
Aug 17, 2020
stephaniewang526
reviewed
Aug 19, 2020
...gquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriterTest.java
Outdated
Show resolved
Hide resolved
stephaniewang526
requested changes
Aug 19, 2020
...gquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriterTest.java
Outdated
Show resolved
Hide resolved
stephaniewang526
approved these changes
Aug 19, 2020
gcf-merge-on-green bot
pushed a commit
that referenced
this issue
Aug 19, 2020
🤖 I have created a release \*beep\* \*boop\* --- ## [1.5.0](https://www.github.com/googleapis/java-bigquerystorage/compare/v1.4.1...v1.5.0) (2020-08-19) ### Features * Add a flushAll() method that will flush all the inflight request and make sure all responses returned ([#492](https://www.github.com/googleapis/java-bigquerystorage/issues/492)) ([6134818](https://www.github.com/googleapis/java-bigquerystorage/commit/6134818f7bc5ada324a78d5c048bb2eeb83f8ca8)) * add JsonWriterCache.java and added JsonWriterCache in DirectWriter to allow JsonWrites ([#489](https://www.github.com/googleapis/java-bigquerystorage/issues/489)) ([34193b8](https://www.github.com/googleapis/java-bigquerystorage/commit/34193b88bcf64b97dbcde2183e7587fa44923d4b)) ### Dependencies * update dependency com.google.cloud:google-cloud-bigquery to v1.116.10 ([#483](https://www.github.com/googleapis/java-bigquerystorage/issues/483)) ([285b6f8](https://www.github.com/googleapis/java-bigquerystorage/commit/285b6f846753f387800d2787746ddb43de67a4b7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please).
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.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here>☕️