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

Fixes for avoidance of hosts taking backup in PRS & ERS #17300

Conversation

ejortegau
Copy link
Contributor

@ejortegau ejortegau commented Nov 29, 2024

Description

This PR addresses fixes issues in PRS & ERS preference for tablets that are not taking backups. It does away with redundant field definitions in some of the proto messages and addresses segfault that could take place during ERS.

Related Issue(s)

#17299
#16997

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

N/A

Copy link
Contributor

vitess-bot bot commented Nov 29, 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 Nov 29, 2024
@github-actions github-actions bot added this to the v22.0.0 milestone Nov 29, 2024
Signed-off-by: Eduardo J. Ortega U. <[email protected]>
Signed-off-by: Eduardo J. Ortega U. <[email protected]>
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 70.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 67.41%. Comparing base (ab7b516) to head (b9ae5a5).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vttablet/tabletmanager/rpc_replication.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17300      +/-   ##
==========================================
- Coverage   67.41%   67.41%   -0.01%     
==========================================
  Files        1576     1576              
  Lines      253417   253430      +13     
==========================================
+ Hits       170846   170851       +5     
- Misses      82571    82579       +8     

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

Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

LGTM

@deepthi deepthi 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 labels Dec 2, 2024
@deepthi deepthi removed the NeedsBackportReason If backport labels have been applied to a PR, a justification is required label Dec 2, 2024
@ejortegau ejortegau requested a review from dbussink December 3, 2024 08:19
ejortegau added a commit to slackhq/vitess that referenced this pull request Dec 3, 2024
This PR is a manual backport of upstream vitessio#17300
The information below is a copy of what the description of the upstream PR

This PR addresses fixes issues in PRS & ERS preference for tablets that are not taking backups. It does away with redundant field definitions in some of the proto messages and addresses segfault that could take place during ERS.
deepthi
deepthi previously requested changes Dec 3, 2024
Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

While these changes look good, the fact that the previous PR caused vtctld to crash points to missing tests.
Can you come up with a test case that would reproduce that particular crash and add it into this PR please?

@deepthi deepthi dismissed their stale review December 3, 2024 16:04

Re-review

@deepthi
Copy link
Member

deepthi commented Dec 3, 2024

While these changes look good, the fact that the previous PR caused vtctld to crash points to missing tests. Can you come up with a test case that would reproduce that particular crash and add it into this PR please?

I noticed that one of the commits says "fix SIGSEGV in test". Which test was that, and how was it passing on the previous PR?

@ejortegau
Copy link
Contributor Author

While these changes look good, the fact that the previous PR caused vtctld to crash points to missing tests. Can you come up with a test case that would reproduce that particular crash and add it into this PR please?

I noticed that one of the commits says "fix SIGSEGV in test". Which test was that, and how was it passing on the previous PR?

The first PR accessed the flag indicating whether a backup was or not running directly from a field in a struct. The new code access it from a field in a pointer to the struct. Thus the previous PR always found something there (even if it was the default false), whereas the new one could get a nil struct and crash. Hence why that commit wrapped that in some checks for the struct pointer not being null.

@ejortegau
Copy link
Contributor Author

While these changes look good, the fact that the previous PR caused vtctld to crash points to missing tests. Can you come up with a test case that would reproduce that particular crash and add it into this PR please?

The crash during ERS was a consequence of my first attempt to fix the fact that I was using the wrong value for figuring out whether the backup was running or not. By replacing this with this I introduced stopReplicationStatus.After.BackupRunning when After might be null. This didn't exist in the original PR and hence a corresponding test didn't exist or made no sense back then.

In any case, I just added some test cases to ensure that the value of the map with backup state information is correct, and to verify that if the After replication state is null, no segfault takes place and the value is taken from the before state.

@ejortegau ejortegau requested a review from deepthi December 4, 2024 13:14
@deepthi
Copy link
Member

deepthi commented Dec 4, 2024

I don't see any new tests, maybe you forgot to push the new commit?

@ejortegau
Copy link
Contributor Author

I don't see any new tests, maybe you forgot to push the new commit?

They should be visible now.

@GuptaManan100 GuptaManan100 merged commit 3cdda35 into vitessio:main Dec 9, 2024
103 of 105 checks passed
ejortegau added a commit to slackhq/vitess that referenced this pull request Dec 10, 2024
ejortegau added a commit to slackhq/vitess that referenced this pull request Dec 18, 2024
…) (#572)

This is a backport of upstream's vitessio#17300 . Description of the upstream PR follows:

Description
This PR addresses fixes issues in PRS & ERS preference for tablets that are not taking backups. It does away with redundant field definitions in some of the proto messages and addresses segfault that could take place during ERS.


Signed-off-by: Eduardo J. Ortega U. <[email protected]>
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.

4 participants