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

consumer(ticdc): canal-json decoder cache table info for each message to avoid allocate memory on each new message #11895

Merged
merged 16 commits into from
Dec 19, 2024

Conversation

3AceShowHand
Copy link
Contributor

@3AceShowHand 3AceShowHand commented Dec 17, 2024

…sage

What problem does this PR solve?

Issue Number: close #11894, close #11907

What is changed and how it works?

  • canal-json decoder reuse table info, instead create new one for each message
  • fix the vector type failed on the comparison by using ==

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

`None`

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 17, 2024
@3AceShowHand
Copy link
Contributor Author

/retest

1 similar comment
@3AceShowHand
Copy link
Contributor Author

/retest

@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. labels Dec 18, 2024
@3AceShowHand 3AceShowHand force-pushed the canal-json-consumer-memory branch from 13be1b6 to 74cc7ea Compare December 18, 2024 09:01
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 18, 2024
@3AceShowHand 3AceShowHand changed the title [DNM] consumer(ticdc): canal-json decoder cache table info for each message to avoid allocate memory on each new message consumer(ticdc): canal-json decoder cache table info for each message to avoid allocate memory on each new message Dec 18, 2024
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Dec 19, 2024
}
}
indexInfo := &timodel.IndexInfo{
ID: 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is only primary key, and should 1, it's the previous behavior.

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 19, 2024
@@ -48,6 +56,8 @@ type batchDecoder struct {

upstreamTiDB *sql.DB
bytesDecoder *encoding.Decoder

tableInfoCache map[tableKey]*model.TableInfo
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cached item is deleted if receive table level DDL, and recreate a new table info.

@3AceShowHand 3AceShowHand requested a review from lidezhu December 19, 2024 06:04
Copy link
Contributor

ti-chi-bot bot commented Dec 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lidezhu, wk989898

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

The pull request process is described here

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 19, 2024
Copy link
Contributor

ti-chi-bot bot commented Dec 19, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-19 04:05:23.399613209 +0000 UTC m=+1102513.488415746: ☑️ agreed by wk989898.
  • 2024-12-19 06:13:18.40707268 +0000 UTC m=+1110188.495875222: ☑️ agreed by lidezhu.

@ti-chi-bot ti-chi-bot bot merged commit fa598ba into pingcap:master Dec 19, 2024
26 checks passed
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
3 participants