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: add cache for location in stream writer, and trigger that when location is not presented #1804

Merged
merged 28 commits into from
Sep 28, 2022

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 27 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 28, 2022 01:05
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Sep 28, 2022
@product-auto-label product-auto-label bot added the api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. label Sep 28, 2022
@GaoleMeng GaoleMeng requested a review from yirutang September 28, 2022 01:05
private static Pattern streamPattern = Pattern.compile(datasetsMatching);

// Cache of location info for a given dataset.
private static Map<String, String> projectAndDatasetToLocation = new ConcurrentHashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have a size limit of this cache? And also probably an expiration time. I am not sure how often is this but the user can delete a dataset and recreate one in different region?

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 just add a size limit for now and add expiration later.

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 didn't add a size limit because it's plain string, seems not possible to exceed limit. We can cache millions of entries without problem I think and it's kinda hard to imagine we need to cache that many..

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure fine, let's first go with this. I am a bit worry about dataset recreate case but that should be a corner case. Let's get going.

@Neenu1995 Neenu1995 added the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 28, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 28, 2022
@GaoleMeng GaoleMeng merged commit c24c14f into googleapis:main Sep 28, 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: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants