feat(spanner): long running transaction clean up - disabled#8177
Merged
harshachinta merged 42 commits intogoogleapis:mainfrom Oct 30, 2023
Merged
Conversation
olavloite
reviewed
Jul 4, 2023
…ion for inactive transactions
…le function to avoid sleep statements during unit tests
…dules. Currently tests are not getting run as part of github presubmits.
arpan14
reviewed
Jul 14, 2023
harshachinta
commented
Oct 6, 2023
spanner/README.md
Outdated
| if err != nil { | ||
| log.Fatal(err) | ||
| } | ||
| ``` |
Contributor
Author
There was a problem hiding this comment.
@arpan14 @olavloite @rahul2393 @asthamohta
Can you please take a look at the golang documentation for session leaks and give your LGTM?
olavloite
reviewed
Oct 6, 2023
spanner/README.md
Outdated
| The most common reason for session leaks in the Golang client library are: | ||
| 1. Not stopping a `RowIterator` that is returned by `Query`, `Read` and other methods. Always use `RowIterator.Stop()` to ensure that the `RowIterator` is always closed. | ||
| 2. Not closing a `ReadOnlyTransaction` when you no longer need it. Always call `ReadOnlyTransaction.Close()` after use, to ensure that the `ReadOnlyTransaction` is always closed. | ||
| 3. Not closing a `BatchReadOnlyTransaction` when you no longer need it. Always call `BatchReadOnlyTransaction.Close()` after use, to ensure that the `BatchReadOnlyTransaction` is always closed. |
Contributor
There was a problem hiding this comment.
For a different PR: We should change the implementation of BatchReadOnlyTransaction to not use any sessions from the pool, and instead create a separate session.
Contributor
Author
There was a problem hiding this comment.
BatchReadOnlyTransaction already creates its own session and do not use any sessions from the pool. Sorry for the confusion.
I have removed this line.
rahul2393
approved these changes
Oct 9, 2023
bhshkh
pushed a commit
that referenced
this pull request
Nov 3, 2023
* feat(spanner): long running transaction clean up to prevent session leaks * feat(spanner): code refactoring in session.go file * fix(spanner): fix vet * feat(spanner): refactor client.go file * feat(spanner): add lock when updating session handle * feat(spanner): code refactoring in transaction.go file * test(spanner): remove test * feat(spanner): code refactor * feat(spanner): refactor nit comments * feat(spanner): reduce sleep timing to milli seconds for unit tests * feat(spanner): update idleTimeThresholdSecs field to time.Duration * feat(spanner): make the log messages conditional based on type of action for inactive transactions * feat(spanner): combine get and remove long running sessions in a single function to avoid sleep statements during unit tests * feat(spanner): modify presubmit condition to run tests for changed modules. Currently tests are not getting run as part of github presubmits. * feat(spanner): revert presubmit.sh fix * feat(spanner): update doc * feat(spanner): reword isLongRunning to eligibleForLongRunning in sessionHandle * feat(spanner): update TrackSessionHandles logic to turn off stack trace by default for long running sessions * feat(spanner): fix test * feat(spanner): change action on inactive transactions option to enum * feat(spanner): fix lint * feat(spanner): fix lint * feat(spanner): fix lint * feat(spanner): fix doc * feat(spanner): disable the feature by default * feat(spanner): revert commit - disable the feature by default * fix: lint * docs: add Readme * feat(spanner): make WARN as default for action on inactive transactions * docs: address review comments * docs: move README.md changes in a different PR * feat: disable feature
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Automatically cleaning long running transactions