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

Canal '\n, \t' problem in mysql json type #3110

Closed
2 tasks done
zherenyu831 opened this issue Oct 26, 2020 · 7 comments
Closed
2 tasks done

Canal '\n, \t' problem in mysql json type #3110

zherenyu831 opened this issue Oct 26, 2020 · 7 comments
Assignees
Labels
Milestone

Comments

@zherenyu831
Copy link

zherenyu831 commented Oct 26, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

environment

  • canal version 1.1.4
  • mysql version 5.6

Issue Description

We got a problem with json type in mysql with '\\n, \\t'
Canal will parse them '\\n, \\t' to ''\n, \t''. which is different with the content in mysql

我们发现canal 会把 mysql的 json type 里的 '\\n, \\t' 转成 '\n, \t'
这样会导致数据不一致

Steps to reproduce

Expected behaviour

Actual behaviour

If there is an exception, please attach the exception trace:

Just put your stack trace here!
@lucien-paypay
Copy link

canal在把Json格式的数据发向下游message的时候,没有对数据进行json-string的相应转义。致使其发送的message(string类型)不是一个合法的json-string

这是一个合法的json string:

{"key":"va\nlue"}

这不是一个合法的json string,(然而Canal在发送这种形式的message)

{"key":"va
lue"}

@kk17
Copy link

kk17 commented Oct 28, 2020

We encountered this issue too. Does anybody know how to fix it?

@lucien-paypay
Copy link

@kk17 we solved it on our own by replacing all special characters in message by its corresponding escaped string.

@kk17
Copy link

kk17 commented Oct 28, 2020

@kk17 we solved it on our own by replacing all special characters in message by its corresponding escaped string.

Do you do this before parsing the JSON data?

@lucien-paypay
Copy link

@kk17 we solved it on our own by replacing all special characters in message by its corresponding escaped string.

Do you do this before parsing the JSON data?

Yes, sure, otherwise it isn't parsable.

@agapple
Copy link
Member

agapple commented Apr 16, 2021

我看了最新的代码已经是对\n添加了转义,可以测试下最新的1.1.5

@agapple agapple closed this as completed Apr 16, 2021
agapple added a commit that referenced this issue Apr 19, 2021
@agapple agapple self-assigned this Apr 19, 2021
@agapple agapple added the bug label Apr 19, 2021
@agapple agapple added this to the v1.1.5 milestone Apr 19, 2021
@15898317421
Copy link

我看了最新的代码已经是对\n添加了转义,可以测试下最新的1.1.5

请问是哪里的代码?目前使用otter里面存在这个问题

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

No branches or pull requests

5 participants