Skip to content
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

LookupVindex: Implement internalize command for lookup vindexes #17429

Merged
merged 16 commits into from
Jan 22, 2025

Conversation

beingnoble03
Copy link
Member

@beingnoble03 beingnoble03 commented Dec 24, 2024

Description

This PR

  • Implements the internalize and complete command for lookup vindexes
  • Also, modifies the externalize command where we stop the workflow and mark it as frozen instead of deleting it.
  • complete command checks if the lookup vindex is externalized, and if it has an owner, it deletes the workflow.
  • internalize command starts the frozen streams (if there's an owner) and sets the write_only vindex param back to true (which was deleted when lookup vindex was externalized.)

Related Issue(s)

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

Signed-off-by: Noble Mittal <noblemittal@outlook.com>
Copy link
Contributor

vitess-bot bot commented Dec 24, 2024

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 Dec 24, 2024
@github-actions github-actions bot added this to the v22.0.0 milestone Dec 24, 2024
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
Copy link

codecov bot commented Dec 29, 2024

Codecov Report

Attention: Patch coverage is 54.58015% with 119 lines in your changes missing coverage. Please review.

Project coverage is 67.67%. Comparing base (d1aa2f4) to head (5c0cda5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../command/vreplication/lookupvindex/lookupvindex.go 14.28% 48 Missing ⚠️
go/vt/vtctl/grpcvtctldserver/server.go 0.00% 24 Missing ⚠️
go/vt/vtctl/workflow/server.go 80.00% 23 Missing ⚠️
go/vt/vtctl/grpcvtctldclient/client_gen.go 0.00% 10 Missing ⚠️
go/vt/vtctl/workflow/lookup_vindex.go 78.37% 8 Missing ⚠️
go/vt/vtctl/localvtctldclient/client_gen.go 0.00% 4 Missing ⚠️
go/vt/vtctl/workflow/utils.go 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17429      +/-   ##
==========================================
- Coverage   67.68%   67.67%   -0.02%     
==========================================
  Files        1586     1586              
  Lines      255170   255403     +233     
==========================================
+ Hits       172722   172839     +117     
- Misses      82448    82564     +116     

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

@beingnoble03 beingnoble03 added Type: Feature Component: VReplication and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Dec 30, 2024
@beingnoble03 beingnoble03 marked this pull request as ready for review December 30, 2024 06:30
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

This is looking good! I only had some minor comments and suggestions. Let me know what you think.

go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
@beingnoble03 beingnoble03 force-pushed the lookup-vindex-internalize branch from 54753a4 to ee296d2 Compare January 8, 2025 21:51
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
…Workflow

Signed-off-by: Noble Mittal <noblemittal@outlook.com>
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
@beingnoble03 beingnoble03 requested a review from mattlord January 10, 2025 19:13
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

This is looking really good! I still had a few outstanding questions/concerns though. Happy to sit down and walk through things if you like. I could be missing or misunderstanding some things as well so we could quickly get on the same page.

go/vt/vttablet/tabletmanager/rpc_vreplication.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/lookup_vindex.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/lookup_vindex.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
@beingnoble03 beingnoble03 force-pushed the lookup-vindex-internalize branch from 2e3db09 to e866118 Compare January 14, 2025 10:26
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
@beingnoble03 beingnoble03 requested a review from mattlord January 14, 2025 10:48
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

The code all looks great now! The only thing left, IMO, is updating some of the user facing text (and dev facing comments) based on the current behavior after the changes. As you now know, this can easily get confusing so any clarity we can add is worth it.

Hopefully it makes sense. Feel free to grab me on slack if not. Thank you for hanging in there! 🙂

go/vt/vtctl/workflow/lookup_vindex.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
Signed-off-by: Noble Mittal <noblemittal@outlook.com>
@beingnoble03
Copy link
Member Author

thank you so much @mattlord for the review! ❤️

Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for all of the time and effort that you put into this, @beingnoble03 !

I only had one remaining question about the client help text. Let me know what you think and we'll get this quickly merged.

@@ -158,7 +179,7 @@ var (
// externalize makes a LookupVindexExternalize call to a vtctld.
externalize = &cobra.Command{
Use: "externalize",
Short: "Externalize the Lookup Vindex. If the Vindex has an owner the VReplication workflow will also be deleted.",
Short: "Externalize the Lookup Vindex. If the Vindex has an owner the VReplication workflow will also be stopped/deleted.",
Copy link
Contributor

@mattlord mattlord Jan 21, 2025

Choose a reason for hiding this comment

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

This text is a bit off IMO. If we're not able to set the owner (the backing table) as part of the externalize then it's an error. No? Unless I'm missing something, then I think this is better:

"Externalize the Vindex so that it can be used for queries and stop (or optionally delete) the workflow."

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, we don't return an error if the vindex is unowned while externalizing, instead we just remove the write_only param from the vindex. This is the old behaviour that we follow in LookupVindexExternalize. Do you think we should change this behaviour (we can return error for unowned vindexes)?

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, fine to leave it as is then. Been a while since I was in this code so had forgotten. Thanks!

Signed-off-by: Noble Mittal <noblemittal@outlook.com>
@mattlord mattlord merged commit 5363f03 into vitessio:main Jan 22, 2025
106 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: LookupVindex has no internalize command (equivalent to ReverseTraffic)
3 participants