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 的 json compare 不正确 #606

Closed
Dieken opened this issue Mar 18, 2022 · 3 comments · Fixed by #674
Closed

sync_diff_inspector 的 json compare 不正确 #606

Dieken opened this issue Mar 18, 2022 · 3 comments · Fixed by #674

Comments

@Dieken
Copy link

Dieken commented Mar 18, 2022

https://github.com/pingcap/tidb-tools/blob/master/sync_diff_inspector/utils/utils.go#L535

mysql 按照 key length 排序然后再按词典序,tidb 按照词典序排序,看起来这个地方把 json 解析再序列化下就可以比对了。

func CompareData(map1, map2 map[string]*dbutil.ColumnData, orderKeyCols, columns []*model.ColumnInfo) (equal bool, cmp int32, err error) {

image

@3pointer
Copy link
Contributor

It's hard to compare json field cause we lost the information of column field. so we cannot do de-serialize here.
For now, you can ignore json field in config.

@Dieken
Copy link
Author

Dieken commented Apr 20, 2022

It's hard to compare json field cause we lost the information of column field. so we cannot do de-serialize here.
For now, you can ignore json field in config.

你是说对于 json column,其 column.FieldType 并不是 JSON 所以没法对它按照 JSON 反序列化?

忽略 JSON 列的话 sync_diff_inspector 的结果就失去意义了。。。

@dveeden
Copy link
Contributor

dveeden commented Jul 22, 2022

I think wa can consider this a duplicate of #350

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

Successfully merging a pull request may close this issue.

3 participants