VReplication: Sync in-memory workflow state metric on workflow read#20013
VReplication: Sync in-memory workflow state metric on workflow read#20013mcrauwel wants to merge 3 commits into
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a VReplication observability/correctness issue where in-memory stream state metrics could advance to Error even when the corresponding _vt.vreplication row update fails (e.g., MySQL is read_only during reparent), causing operators to see misleading stream state in metrics and /debug/vars.
Changes:
- Move in-memory
Statemetric updates to occur only after the_vt.vreplicationUPDATEsucceeds (for bothvreplicatorandBinlogPlayerpaths). - Add unit tests ensuring state metrics do not advance when the DB update fails.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| go/vt/vttablet/tabletmanager/vreplication/vreplicator.go | Defers vr.stats.State update until after the DB UPDATE succeeds. |
| go/vt/vttablet/tabletmanager/vreplication/vreplicator_test.go | Adds a test ensuring setState doesn’t advance the metric on DB error. |
| go/vt/binlog/binlogplayer/binlog_player.go | Defers blp.blplStats.State update until after the DB UPDATE succeeds. |
| go/vt/binlog/binlogplayer/binlog_player_test.go | Adds a test ensuring setVReplicationState doesn’t advance the metric on DB error. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #20013 +/- ##
===========================================
+ Coverage 69.67% 73.82% +4.15%
===========================================
Files 1614 34 -1580
Lines 216793 5845 -210948
===========================================
- Hits 151044 4315 -146729
+ Misses 65749 1530 -64219
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Matthias Crauwels <matthias.crauwels@planetscale.com>
This reverts commit e07ae8d.
fixes vitessio#20012 Signed-off-by: Matthias Crauwels <matthias.crauwels@planetscale.com>
11a6303 to
97b5678
Compare
Description
Use the stored state of the workflow as source of truth for the stats/metrics reporting.
Related Issue(s)
Checklist
AI Disclosure
I worked with Claude Opus 4.7 on this