-
Notifications
You must be signed in to change notification settings - Fork 85
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 timeout to inflight queue waiting #1957
Conversation
prerequisite for multiplexing client
new stream name as a switch of destinationt
also fixed a tiny bug inside fake bigquery write impl for getting thre response from offset
possible the proto schema does not contain this field
@@ -387,6 +406,7 @@ public void close() { | |||
} | |||
|
|||
try { | |||
log.info("Begin shutting down user callback thread pool for stream " + streamName); |
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.
Is this logging accurate? with multiplexing, the identifier shouldn't be streamName. It is not just for this change but in general, seems streamName is not good enough to indicate a connection.
Also seems we should change this log to fine level.
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.
Yes, we need a new kind of identifier besides stream name
let's change them together in the next PR
changed to fine
@@ -397,6 +417,7 @@ public void close() { | |||
+ " is interrupted with exception: " | |||
+ e.toString()); | |||
} | |||
log.info("User close finishes for stream " + streamName); |
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 can remove the line on 395?
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.
Done
@@ -387,6 +406,7 @@ public void close() { | |||
} | |||
|
|||
try { | |||
log.info("Begin shutting down user callback thread pool for stream " + streamName); | |||
threadPool.shutdown(); | |||
threadPool.awaitTermination(3, TimeUnit.MINUTES); |
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.
Log when we actually timed out here?
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.
Done
@@ -61,6 +61,9 @@ | |||
public class ConnectionWorker implements AutoCloseable { | |||
private static final Logger log = Logger.getLogger(StreamWriter.class.getName()); | |||
|
|||
// Maximum wait time on inflight quota before error out. | |||
private static long INFLIGHT_QUOTA_MAX_WAIT_TIME_MILLI = 180000; |
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.
Make the default to 5 minutes?
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.
Done
🤖 I have created a release *beep* *boop* --- ## [2.29.0](https://togithub.com/googleapis/java-bigquerystorage/compare/v2.28.4...v2.29.0) (2023-02-01) ### Features * Add timeout to inflight queue waiting ([#1957](https://togithub.com/googleapis/java-bigquerystorage/issues/1957)) ([3159b12](https://togithub.com/googleapis/java-bigquerystorage/commit/3159b120e5cd388cf9776a1fa928a3e6ae105d9d)) * Allow java client to handle schema change during same stream name ([#1964](https://togithub.com/googleapis/java-bigquerystorage/issues/1964)) ([305f71e](https://togithub.com/googleapis/java-bigquerystorage/commit/305f71ee4b274df58388fc3000e9f5da9fc908e1)) ### Bug Fixes * At connection level, retry for internal errors ([#1965](https://togithub.com/googleapis/java-bigquerystorage/issues/1965)) ([9c01bc1](https://togithub.com/googleapis/java-bigquerystorage/commit/9c01bc11b51dc1e3e209e4d6b666b9ddd3212cf5)) * Reduce visibility of the ConnectionPool and ConnectionWorker, so… ([#1954](https://togithub.com/googleapis/java-bigquerystorage/issues/1954)) ([dcb234b](https://togithub.com/googleapis/java-bigquerystorage/commit/dcb234b95d0812d4d91b0c206d0b7e0fb30ab0fa)) * Remove unrecoverable connection from connection pool during multiplexing ([#1967](https://togithub.com/googleapis/java-bigquerystorage/issues/1967)) ([091dddb](https://togithub.com/googleapis/java-bigquerystorage/commit/091dddb9b2baf1f4b481e8d7961d451b71a8508b)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
If we don't see the exception thrown by timeout on waiting, we then know it's not deadlock on waiting for in flight queue to have space
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> ☕️
If you write sample code, please follow the samples format.