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

PT-2377 - fixed pt-table-sync for JSON utf8 strings #861

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

hpoettker
Copy link

The PR is intended to resolve this issue: https://perconadev.atlassian.net/browse/PT-2377

The tests added with pt-2377.t both fail with the current code base as they do not generate the expected DML statements with non-ASCII characters correctly. With the proposed change, they run successfully. They test that both REPLACE and UPDATE statements are generated correctly by pt-table-sync when applied to tables with JSON columns that contain non-ASCII characters.

The code is my own creation and it can be distributed under the GPL2 licence.

  • The contributed code is licensed under GPL v2.0
  • Contributor Licence Agreement (CLA) is signed
  • util/update-modules has been ran
  • Documentation updated
  • Test suite update

@hpoettker
Copy link
Author

I updated the PR such that the change is also included in lib/ChangeHandler.pm. pt-table-sync is the only affected tool by this change.

@hpoettker hpoettker force-pushed the PT-2377_table_sync_with_utf8_json branch 2 times, most recently from 4acec07 to fc9987d Compare September 16, 2024 00:13
The MySQL driver DBD::mysql does not decode JSON values as utf8
although MySQL uses utf8mb4 for all JSON strings.

This change decodes JSON values as utf8 (when not already done)
such that SQL statements are generated correctly.
@hpoettker hpoettker force-pushed the PT-2377_table_sync_with_utf8_json branch from fc9987d to 263404d Compare October 11, 2024 12:35
@hpoettker
Copy link
Author

I adjusted the added code to also handle NULL values in the JSON columns correctly. Previously, they led to errors due to the use of an uninitialized values.

The unit test for ChangeHandler.t now also tests the correct behavior for NULL values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant