v18 backport: Online DDL: avoid SQL's CONVERT(...), convert programmatically if needed#16604
Merged
shlomi-noach merged 1 commit intorelease-18.0from Aug 15, 2024
Merged
Conversation
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Contributor
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
CONVERT(...), convert programmatically if neededCONVERT(...), convert programmatically if needed
rohit-nayak-ps
approved these changes
Aug 15, 2024
mattlord
approved these changes
Aug 15, 2024
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.
Manual backport of #16597 to release-18.0
(bot is not working)
Description
Fixes #16023
We have a clear picture and a fix to #16023. The original reason why we needed
convert()in the first place is thatvreplicationandvstreamerboth issue aSET NAMES binary. We will want to change that in the future, but this PR in the meantime confirms to thebinaryconnection charset.So we used
convert()to turn textual values intoutf8mb4. On the other side,vplayeris reading events from the binary log. It used programmatic conversion (charset.Convert()) of the data toutf8mb4to align withvcopier.What we are doing now:
convert(), solving the sorting issue described in Bug Report: OnlineDDL PK conversion results in table scans #16023 (comment)vcopierread data, We do introduce programmatic conversion of non-utf columns into their designated charsets.vplayer, we do not convert at all if both source and target have same charsetvplayer, we do apply programmatic conversion of non-utf columns into their designated charsets, in a similar logic as forvcopier.charset.Convert()error, we translate it intoERROR 1366("Incorrect string value ..."), which is a terminal error in vreplication, and so the migration bails out as soon as that happens. This can happen if e.g. we're converting a UTF column into ASCII and the UTF column contains a smiley emoji.Because we do not convert the original charset to
utf8mb4, we get to programmatically convert it to the specific target column. Previously (and this is perhaps the last piece of magic I have not digged into yet, and again likely to be caused by thebinarycharset) we did not need to convert into the target charset.All the tests remain the same, and we introduce a couple new ones.
Related Issue(s)
Backport
I wish to backport this to all supported versions, seeing that this is a bugfix: without this fix some migrations will slow down to a near halt.
Checklist
Deployment Notes