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

VReplication: Force flag for traffic switching #16709

Merged
merged 21 commits into from
Sep 17, 2024

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Sep 4, 2024

Description

This PR adds an expert only --force flag to the SwitchTraffic and ReverseTraffic workflow sub-commands that currently exist for:

When specified, potentially non-critical failures such as partial tablet refreshes are considered non-fatal and the traffic switching work continues.

An example use case is:

  • You've switched traffic from the source keyspace to the target keyspace as part of a MoveTables workflow
  • One of the target shard's replica tablets is currently down
  • You need to switch traffic back before addressing that tablet issue as e.g. you need to ReverseTraffic ASAP because application errors are occurring and it's causing a [partial] outage

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: Update docs for 16654 and 16709 website#1835

@mattlord mattlord added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: VReplication labels Sep 4, 2024
Copy link
Contributor

vitess-bot bot commented Sep 4, 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 Sep 4, 2024
@github-actions github-actions bot added this to the v21.0.0 milestone Sep 4, 2024
Copy link

codecov bot commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 54.54545% with 35 lines in your changes missing coverage. Please review.

Project coverage is 68.93%. Comparing base (8816a2d) to head (161da76).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vtctl/workflow/traffic_switcher.go 46.87% 17 Missing ⚠️
go/vt/vtctl/workflow/server.go 64.10% 14 Missing ⚠️
go/vt/vtctl/grpcvtctldserver/server.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16709      +/-   ##
==========================================
- Coverage   68.94%   68.93%   -0.01%     
==========================================
  Files        1566     1566              
  Lines      201983   202036      +53     
==========================================
+ Hits       139252   139273      +21     
- Misses      62731    62763      +32     

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

Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord removed 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 Sep 7, 2024
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord removed the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Sep 7, 2024
mattlord added a commit to vitessio/website that referenced this pull request Sep 8, 2024
@mattlord mattlord removed the NeedsWebsiteDocsUpdate What it says label Sep 8, 2024
Signed-off-by: Matt Lord <[email protected]>
@@ -1984,6 +1984,7 @@ message WorkflowSwitchTrafficRequest {
bool dry_run = 9;
bool initialize_target_sequences = 10;
repeated string shards = 11;
bool force = 12;
Copy link
Member

Choose a reason for hiding this comment

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

This request keeps getting bigger. I wish we had implemented something similar to workflow options.

Copy link
Contributor Author

@mattlord mattlord Sep 12, 2024

Choose a reason for hiding this comment

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

WorkflowOptions are persisted in the workflow record as they affect the workflow generally (set on Create and used from then on). This flag only applies to a single traffic switch call and shouldn’t be persisted.

Copy link
Contributor Author

@mattlord mattlord Sep 13, 2024

Choose a reason for hiding this comment

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

I’m also not sure what’s bad about adding command flags and the corresponding proto fields for it? If this is about the actual wire protocol message size, then AFAIK embedding doesn't significantly impact that one way or the other. If that is the concern though, we could move all (non-repeated) fields to optional so that they are nil pointers instead of zero value structs (I'm actually not sure that this affects the over the wire bytes either way though, from my testing and experimentation I don't think it does, it only affects unmarshalling of the wire protocol message and the bytes used for that in-memory structure). I recently added one new optional field in #16654 and moved some existing ones to optional here: #16734

I can see e.g. that all of the (non-repeated) fields seem to be optional now in k8s: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/core/v1/generated.proto

go/vt/vtctl/workflow/server.go Outdated Show resolved Hide resolved
@mattlord mattlord merged commit 069651a into vitessio:main Sep 17, 2024
100 checks passed
@mattlord mattlord deleted the traffic_force branch September 17, 2024 18:01
mattlord added a commit to vitessio/website that referenced this pull request Sep 17, 2024
* Update docs for vitessio/vitess#16654

Signed-off-by: Matt Lord <[email protected]>

* Update docs after moving to --auto-start

Signed-off-by: Matt Lord <[email protected]>

* Also document vitessio/vitess#16709

Signed-off-by: Matt Lord <[email protected]>

* Rebuild docs base on main

Signed-off-by: Matt Lord <[email protected]>

* Kick CI

Signed-off-by: Matt Lord <[email protected]>

---------

Signed-off-by: Matt Lord <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: VReplication Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: VReplication: add force flag for SwitchTraffic and ReverseTraffic
3 participants