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: Add stream DDL processing stats #15769

Merged
merged 12 commits into from
Apr 25, 2024

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Apr 21, 2024

Description

This adds stats to track the DDL processing actions taken in currently running VReplication streams based on the workflow's configured value of --on-ddl.

Manual test

git checkout main && make build

pushd examples/local

./101_initial_cluster.sh; mysql < ../common/insert_commerce_data.sql; ./201_customer_tablets.sh ; ./202_move_tables.sh

primaryuid=$(vtctldclient GetTablets --keyspace customer --tablet-type primary --shard "0" | awk '{print $1}' | cut -d- -f2 | bc)

mysql commerce -e "alter table customer modify email varchar(128)"
curl -s localhost:15200/debug/vars | grep -i VReplicationDDLActions

vtctldclient workflow --keyspace customer update --workflow commerce2customer --on-ddl=exec

mysql commerce -e "alter table customer modify email varchar(100)"
curl -s localhost:15${primaryuid}/debug/vars | grep -i VReplicationDDLActions

./401_teardown.sh
popd

Final output:

❯ curl -s localhost:15${primaryuid}/debug/vars | grep -i VReplicationDDLActions
"VReplicationDDLActions": {"commerce2customer.1.EXEC": 1, "commerce2customer.1.IGNORE": 1},

Related Issue(s)

Checklist

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

vitess-bot bot commented Apr 21, 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 Apr 21, 2024
@github-actions github-actions bot added this to the v20.0.0 milestone Apr 21, 2024
@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 Apr 21, 2024
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Copy link

codecov bot commented Apr 21, 2024

Codecov Report

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

Project coverage is 68.45%. Comparing base (14b36d0) to head (ee0bd6f).
Report is 12 commits behind head on main.

Files Patch % Lines
go/vt/vttablet/tabletmanager/vreplication/stats.go 41.66% 7 Missing ⚠️
go/vt/vttablet/tabletmanager/vdiff/controller.go 0.00% 2 Missing ⚠️
go/vt/vttablet/tabletmanager/vdiff/table_differ.go 0.00% 1 Missing ⚠️
...vt/vttablet/tabletmanager/vdiff/workflow_differ.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15769      +/-   ##
==========================================
+ Coverage   68.39%   68.45%   +0.06%     
==========================================
  Files        1556     1558       +2     
  Lines      195422   195836     +414     
==========================================
+ Hits       133666   134069     +403     
- Misses      61756    61767      +11     

☔ 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 the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Apr 22, 2024
@mattlord mattlord marked this pull request as ready for review April 22, 2024 01:39
Signed-off-by: Matt Lord <[email protected]>
mattlord added a commit to vitessio/website that referenced this pull request Apr 24, 2024
@mattlord mattlord removed the NeedsWebsiteDocsUpdate What it says label Apr 24, 2024
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
bps.TableCopyTimings = stats.NewTimings("", "", "Table")
bps.PartialQueryCacheSize = stats.NewCountersWithMultiLabels("", "", []string{"type"})
bps.PartialQueryCount = stats.NewCountersWithMultiLabels("", "", []string{"type"})
bps.ThrottledCounts = stats.NewCountersWithMultiLabels("", "", []string{"throttler", "component"})
bps.DDLEventActions = stats.NewCountersWithSingleLabel("", "", "action")
Copy link
Member

Choose a reason for hiding this comment

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

Any idea whether these tags are case-sensitive? I mean when filtering using PromQL. In this case, there is only 1 tag, but for multi-label counters, you might want to filter that way.

Copy link
Contributor Author

@mattlord mattlord Apr 25, 2024

Choose a reason for hiding this comment

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

Yes, I believe they are. For example this returns values in grafana with prometheus:

vttablet_errors{error_code="ABORTED"}

But these do not:

vttablet_errors{error_code="aborted"}

vttablet_errors{error_CODE="ABORTED"}

@deepthi deepthi merged commit 716fc12 into vitessio:main Apr 25, 2024
104 checks passed
@deepthi deepthi deleted the vrepl_onddl_stats branch April 25, 2024 00:22
rohit-nayak-ps pushed a commit to vitessio/website that referenced this pull request Apr 30, 2024
* Document new stat added in vitessio/vitess#15769

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

* Minor touchup

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: Add vttablet metric for vplayer DDL actions
4 participants