Skip to content

Conversation

@tiancaiamao
Copy link
Contributor

…le for TiCDC

What problem does this PR solve?

Issue Number: ref #65269

Problem Summary:

What changed and how does it work?

Provide a new system variable to read it.

SELECT @@tidb_active_active_sync_stats;
+---------------------------------+
| @@tidb_active_active_sync_stats |
+---------------------------------+
| {"conflict_skip_rows": 123 }    |
+---------------------------------+

The CDC can query this variable periodically (.i.e, 5 minutes) to update the metrics. Because one TiDB connection only serves one changefeed, we only need to record a single count per connection.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 25, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 25, 2025
@tiprow
Copy link

tiprow bot commented Dec 25, 2025

Hi @tiancaiamao. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@tiancaiamao tiancaiamao marked this pull request as ready for review December 26, 2025 04:36
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Dec 26, 2025
@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (feature/active-active@04dbcb1). Learn more about missing BASE report.

Additional details and impacted files
@@                    Coverage Diff                     @@
##             feature/active-active     #65270   +/-   ##
==========================================================
  Coverage                         ?   73.3535%           
==========================================================
  Files                            ?       1860           
  Lines                            ?     508157           
  Branches                         ?          0           
==========================================================
  Hits                             ?     372751           
  Misses                           ?     113203           
  Partials                         ?      22203           
Flag Coverage Δ
integration 41.9425% <96.0000%> (?)
unit 72.2601% <42.0000%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.8700% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 46.3579% <0.0000%> (?)
🚀 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.

Copy link
Collaborator

@lcwangchao lcwangchao 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

@tiancaiamao
Copy link
Contributor Author

/retest

@tiprow
Copy link

tiprow bot commented Dec 29, 2025

@tiancaiamao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 29, 2025
return nil
}},
{Scope: vardef.ScopeSession, Name: vardef.TiDBCDCActiveActiveSyncStats, Value: "", Type: vardef.TypeStr, ReadOnly: true, GetSession: func(s *SessionVars) (string, error) {
return fmt.Sprintf("{\"conflict_skip_rows\": %d}", s.ActiveActiveConflictSkipRows.Load()), nil
Copy link
Member

Choose a reason for hiding this comment

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

So we don't need to clear or reset this count?

Copy link
Contributor Author

@tiancaiamao tiancaiamao Dec 30, 2025

Choose a reason for hiding this comment

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

Yes, no reset.
Each session has a session variable tidb_cdc_active_active_sync_stats, ticdc can check it and compare the value with previous value to know the metrics in a period.

Co-authored-by: Zhou Kunqin <25057648+time-and-fate@users.noreply.github.com>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 30, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lcwangchao, time-and-fate
Once this PR has been reviewed and has the lgtm label, please assign benmeadowcroft for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 30, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 30, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-12-29 09:51:55.438122318 +0000 UTC m=+4671.256430740: ☑️ agreed by lcwangchao.
  • 2025-12-30 03:34:46.03579577 +0000 UTC m=+68441.854104202: ☑️ agreed by time-and-fate.

@tiancaiamao
Copy link
Contributor Author

/retest

@tiprow
Copy link

tiprow bot commented Dec 30, 2025

@tiancaiamao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot merged commit ae24f3d into pingcap:feature/active-active Dec 30, 2025
21 checks passed
@tiancaiamao tiancaiamao deleted the tidb_active_active_sync_stats branch December 30, 2025 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants