-
Notifications
You must be signed in to change notification settings - Fork 401
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
fix(spanner): update session bookkeeping for session NotFound #15009
fix(spanner): update session bookkeeping for session NotFound #15009
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15009 +/- ##
=======================================
Coverage 92.90% 92.90%
=======================================
Files 2351 2351
Lines 210199 210205 +6
=======================================
+ Hits 195284 195290 +6
Misses 14915 14915 ☔ View full report in Codecov by Sentry. |
4b58a6b
to
d23f901
Compare
@@ -369,6 +370,16 @@ std::shared_ptr<SpannerStub> SessionPool::GetStub(Session const& session) { | |||
return GetStub(std::unique_lock<std::mutex>(mu_)); | |||
} | |||
|
|||
void SessionPool::DecrementSessionCount( | |||
std::unique_lock<std::mutex> const&, | |||
google::cloud::spanner_internal::Session& 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.
We're already in the google::cloud::spanner_internal
namespace.
It also looks like a Session const&
would suffice.
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.
Fixed in #15107
* Returns the number of sessions in the session pool plus the number of | ||
* sessions allocated to running transactions. | ||
*/ | ||
int total_sessions() const { return total_sessions_; } |
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.
total_sessions_
is guarded by mu_
.
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.
Added lock in #15017
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.
Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions
* Returns the number of sessions in the session pool plus the number of | ||
* sessions allocated to running transactions. | ||
*/ | ||
int total_sessions() const { return total_sessions_; } |
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.
Added lock in #15017
@@ -369,6 +370,16 @@ std::shared_ptr<SpannerStub> SessionPool::GetStub(Session const& session) { | |||
return GetStub(std::unique_lock<std::mutex>(mu_)); | |||
} | |||
|
|||
void SessionPool::DecrementSessionCount( | |||
std::unique_lock<std::mutex> const&, | |||
google::cloud::spanner_internal::Session& 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.
Fixed in #15107
* chore: set gcs-sdk-team as CODEOWNERS (#15000) Replace outdated GCS codeowners name to gcs-sdk-team * chore: update googleapis SHA circa 2025-02-27 (#15003) * chore: update googleapis SHA circa 2025-02-27 PiperOrigin-RevId: 731731741 * chore(deps): update dependency rules_python to v1.2.0 (#15002) * ci: disable external account integration test (#15004) * refactor(storage): avoid initializing json object with empty initializer list (#15006) * docs(release): update changelog for the 2025-03 release (#15008) * docs(release): update changelog for the 2025-03 release * update changelog * update changelog * chore: version bump to 2.37.0-rc (#15012) * fix(spanner): update session bookkeeping for session NotFound (#15009) * chore(deps): update dependency google_cloud_cpp to v2.36.0 (#15010) * feat!: remove client library resourcesettings (#15014) * remove resourcesettings * checkers format changes * cleanup * exclude resourcesettings from quickstart cmake * add changelog * Chore: update googleapis SHA circa 2025-03-06 (#15016) * chore: update googleapis SHA circa 2025-03-06 PiperOrigin-RevId: 734192973 * Regenerate libraries * impl(spanner): lock mutex in total_sessions accessor (#15017) * checkers --------- Co-authored-by: Daniel B <danielduhh@gmail.com> Co-authored-by: Scott Hart <sdhart@google.com> Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: Yao Cui <cuiyao@google.com>
* chore: set gcs-sdk-team as CODEOWNERS (#15000) Replace outdated GCS codeowners name to gcs-sdk-team * chore: update googleapis SHA circa 2025-02-27 (#15003) * chore: update googleapis SHA circa 2025-02-27 PiperOrigin-RevId: 731731741 * chore(deps): update dependency rules_python to v1.2.0 (#15002) * ci: disable external account integration test (#15004) * refactor(storage): avoid initializing json object with empty initializer list (#15006) * docs(release): update changelog for the 2025-03 release (#15008) * docs(release): update changelog for the 2025-03 release * update changelog * update changelog * chore: version bump to 2.37.0-rc (#15012) * fix(spanner): update session bookkeeping for session NotFound (#15009) * chore(deps): update dependency google_cloud_cpp to v2.36.0 (#15010) * feat!: remove client library resourcesettings (#15014) * remove resourcesettings * checkers format changes * cleanup * exclude resourcesettings from quickstart cmake * add changelog * Chore: update googleapis SHA circa 2025-03-06 (#15016) * chore: update googleapis SHA circa 2025-03-06 PiperOrigin-RevId: 734192973 * Regenerate libraries * impl(spanner): lock mutex in total_sessions accessor (#15017) * checkers --------- Co-authored-by: Daniel B <danielduhh@gmail.com> Co-authored-by: Scott Hart <sdhart@google.com> Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: Yao Cui <cuiyao@google.com>
When attempting to refresh sessions, we would
Erase
a session if it was "Not Found".Erase
would remove the session from the pool, but did not update the session counts which could prevent creation of new sessions to replace those that were erased.part of the work for #14958
This change is