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

sync-diff-inspector: output binary column in hex form (x'ABCDEF') #807

Closed
mzhang77 opened this issue Jun 21, 2024 · 2 comments · Fixed by #809
Closed

sync-diff-inspector: output binary column in hex form (x'ABCDEF') #807

mzhang77 opened this issue Jun 21, 2024 · 2 comments · Fixed by #809

Comments

@mzhang77
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    In mysql:
create table tb(a int, b binary(16) primary key);
insert into tb(a,b) values(1,0xBF500C00A2034521B819D6EB7065D200);

In tidb:

create table tb(a int, b binary(16) primary key);
insert into tb(a,b) values(2,0xBF500C00A2034521B819D6EB7065D200);

Now run sync_diff_inspector.

  1. What did you expect to see?
REPLACE INTO `test`.`tb`(`a`,`b`) VALUES (1,0xBF500C00A2034521B819D6EB7065D200);
  1. What did you see instead?
$ cat test\:tb\:0\:0-0\:0.sql 
-- table: test.tb
-- range in sequence: Full
/*
  DIFF COLUMNS ╏ `A`  
╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍
  source data  ╏ 1    
╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍
  target data  ╏ 2    
╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍
*/
REPLACE INTO `test`.`tb`(`a`,`b`) VALUES (1,'?P
                                               ?E!???pe?');
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    NA
  2. which tool are you using?
    NA
  3. what versionof tool are you using (pump -V or tidb-lightning -V or syncer -V)?
$ sync_diff_inspector -V
App Name: sync_diff_inspector v2.0
Release Version: v6.5.3
Git Commit Hash: 89b804103994cd63273fa9e57e71f270b1a42fcc
Git Branch: heads/refs/tags/v6.5.3
UTC Build Time: 2023-06-05 07:19:58
Go Version: go1.20.3
@mzhang77 mzhang77 changed the title sync-diff-inspector: not able t handle binary column sync-diff-inspector: not able to handle binary column Jun 21, 2024
@D3Hunter
Copy link

the fix sql is correct, but not human friendly, to run the sql in mysql-client, must add --binary-mode

@kennytm
Copy link
Contributor

kennytm commented Jun 28, 2024

I'm reopening this as an enhancement request. If a column is known to be varbinary or blob, sync-diff-inspector should be able to hex-encode the value.

@kennytm kennytm reopened this Jun 28, 2024
@kennytm kennytm changed the title sync-diff-inspector: not able to handle binary column sync-diff-inspector: output binary column in hex form (x'ABCDEF') Jun 28, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in #809 Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants