-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
types: MySQL compatible JSON object #57843
base: master
Are you sure you want to change the base?
Conversation
By changing how we order keys in a JSON object we can make TiDB more compatible with MySQL With this PR: TiDB: ``` mysql-8.0.11-TiDB-v8.5.0-alpha-210-gec8b81b98e-dirty> SELECT j, MD5(j) FROM t1; +-----------------------------+----------------------------------+ | j | MD5(j) | +-----------------------------+----------------------------------+ | {"b": 1, "aa": 1, "aaa": 1} | bebcc335a94996f7b47af552fb432d93 | +-----------------------------+----------------------------------+ 1 row in set (0.00 sec) ``` MySQL: ``` mysql-9.1.0> SELECT j, MD5(j) FROM t1; +-----------------------------+----------------------------------+ | j | MD5(j) | +-----------------------------+----------------------------------+ | {"b": 1, "aa": 1, "aaa": 1} | bebcc335a94996f7b47af552fb432d93 | +-----------------------------+----------------------------------+ 1 row in set (0.00 sec) ```
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @dveeden. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
@dveeden: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
By changing how we order keys in a JSON object we can make TiDB more compatible with MySQL
MySQL:
TiDB, Without this PR:
TiDB, With this PR:
What problem does this PR solve?
Issue Number: close 8000 #57842
Problem Summary:
See also pingcap/tidb-tools#830
For
sync-diff-inspector
it currently fails table checks for most slightly more complex JSON data as the checksums don't match. Then whenexport-fix-sql
is set totrue
it will compare the actual data by doing a unmarshal/marshal on the JSON data so that comparing works as expected.This PR makes it so that the checksum would match in a much larger set of cases, avoiding the need for comparing the values which takes more memory, CPU and network bandwidth.
The drawback of this is that this now takes more resources when outputting JSON objects. We could put this new behavior behind a variable if needed.
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.