Skip to content

[Do Not Merge] v20.x #152

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

Closed
wants to merge 2 commits into from
Closed

Conversation

arthurschreiber
Copy link
Member

@arthurschreiber arthurschreiber commented Apr 11, 2025

Description

This pull request is used to track which backports we've done against the upstream v20 release.

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

…gate startup (vitessio#16655)

Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Arthur Schreiber <arthurschreiber@github.com>
@Copilot Copilot AI review requested due to automatic review settings April 11, 2025 11:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the Vitess tablet gateway and keyspace event watcher to gate startup based on keyspace consistency and buffering conditions during reparent operations. Key changes include:

  • Replacing the legacy PrimaryIsNotServing API with the more descriptive ShouldStartBufferingForTarget in both production and test code.
  • Introducing WaitForConsistentKeyspaces to ensure keyspaces are processed before allowing primary tablet queries.
  • Updating srvtopo discovery functions to return both targets and keyspaces.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go/vt/vtgate/tabletgateway_test.go Added a new test (TestWithRetry) that validates the new retry and buffering behavior.
go/vt/vtgate/tabletgateway_flaky_test.go Updated tests to use ShouldStartBufferingForTarget instead of PrimaryIsNotServing.
go/vt/vtgate/tabletgateway.go Replaced API calls to use the new keyspace event buffering logic and await keyspace consistency.
go/vt/srvtopo/discover_test.go Renamed tests to use FindAllTargetsAndKeyspaces and assert on the returned keyspaces list.
go/vt/srvtopo/discover.go Updated function signature and documentation to return both targets and keyspaces.
go/vt/discovery/keyspace_events_test.go Adjusted tests to validate the new ShouldStartBufferingForTarget API and its expectations.
go/vt/discovery/keyspace_events.go Renamed PrimaryIsNotServing to ShouldStartBufferingForTarget and added WaitForConsistentKeyspaces.
Comments suppressed due to low confidence (1)

go/vt/discovery/keyspace_events.go:749

  • [nitpick] The compound boolean expression is complex; consider refactoring it into multiple well-named boolean variables or adding inline comments to improve readability and maintainability.
return state.currentPrimary, !state.serving && !ks.consistent && state.externallyReparented != 0 && state.currentPrimary != nil

Comment on lines +802 to +805
func (kew *KeyspaceEventWatcher) WaitForConsistentKeyspaces(ctx context.Context, ksList []string) error {
// We don't want to change the original keyspace list that we receive so we clone it
// before we empty it elements down below.
keyspaces := slices.Clone(ksList)
Copy link
Preview

Copilot AI Apr 11, 2025

Choose a reason for hiding this comment

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

WaitForConsistentKeyspaces uses a fixed sleep interval in a loop which may lead to long waits if keyspaces never become consistent; consider introducing a configurable timeout or maximum iteration limit to avoid potential resource waste.

Suggested change
func (kew *KeyspaceEventWatcher) WaitForConsistentKeyspaces(ctx context.Context, ksList []string) error {
// We don't want to change the original keyspace list that we receive so we clone it
// before we empty it elements down below.
keyspaces := slices.Clone(ksList)
func (kew *KeyspaceEventWatcher) WaitForConsistentKeyspaces(ctx context.Context, ksList []string, timeout time.Duration) error {
// We don't want to change the original keyspace list that we receive so we clone it
// before we empty it elements down below.
keyspaces := slices.Clone(ksList)
timeoutChan := time.After(timeout)

Copilot uses AI. Check for mistakes.

) (#149)

* VReplication: Estimate lag when workflow fully throttled (vitessio#16577)

Signed-off-by: Matt Lord <mattalord@gmail.com>

* remove check result summary

* rerun actions

Signed-off-by: Mohamed Hamza <mhamza15@github.com>

* fix runs on in workflows

* update actions

---------

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Mohamed Hamza <mhamza15@github.com>
Co-authored-by: Matt Lord <mattalord@gmail.com>
Copy link

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 label May 15, 2025
Copy link

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

@github-actions github-actions bot closed this May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants