Skip to content

Conversation

@mhamza15
Copy link
Contributor

@mhamza15 mhamza15 commented May 20, 2025

Description

When re-opening a TableGC's pool, initialize a new pool rather than reusing the existing pool instance. This is to help prevent issues where Close fails and the pool is left in an inconsistent state, causing any subsequent Closes (such as during PlannedReparentShard) to fail.

Related Issue(s)

Closes #18202

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

@vitess-bot
Copy link
Contributor

vitess-bot bot commented May 20, 2025

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels May 20, 2025
@github-actions github-actions bot added this to the v23.0.0 milestone May 20, 2025
@mhamza15 mhamza15 changed the title initialize pool from scratch after TableGC.Close Initialize pool from scratch after TableGC.Close May 20, 2025
@mhamza15 mhamza15 changed the title Initialize pool from scratch after TableGC.Close Initialize pool from scratch after TableGC.Close May 20, 2025
@mhamza15 mhamza15 force-pushed the mhamza/pool-reuse branch from 6d3e840 to 9d81683 Compare May 20, 2025 19:33
@mhamza15
Copy link
Contributor Author

I have not yet been able to reproduce this in a test, but will be testing it on a cluster that is "stuck" in this state and PlannedReparentShard fail.

@mhamza15 mhamza15 marked this pull request as draft May 20, 2025 19:53
@codecov
Copy link

codecov bot commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.47%. Comparing base (c3daef3) to head (ce060d3).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18281   +/-   ##
=======================================
  Coverage   67.46%   67.47%           
=======================================
  Files        1602     1602           
  Lines      262245   262254    +9     
=======================================
+ Hits       176930   176944   +14     
+ Misses      85315    85310    -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mhamza15 mhamza15 force-pushed the mhamza/pool-reuse branch from 181ff4d to 31b9e0e Compare May 20, 2025 21:08
@GrahamCampbell
Copy link
Contributor

Does this need backport labels?

@mhamza15
Copy link
Contributor Author

mhamza15 commented May 21, 2025

Does this need backport labels?

Yep, was wrangling with some tests before opening this up for review. Should be all supported versions.

I've tested it on one of our clusters and PRS has been successful a few times. I can't definitively say this fixed it, but the bug does happen most of the time so it gives us a decent level of confidence.

@mhamza15 mhamza15 marked this pull request as ready for review May 21, 2025 14:36
@arthurschreiber arthurschreiber added Backport to: release-20.0 Needs to be backport to release-20.0 Backport to: release-21.0 Needs to be backport to release-21.0 Backport to: release-22.0 Needs to be backport to release-22.0 and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says labels May 21, 2025
@arthurschreiber arthurschreiber removed the NeedsBackportReason If backport labels have been applied to a PR, a justification is required label May 21, 2025
Comment on lines 177 to 181
if collector.pool == nil {
// Pass empty name so that metrics are not re-registered.
collector.pool = newPool(collector.env, "")
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we still get metrics recorded correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first I had thought so, but on a second glance, this new instance will not have the timings set up properly. Was getting this error when reinitializing the pool:

panic: Reuse of exported var name: TableGCPoolGetConnTime

Will come up with a different way.

Copy link
Contributor Author

@mhamza15 mhamza15 May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed. The expvar package in Go doesn't allow deleting a registered var, so I instead chose to skip re-registering an already registered var.

Signed-off-by: Mohamed Hamza <[email protected]>
@mhamza15 mhamza15 force-pushed the mhamza/pool-reuse branch from a4bd55f to e9b56b6 Compare May 21, 2025 17:32
@mhamza15
Copy link
Contributor Author

Looking at test failures

@mhamza15 mhamza15 requested a review from dbussink as a code owner June 5, 2025 19:51
mhamza15 added 2 commits June 5, 2025 14:51
Signed-off-by: Mohamed Hamza <[email protected]>
Signed-off-by: Mohamed Hamza <[email protected]>
@mhamza15 mhamza15 marked this pull request as draft June 5, 2025 20:08
@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2025

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions bot added the Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. label Jul 6, 2025
@github-actions
Copy link
Contributor

This PR was closed because it has been stale for 7 days with no activity.

@github-actions github-actions bot closed this Jul 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport to: release-20.0 Needs to be backport to release-20.0 Backport to: release-21.0 Needs to be backport to release-21.0 Backport to: release-22.0 Needs to be backport to release-22.0 NeedsIssue A linked issue is missing for this Pull Request Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug Report: Connection Pool Reuse leads to consistent PRS failure

4 participants