Skip to content

Conversation

@shlomi-noach
Copy link
Contributor

Description

This is an extract from #17628. While working on #17628 we:

  • Improved parsing of GTID events
  • Found speed and memory improvements around GTID computation and otherwise specifically in vstreamer.

In this PR we have the following improvements:

go/mysql

  • Parse PREVIOUS_GTIDS event
  • Extract last_committed (aka commit parent) and sequence_number from GTID event
  • Optimize timestamp format
  • In-place add GTID and union GTID -- this saves a lot of memory allocation and gc collection

vstreamer.go

  • Handle PREVIOUS_GTIDS event
  • Use in-place addition of GTID (there's no need for the streamer's GTIDSet to be immutable and this is wasteful)
  • Optimize formatting of GTID (just once for the GTID events group as opposed to every event)
  • Optimize time.Now() generation (same timestamp for GTID group)
  • Apply SequenceNumber and LastCommitted to all events.

Related Issue(s)

#17628

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

…ract sequence_number and last_transaction from binlog event

Signed-off-by: Shlomi Noach <[email protected]>
…ract sequence_number and last_transaction from binlog event

Signed-off-by: Shlomi Noach <[email protected]>
- Handle PREVIOUS_GTIDS event
- Use in-place GTID updates
- Read commit parent (last_committed) and sequence_number from GTID event
- Optimize use of time.Now()
- Optimize generation of GTID

Signed-off-by: Shlomi Noach <[email protected]>
@vitess-bot
Copy link
Contributor

vitess-bot bot commented Apr 23, 2025

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 23, 2025
@shlomi-noach shlomi-noach 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 NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Apr 23, 2025
shlomi-noach and others added 9 commits April 27, 2025 08:03
Co-authored-by: Arthur Schreiber <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
@codecov
Copy link

codecov bot commented Apr 28, 2025

Codecov Report

❌ Patch coverage is 74.87923% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.52%. Comparing base (104b755) to head (b8ec791).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
go/mysql/replication/mariadb_gtid.go 12.50% 14 Missing ⚠️
go/mysql/replication/replication_position.go 46.15% 14 Missing ⚠️
go/mysql/replication/mysql56_gtid_set.go 92.63% 7 Missing ⚠️
go/vt/vttablet/tabletserver/vstreamer/vstreamer.go 79.31% 6 Missing ⚠️
go/mysql/binlog_event_filepos.go 33.33% 4 Missing ⚠️
go/mysql/replication/filepos_gtid.go 50.00% 4 Missing ⚠️
go/mysql/replication/mysql56_gtid.go 60.00% 2 Missing ⚠️
go/vt/binlog/binlog_streamer.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18196      +/-   ##
==========================================
+ Coverage   67.49%   67.52%   +0.02%     
==========================================
  Files        1607     1607              
  Lines      263144   263324     +180     
==========================================
+ Hits       177621   177805     +184     
+ Misses      85523    85519       -4     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions bot added Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. and removed Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. labels May 30, 2025
@github-actions
Copy link
Contributor

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions bot added Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. and removed Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. labels Jun 30, 2025
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
@shlomi-noach shlomi-noach merged commit 1c5ca23 into vitessio:main Aug 26, 2025
106 of 112 checks passed
@shlomi-noach shlomi-noach deleted the gtid-computation-optimization branch August 26, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: General Changes throughout the code base Component: Performance Component: VReplication Type: Enhancement Logical improvement (somewhere between a bug and feature) Type: Performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants