Skip to content

[FLINK-39300][mysql-cdc] Reuse ObjectMapper as static constant to avoid repeated instantiation.#4330

Open
eric666666 wants to merge 2 commits intoapache:masterfrom
eric666666:FLINK-39300
Open

[FLINK-39300][mysql-cdc] Reuse ObjectMapper as static constant to avoid repeated instantiation.#4330
eric666666 wants to merge 2 commits intoapache:masterfrom
eric666666:FLINK-39300

Conversation

@eric666666
Copy link

What is the purpose of the change

This PR addresses FLINK-39300.

Jackson's ObjectMapper is expensive to instantiate (triggers reflection-based
module discovery and codec registry initialization), yet it is thread-safe once
configured. Two classes in the MySQL CDC connector were unnecessarily creating
new ObjectMapper instances on every method call:

  • BinlogOffsetSerializer: both serialize() and deserialize() created new instances
  • OnlineSchemaChangeUtils: both isOnLineSchemaChangeEvent() and parseOnLineSchemaRenameEvent() created new instances

This PR extracts ObjectMapper into a shared private static final constant in
each class to eliminate repeated instantiation overhead.

@eric666666
Copy link
Author

/retest

@eric666666 eric666666 closed this Mar 24, 2026
@eric666666 eric666666 reopened this Mar 24, 2026
@eric666666
Copy link
Author

The test failure TransformE2eITCase#testWildcardWithMetadataColumnTransform is a flaky E2E test caused by waitUntilSpecificEvent timeout in the CI environment. It is unrelated to this PR's changes, which only refactor
ObjectMapper as a static constant in BinlogOffsetSerializer and OnlineSchemaChangeUtils. Please re-run the CI.
@yuxiqian Please help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant