Skip to content

Conversation

@arpan14
Copy link
Contributor

@arpan14 arpan14 commented Sep 26, 2023

Requests are made to wait till a session is available. We are introducing a session pool option acquireSessionTimeout and a public method setAcquireSessionTimeout in the SessionPoolOptions class that will allow to specify a timeout value for requests. Post this timeout application will receive a RESOURCE_EXHAUSTED error. If this option is not passed, the client library will wait for 60s by default.

  • Sample Usage
SessionPoolOptions sessionPoolOptions = SessionPoolOptions.newBuilder().setAcquireSessionTimeout(Duration.ofMillis(60)).build(); SpannerOptions.Builder builder = SpannerOptions.newBuilder() .setProjectId("my-project") .setChannelProvider(channelProvider) .setCredentials(NoCredentials.getInstance()) .setSessionPoolOption(sessionPoolOptions); 
@arpan14 arpan14 requested a review from a team as a code owner September 26, 2023 08:26
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/java-spanner API. labels Sep 26, 2023
@arpan14 arpan14 requested a review from olavloite September 26, 2023 08:30
arpan14 and others added 3 commits September 26, 2023 18:58
…ssionPoolOptions.java Co-authored-by: Knut Olav Løite <koloite@gmail.com>
…ssionPoolOptions.java Co-authored-by: Knut Olav Løite <koloite@gmail.com>
@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 26, 2023
@arpan14 arpan14 added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Sep 26, 2023
arpan14 and others added 2 commits September 28, 2023 12:12
…ssionPoolOptions.java Co-authored-by: Knut Olav Løite <koloite@gmail.com>
@arpan14 arpan14 added owlbot:run Add this label to trigger the Owlbot post processor. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Sep 28, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 28, 2023
@gcf-owl-bot gcf-owl-bot bot requested a review from a team as a code owner September 28, 2023 07:41
@arpan14 arpan14 merged commit 428e294 into googleapis:main Sep 28, 2023
@arpan14 arpan14 deleted the session-timeout-pr branch September 28, 2023 08:24
surbhigarg92 pushed a commit to surbhigarg92/java-spanner that referenced this pull request Oct 5, 2023
…acquisition. (googleapis#2641) * feat: add session pool option for modelling a timeout around session acquisition. * docs: modify existing documentation. * Update google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java Co-authored-by: Knut Olav Løite <koloite@gmail.com> * Update google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java Co-authored-by: Knut Olav Løite <koloite@gmail.com> * chore: address review comments. * fix: lint errors. * fix: broken unit test. * chore: add more unit test. * fix: review comments. * fix: NPE in unit test. * Update google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java Co-authored-by: Knut Olav Løite <koloite@gmail.com> * chore: fix review comments. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Knut Olav Løite <koloite@gmail.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/java-spanner API. size: l Pull request size is large.

2 participants