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

SHOW VITESS_REPLICATION_STATUS: Only use replication tracker when it's enabled #15348

Merged
merged 12 commits into from
Feb 26, 2024

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Feb 24, 2024

Description

We added the show vitess_replication_status query in #8900. At the time I chose to use the tablet's replication lag stats variable as we could get a more accurate representation of the lag than using mysqld's seconds_behind_[master|source] value. The stat relied on polling — in which case we can also estimate the lag when replication is not running – or sub-second heartbeats, and it was more accurate for these reasons.

This query was first introduced in v12 and at that time the ReplicationTracker was always enabled in the local examples using the polling method, where the manual testing was done. In v17 we changed the vttablet flags in the local examples in order to switch from the polling based method to the heartbeat based method before subsequently removing the heartbeats as well and after that we instead started using on-demand heartbeats alone — so today the replication tracker is disabled entirely in the local examples.

In any event, the real issue was that we didn't have adequate testing of this feature. This PR addresses the issue by:

  1. Only using the tablet's tracker based stat when replication tracking is enabled (heartbeat or polling based)
  2. Adds an e2e test 🙂

You can see a manual test case here: #15341 (comment)

I think that this should be backported for the following reasons:

  1. The changes are simple and isolated to users of this query
  2. The results were incorrect for the query

I also updated the throttler check to use check-self as check?app=vtgate is not useful because:

  1. check is only applicable on a PRIMARY tablet and we are checking non-PRIMARY tablets
  2. An app of vtgate doesn't make sense as vtgate does not interface with the tablet throttler

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

Copy link
Contributor

vitess-bot bot commented Feb 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 Feb 24, 2024
@mattlord mattlord changed the title SHOW VITESS_VREPLICATION_STATUS: Only use replication tracker when it's enabled SHOW VITESS_REPLICATION_STATUS: Only use replication tracker when it's enabled Feb 24, 2024
@github-actions github-actions bot added this to the v20.0.0 milestone Feb 24, 2024
@mattlord mattlord added Type: Bug Component: Query Serving Backport to: release-17.0 Backport to: release-19.0 Needs to be back ported to release-19.0 and removed NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request labels Feb 24, 2024
Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Feb 24, 2024
@mattlord mattlord marked this pull request as ready for review February 24, 2024 19:57
Copy link

codecov bot commented Feb 24, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 65.43%. Comparing base (27be916) to head (fc5f2f3).
Report is 17 commits behind head on main.

❗ Current head fc5f2f3 differs from pull request most recent head bbcb44a. Consider uploading reports for the commit bbcb44a to get more accurate results

Files Patch % Lines
go/vt/vtgate/executor.go 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15348      +/-   ##
==========================================
- Coverage   67.53%   65.43%   -2.11%     
==========================================
  Files        1561     1561              
  Lines      193387   193531     +144     
==========================================
- Hits       130607   126634    -3973     
- Misses      62780    66897    +4117     

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

Signed-off-by: Matt Lord <[email protected]>
This reverts commit 6d07ac2.

CheckThrottler is a tmclient RPC can thus can't be called from
a non-tablet.

Signed-off-by: Matt Lord <[email protected]>
As check?app=vtgate is only valid on a PRIMARY.

Also, vtgate's don't interface directly with the
tablet throttler so it doesn't make sense to use
the vtgate app name.

Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
@systay systay mentioned this pull request Feb 26, 2024
38 tasks
Copy link
Member

@GuptaManan100 GuptaManan100 left a comment

Choose a reason for hiding this comment

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

Rest LGTM

go/test/endtoend/tabletgateway/vtgate_test.go Outdated Show resolved Hide resolved
@mattlord mattlord merged commit 24b0579 into vitessio:main Feb 26, 2024
100 checks passed
@mattlord mattlord deleted the show_vitess_repl branch February 26, 2024 18:24
vitess-bot pushed a commit that referenced this pull request Feb 26, 2024
vitess-bot pushed a commit that referenced this pull request Feb 26, 2024
mattlord added a commit that referenced this pull request Feb 26, 2024
…racker when it's enabled (#15348) (#15361)

Signed-off-by: Matt Lord <[email protected]>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Co-authored-by: Matt Lord <[email protected]>
mattlord added a commit that referenced this pull request Feb 26, 2024
…racker when it's enabled (#15348) (#15360)

Signed-off-by: Matt Lord <[email protected]>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Co-authored-by: Matt Lord <[email protected]>
GuptaManan100 pushed a commit that referenced this pull request Feb 28, 2024
…racker when it's enabled (#15348) (#15362)

Signed-off-by: Matt Lord <[email protected]>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Co-authored-by: Matt Lord <[email protected]>
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.

Bug Report: 'show vitess_replication_status' always says ReplicationLag is 0
3 participants