-
Notifications
You must be signed in to change notification settings - Fork 188
Support converting unsupported collation to TiDB supported collation or skip the schema creation #1354
Comments
Sounds great. currently DM will stop at that error so user can use Could you give an exmaple about how this configuration looks like in task configuration? |
Hello @lance6716, from what I saw in the code and what I observed from my tests, Lines 679 to 683 in 1e9a094
I think the configuration could be under # ----------- Global setting -----------
## ********* Basic configuration *********
name: test # The name of the task. Should be globally unique.
task-mode: all # The task mode. Can be set to `full`/`incremental`/`all`.
# Other configurations here...
force-utf8-collation: general_ci # The collation to force convert to, only applicable to `utf8`/`utf8mb4` character sets. Available collations are `bin`/`general_ci`(only if `new_collations_enabled_on_first_bootstrap` is enabled)
skip-schema-restoration: true # Weather to skip the schema restoration. It only takes effect in `all` task mode I feel it's good to have the option to allow users to skip the schema restoration, which enables users to have full control of the schema creation if needed. |
You can manually create schemas in TiDB now, DM will skip the |
Hello @GMHDBJD, from what I saw it doesn't actually skip it, here are some related logs:
It still executes the statements even though the table exists. The error is skippable if the collation used in the table is supported. However, if the collation is not supported, the execution will fail with another error It seems the If DM can check the table existence at first and skip the creation when it exists, then I believe the |
Hello @GMHDBJD @lance6716, any other concern regarding this issue? Do we have a consensus here about what should be implemented? |
sorry for the inconvenience. This is may because we didn't rewrite CREATE TABLE statement to CREATE TABLE IF NOT EXISTS (we use a filter to skip "table already exists" errors but didn't work well). Could you help check that such a rewriting could provide a workaround in dump & load phase? and welcome to help us implement it or let TiDB report "table already exists" not "Unsupported collation" we're planning some character set related feature in this sprint, still not decide yet. We'll request your kindly help to implement this collation feature some days later 😄 |
@lance6716 Actually the I've bypassed this issue with lots of hacks anyway 😂 . Lemme know when you decide how to tackle this and I'm ready to help 😃 |
Hi, @namco1992 . The following advice may help you.
I prefer the 4th solution, because it is simple, effective and less configuration. What's your opinion? Any contribution will be appreciated. |
Hello @GMHDBJD, I think 4th solution is good for me, to summarize:
If we all agree on this flow then I can start to work on it. Thanks! |
@namco1992 LGTM, and for incremental phase, function |
Hi, do you need some help to implement this @namco1992 |
Hello @lance6716, sorry for dragging too long about this issue. I was busy with work stuff. However, I noticed that TiDB supported But I will still work on it as there are still many other collations that can cause this error. I will try to create a PR by this week if it's not too late, thanks! |
Take your time, and if you need some help you could comment here or join sig-migrate in slack |
Feature Request
Is your feature request related to a problem? Please describe:
TiDB doesn't support
_unicode_ci
, however, this is a common collation that is widely used. Currently, DM can't handle the schemas with_unicode_ci
as the schema creation will fail. The schema creation can't be bypassed, too.Describe the feature you'd like:
_bin
and_general_ci
if new_collations_enabled_on_first_bootstrap is enabled);Teachability, Documentation, Adoption, Migration Strategy:
The auto-conversion or skip schema creation should be configured in the task configuration.
P.S. I would like to contribute this feature if it's accepted, Thanks!
The text was updated successfully, but these errors were encountered: