This repository was archived by the owner on Apr 7, 2026. It is now read-only.
feat: long running transaction clean up background task. Adding configuration options for closing inactive transactions.#2419
Merged
arpan14 merged 57 commits intogoogleapis:mainfrom Aug 1, 2023
Conversation
…od while retrying exceptions in unit tests. * For details on issue see - googleapis#2206
fix: prevent illegal negative timeout values into thread sleep() method while retrying exceptions in unit tests.
…guration options for closing inactive transactions.
olavloite
reviewed
May 22, 2023
Collaborator
olavloite
left a comment
There was a problem hiding this comment.
The log of the integration tests for the emulator (and possibly also for the other test runs) are spammed with a very large number of warnings for closed long-running transactions.
- Is that expected? Or are we accidentally removing a lot more sessions from the pool than we should?
- If it is expected, can we somehow silence that log? It now makes the log too large to be really useful.
…ssionPool.java Co-authored-by: Knut Olav Løite <koloite@gmail.com>
…ssionPoolOptions.java Co-authored-by: Knut Olav Løite <koloite@gmail.com>
…ssionPoolOptions.java Co-authored-by: Knut Olav Løite <koloite@gmail.com>
…ssionPoolOptions.java Co-authored-by: Knut Olav Løite <koloite@gmail.com>
asthamohta
approved these changes
Jul 12, 2023
olavloite
reviewed
Aug 1, 2023
olavloite
approved these changes
Aug 1, 2023
gcf-merge-on-green bot
pushed a commit
that referenced
this pull request
Aug 5, 2023
🤖 I have created a release *beep* *boop* --- ## [6.45.0](https://togithub.com/googleapis/java-spanner/compare/v6.44.0...v6.45.0) (2023-08-04) ### Features * Enable leader aware routing by default in Connection API. This enables its use in the JDBC driver and PGAdapter. The update contains performance optimisations that will reduce the latency of read/write transactions that originate from a region other than the default leader region. ([2a85446](https://togithub.com/googleapis/java-spanner/commit/2a85446b162b006ce84a86285af1767c879b27ed)) * Enable leader aware routing by default. This update contains performance optimisations that will reduce the latency of read/write transactions that originate from a region other than the default leader region. ([441c1b0](https://togithub.com/googleapis/java-spanner/commit/441c1b03c3e976c6304a99fefd93b5c4291e5364)) * Long running transaction clean up background task. Adding configuration options for closing inactive transactions. ([#2419](https://togithub.com/googleapis/java-spanner/issues/2419)) ([423e1a4](https://togithub.com/googleapis/java-spanner/commit/423e1a4b483798d9683ff9bd232b53d76e09beb0)) * Support partitioned queries + data boost in Connection API ([#2540](https://togithub.com/googleapis/java-spanner/issues/2540)) ([4e31d04](https://togithub.com/googleapis/java-spanner/commit/4e31d046f5d80abe8876a729ddba045c70f3261d)) ### Bug Fixes * Apply stream wait timeout ([#2544](https://togithub.com/googleapis/java-spanner/issues/2544)) ([5a12cd2](https://togithub.com/googleapis/java-spanner/commit/5a12cd29601253423c5738be5471a036fd0334be)) ### Dependencies * Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.14.0 ([#2562](https://togithub.com/googleapis/java-spanner/issues/2562)) ([dbd5c75](https://togithub.com/googleapis/java-spanner/commit/dbd5c75be39262003092ff4a925ed470cc45f8be)) * Update dependency org.openjdk.jmh:jmh-core to v1.37 ([#2565](https://togithub.com/googleapis/java-spanner/issues/2565)) ([d5c36bf](https://togithub.com/googleapis/java-spanner/commit/d5c36bfbb67ecb14854944779da6e4dbd93f3559)) * Update dependency org.openjdk.jmh:jmh-generator-annprocess to v1.37 ([#2566](https://togithub.com/googleapis/java-spanner/issues/2566)) ([73e92d4](https://togithub.com/googleapis/java-spanner/commit/73e92d42fe6d334b6efa6485246dc67858adb0a9)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
psinghbay1
reviewed
Sep 13, 2023
| * | ||
| * @return this builder for chaining | ||
| */ | ||
| Builder setWarnAndCloseIfInactiveTransactions() { |
There was a problem hiding this comment.
why are we making these methods package protected?
Contributor
Author
There was a problem hiding this comment.
@psinghbay1 This feature is not yet launched. Hence it is package protected in this PR. We will be enabling this in the next couple of weeks.
|
Any reason we are keeping these methods package protected in builder class? |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.Suggestion cannot be applied right now. Please check back later.
Adding a couple of option in
SessionPoolOptionsfor auto-detecting long running transactions, logging the stack-trace and removing such transactions from consuming more resources. There can be scenarios where transactions are unexpectedly taking more time and hence can consume thesessionfor longer durations. With this change, customers get two new options which can be set while providingSessionPoolOptionssetWarnIfInactiveTransactions()- Calling this method will generate warning logs and help in identifying faulty code which is leading to incorrect consumption of sessions.setWarnAndCloseIfInactiveTransactions()- Calling this method will close the faulty transactions that are consuming the resources. We will also be generating the warning logs which can be later referred to know the transactions that were closed through this option.Note : The feature is currently under development. The final usage pattern will be updated in a subsequent commit.