-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(spanner): long running transaction clean up - disabled #8177
feat(spanner): long running transaction clean up - disabled #8177
Conversation
…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.
spanner/README.md
Outdated
@@ -31,4 +31,87 @@ row, err := client.Single().ReadRow(ctx, "Users", | |||
if err != nil { | |||
log.Fatal(err) | |||
} | |||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arpan14 @olavloite @rahul2393 @asthamohta
Can you please take a look at the golang documentation for session leaks and give your LGTM?
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BatchReadOnlyTransaction
already creates its own session and do not use any sessions from the pool. Sorry for the confusion.
I have removed this line.
* 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
Automatically cleaning long running transactions