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

feat: wire connection pool to stream writer without implementing updated schema #1790

Merged
merged 21 commits into from Sep 21, 2022
Merged

Conversation

GaoleMeng
Copy link
Contributor

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:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

If you write sample code, please follow the samples format.

GaoleMeng and others added 20 commits September 13, 2022 01:58
also fixed a tiny bug inside fake bigquery write impl for getting thre
response from offset
@GaoleMeng GaoleMeng requested review from a team and alvarowolfx September 20, 2022 21:45
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. labels Sep 20, 2022
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Sep 20, 2022
return StreamWriter.newBuilder(TEST_STREAM, client)
.setWriterSchema(createProtoSchema())
.setTraceId(TEST_TRACE_ID)
.setConnectionMode(connectionMode)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's call it enableConnectionPool.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -703,6 +710,16 @@ public void testWriterId()
Assert.assertNotEquals(writer1.getWriterId(), writer2.getWriterId());
}

@Test
public void testInitialization_operationKind() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to duplicate all the tests into these two dimensions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's do this in a separate CL, my plan is to duplicate some of them

* Static map from {@link ConnectionPoolKey} to connection pool. Note this map is static to be
* shared by every stream writer in the same process.
*/
private static final Map<ConnectionPoolKey, ConnectionWorkerPool> connectionPoolMap =
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we talked about moving this pool map onto ConnectionWorkerPool?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think putting here will make the structure a lot easier to understand, otherwise we need to create a separate class e.g. PoolCollection to store the mapping from poolkey to connection pool

*/
@AutoValue
abstract static class ConnectionPoolKey {
abstract BigQueryWriteClient client();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the pool would contain only the BigQueryWriteClient? Should it be keyed by location(region)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to location

builder.traceId,
client,
ownsBigQueryWriteClient)));
if (!Objects.equals(
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's also check limitExceedBehavior and ownsBigQueryWriteClient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, I think for ownsBigQueryWriteClient let's check the client instead

@GaoleMeng GaoleMeng added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 20, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 20, 2022
@GaoleMeng GaoleMeng added the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 21, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 21, 2022
@GaoleMeng GaoleMeng merged commit 3eb1475 into googleapis:main Sep 21, 2022
gcf-merge-on-green bot pushed a commit that referenced this pull request Sep 30, 2022
🤖 I have created a release *beep* *boop*
---


## [2.22.0](https://togithub.com/googleapis/java-bigquerystorage/compare/v2.21.0...v2.22.0) (2022-09-29)


### Features

* Add a new specific exception about json data has unknown field ([#1792](https://togithub.com/googleapis/java-bigquerystorage/issues/1792)) ([18f93c1](https://togithub.com/googleapis/java-bigquerystorage/commit/18f93c124334464a951b3d3065bdf11bbda13dac))
* Add cache for location in stream writer, and trigger that when location is not presented ([#1804](https://togithub.com/googleapis/java-bigquerystorage/issues/1804)) ([c24c14f](https://togithub.com/googleapis/java-bigquerystorage/commit/c24c14f14b1a6f8249f55630d51e3cadd500c1ad))
* Add close() to multiplexing client ([#1788](https://togithub.com/googleapis/java-bigquerystorage/issues/1788)) ([6b3a974](https://togithub.com/googleapis/java-bigquerystorage/commit/6b3a97491bf718333ae7c085f9b10723d8b24388))
* Add fully managed schema support on json writer ([#1794](https://togithub.com/googleapis/java-bigquerystorage/issues/1794)) ([b6b515f](https://togithub.com/googleapis/java-bigquerystorage/commit/b6b515f57a0f6956c9d9f902a5e3e16edc845a48))
* Add more retry error code to the sample ([#1805](https://togithub.com/googleapis/java-bigquerystorage/issues/1805)) ([4bf67bc](https://togithub.com/googleapis/java-bigquerystorage/commit/4bf67bcf0de2d370f0b04d8df236d30466b91598))
* Add multiplexing client core algorithm and basic testing, plus fix a tiny bug in fake server ([#1787](https://togithub.com/googleapis/java-bigquerystorage/issues/1787)) ([1bb8e26](https://togithub.com/googleapis/java-bigquerystorage/commit/1bb8e262941f570d7f2de60123ec5a6a0cf43600))
* Add multiplexing support to connection worker.  ([#1784](https://togithub.com/googleapis/java-bigquerystorage/issues/1784)) ([a869a1d](https://togithub.com/googleapis/java-bigquerystorage/commit/a869a1d8baba3cc0f6046d661c6f52ec12a3f12d))
* Add support for flexible column name in JsonStreamWriter ([#1786](https://togithub.com/googleapis/java-bigquerystorage/issues/1786)) ([694abbb](https://togithub.com/googleapis/java-bigquerystorage/commit/694abbb43bf2970cd81803521c349dc31a38f484))
* Add two fine logs that would allow Datastream to look into the stuck issue ([#1791](https://togithub.com/googleapis/java-bigquerystorage/issues/1791)) ([745ceb4](https://togithub.com/googleapis/java-bigquerystorage/commit/745ceb46dec5922efe394773028532dcd84a4f9b))
* Always pass a null bigquery client lib to StreamWriter ([#1795](https://togithub.com/googleapis/java-bigquerystorage/issues/1795)) ([eec50c1](https://togithub.com/googleapis/java-bigquerystorage/commit/eec50c14e1dff84ae9a3e70f9d08d27b9e225e55))
* Bug fix for checking write_stream field but proto might not contain the field to unblock the release ([#1806](https://togithub.com/googleapis/java-bigquerystorage/issues/1806)) ([9791d69](https://togithub.com/googleapis/java-bigquerystorage/commit/9791d693c75367bec6451ebf65ae4ea3347bf50f))
* Client unknown fields drives writer refreshment ([#1797](https://togithub.com/googleapis/java-bigquerystorage/issues/1797)) ([d8aaed5](https://togithub.com/googleapis/java-bigquerystorage/commit/d8aaed522b9de487539165ea662465e5a96222f1))
* ExecutorProvider can now be replaced ([#1770](https://togithub.com/googleapis/java-bigquerystorage/issues/1770)) ([6380f71](https://togithub.com/googleapis/java-bigquerystorage/commit/6380f713b8f42fa3a58df2750ea2cf3b7397d29c)), closes [#1769](https://togithub.com/googleapis/java-bigquerystorage/issues/1769)
* Fix some todos and reject stream writer if it's created with mixed behavior of passed in client or not ([#1803](https://togithub.com/googleapis/java-bigquerystorage/issues/1803)) ([1a69192](https://togithub.com/googleapis/java-bigquerystorage/commit/1a69192e2ffc6475a7e4b67c5a452f1c0e8aaddc))
* Minor tune after offline testing  ([#1807](https://togithub.com/googleapis/java-bigquerystorage/issues/1807)) ([694a870](https://togithub.com/googleapis/java-bigquerystorage/commit/694a870bac623ef038168a4358b9d73972077edb))
* Populate location info if we already called GetWriteStream ([#1802](https://togithub.com/googleapis/java-bigquerystorage/issues/1802)) ([5f43103](https://togithub.com/googleapis/java-bigquerystorage/commit/5f4310321e7f90385f7ef5c32e3e5395f719d0ca))
* Some fixes for multiplexing client  ([#1798](https://togithub.com/googleapis/java-bigquerystorage/issues/1798)) ([b3ffd77](https://togithub.com/googleapis/java-bigquerystorage/commit/b3ffd77e4b86708f241ba517c55bb3508964bc0e))
* Wire connection pool to stream writer without implementing updated schema  ([#1790](https://togithub.com/googleapis/java-bigquerystorage/issues/1790)) ([3eb1475](https://togithub.com/googleapis/java-bigquerystorage/commit/3eb147545db2415e5a68752b8ede1c4d342d1a84))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants