[FLINK-39824][mysql] Cache table filter results to reduce regex matching#4422
Open
taoran92 wants to merge 1 commit into
Open
[FLINK-39824][mysql] Cache table filter results to reduce regex matching#4422taoran92 wants to merge 1 commit into
taoran92 wants to merge 1 commit into
Conversation
Member
Author
|
@lvyanquan Can u help me review this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
This PR reduces high CPU usage in MySQL CDC source when synchronizing a large number of tables.
In large-table scenarios, MySQL binlog event processing may repeatedly check whether the same TableId should be included by the configured table filters. The hot path goes through Debezium's table filter
predicates, which rely on regex matching:
When the table list is large or the regex patterns are complex, repeatedly evaluating the same table filter result can consume significant CPU and cause TaskManager CPU usage to stay close to 100%.
This PR caches the table filter result by TableId after constructing the Debezium table filter. The cached filter preserves the existing semantics of the Debezium include filter and Flink CDC excludeTableList, while avoiding repeated regex evaluation for the same table.
Brief change log
No configuration option is added because this only caches deterministic table filter results and does not change filtering semantics.
Verifying this change
This change is verified by unit tests:
Does this pull request potentially affect one of the following parts:
Documentation
Does this pull request introduce a new feature? no
If yes, how is the feature documented? not applicable