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
Support MySQL 8 high resolution replication timestamps from GTID events #5036
Conversation
Welcome as a new contributor to Debezium, @methodmissing. Reviewers, please add missing author name(s) and alias name(s) to the COPYRIGHT.txt and Aliases.txt respectively. |
Hi @methodmissing, thanks for your contribution. Please prefix the commit message(s) with the DBZ-xxx JIRA issue key. |
27f3d92
to
374555f
Compare
Hi @methodmissing, thanks for your contribution. Please prefix the commit message(s) with the DBZ-xxx JIRA issue key. |
374555f
to
cadda09
Compare
Hi @methodmissing, thanks for your contribution. Please prefix the commit message(s) with the DBZ-xxx JIRA issue key. |
cadda09
to
313b8a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM @methodmissing, just a few comments inine.
...nnector-mysql/src/main/java/io/debezium/connector/mysql/MySqlStreamingChangeEventSource.java
Outdated
Show resolved
Hide resolved
...nnector-mysql/src/main/java/io/debezium/connector/mysql/MySqlStreamingChangeEventSource.java
Outdated
Show resolved
Hide resolved
313b8a6
to
1ab5441
Compare
Hi @methodmissing, would you please rebase against the latest |
1ab5441
to
e5cf9f2
Compare
Rebased, expected to fail on missing symbol
Requires |
Thanks @methodmissing, that makes perfect sense. I'll look at the binlog PR and build locally. Appreciate the quick turn around. |
e5cf9f2
to
8ca7b4e
Compare
Waits for the upstream MySQL binlog client 0.28.4. Tested this locally with the upstream PR in the client, both MariaDB and MySQL passed with |
8ca7b4e
to
b3a887f
Compare
Applied, thanks @methodmissing ! |
References and depends on osheroff/mysql-binlog-connector-java#130
Gist of the changes
More accurate metrics and also
source.ts_ms
forMySQL >= 8.0.1
withGTID
replication mode enabled. At Shopify we're doubling down on lower latency business use cases for CDC and we're aware of the second resolution (int4) timestamp constraint in binlog event headers for some time.This issue and Github pull requests to the binlog client and Debezium is an attempt to engage with the community to report higher resolution metrics and
source.ts_ms
in a backwards compatible way.Some example graphs from a lower environment connecting to MySQL 8 writers where the higher resolution timestamps are rendered - a lot easier to spot trends and variance for the writer -> binlog client hop.
Dead code removals
I could not find any references to these methods anymore:
SourceInfo::setBinlogTimestampSeconds
SourceInfo::getBinlogTimestampSeconds
Alignment of event time extraction in onEvent and handleEvent
I preferred to handle event timestamp extraction in
MySqlStreamingChangeEventSource::onEvent
as both handlers are called in order by the binlog client event listeners feature. That way emitted metrics values andsource.ts_ms
key off the sameInstant
instance.Event timestamp logic
MySQL 8.0.1 introduced 2 new microsecond resolution timestamps on GTID events to track replication lag more accurately:
original_commit_timestamp
is representative of the original commit time on the MySQL writer.The order of precedence is:
GtidEventData::getOriginalCommitTimestamp
returns a non-zero value (MySQL >= 8.0.1), use the high resolution timestamp as set by the writerOther due diligence checks
source.ts_ms
already, I did not find any timestamp resolution issues with aligning on millisecond resolution for the streaming path as wellJira issue: https://issues.redhat.com/projects/DBZ/issues/DBZ-7183