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

TiCDC misses backslash(\) when replicating ddl to downstream #7142

Closed
CbcWestwolf opened this issue Sep 20, 2022 · 4 comments
Closed

TiCDC misses backslash(\) when replicating ddl to downstream #7142

CbcWestwolf opened this issue Sep 20, 2022 · 4 comments

Comments

@CbcWestwolf
Copy link
Member

What did you do?

This is a bug found in tidb issue.

  1. Set sql mode in both upstream and downstream tidbs
-- downstream
set sql_mode = "NO_BACKSLASH_ESCAPES";
set global  sql_mode = "NO_BACKSLASH_ESCAPES";

-- upstream
set sql_mode = "NO_BACKSLASH_ESCAPES";
set global  sql_mode = "NO_BACKSLASH_ESCAPES";
  1. Create a changefeed to start a replication

-- upstream
create table t20(id bigint primary key, a text, b text as ((regexp_replace(a, "^[1-9]\d{9,29}$", "aaaaa"))), c text as ((regexp_substr(a, "^[1-9]\d{9,29}$"))), d text as ((regexp_like(a, "^[1-9]\d{9,29}$"))), e text as ((regexp_instr(a, "^[1-9]\d{9,29}$"))));
-- downstream
show create table t20;

What did you expect to see?

| t20   | CREATE TABLE `t20` (
  `id` bigint(20) NOT NULL,
  `a` text DEFAULT NULL,
  `b` text GENERATED ALWAYS AS ((regexp_replace(`a`, _utf8'^[1-9]\\d{9,29}$', _utf8'aaaaa'))) VIRTUAL,
  `c` text GENERATED ALWAYS AS ((regexp_substr(`a`, _utf8'^[1-9]\\d{9,29}$'))) VIRTUAL,
  `d` text GENERATED ALWAYS AS ((regexp_like(`a`, _utf8'^[1-9]\\d{9,29}$'))) VIRTUAL,
  `e` text GENERATED ALWAYS AS ((regexp_instr(`a`, _utf8'^[1-9]\\d{9,29}$'))) VIRTUAL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |

What did you see instead?

| t20   | CREATE TABLE `t20` (
  `id` bigint(20) NOT NULL,
  `a` text DEFAULT NULL,
  `b` text GENERATED ALWAYS AS ((regexp_replace(`a`, _utf8mb4'^[1-9]d{9,29}$', _utf8mb4'aaaaa'))) VIRTUAL,
  `c` text GENERATED ALWAYS AS ((regexp_substr(`a`, _utf8mb4'^[1-9]d{9,29}$'))) VIRTUAL,
  `d` text GENERATED ALWAYS AS ((regexp_like(`a`, _utf8mb4'^[1-9]d{9,29}$'))) VIRTUAL,
  `e` text GENERATED ALWAYS AS ((regexp_instr(`a`, _utf8mb4'^[1-9]d{9,29}$'))) VIRTUAL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |

Versions of the cluster

You can reproduce it using tiup playground nightly --db 1 --kv 1 --tiflash 0 --ticdc 1 (upstream)
and tiup playground nightly --db 1 --kv 1 --tiflash 0 (downstream)

@CbcWestwolf CbcWestwolf added area/ticdc Issues or PRs related to TiCDC. type/bug The issue is confirmed as a bug. labels Sep 20, 2022
@fubinzh
Copy link

fubinzh commented Sep 22, 2022

/severity Major

@hongyunyan
Copy link
Collaborator

From v7.5, we can set corresponding sql_mode in changefeed config to avoid this problem.

@hongyunyan
Copy link
Collaborator

This is related PR: #9941

@CbcWestwolf
Copy link
Member Author

Since there is a solution, I will close this issue now.

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

No branches or pull requests

6 participants