docs icon indicating copy to clipboard operation
docs copied to clipboard

tidb-functions: add info about special start_key/end_key values

Open dveeden opened this issue 2 years ago • 8 comments

What is changed, added or deleted? (Required)

sql> SELECT TABLE_NAME, REGION_ID, START_KEY, END_KEY FROM information_schema.TIKV_REGION_STATUS WHERE TABLE_NAME='stock' AND IS_INDEX=0;
+------------+-----------+--------------------------------------------------------+--------------------------------------------------------+
| TABLE_NAME | REGION_ID | START_KEY                                              | END_KEY                                                |
+------------+-----------+--------------------------------------------------------+--------------------------------------------------------+
| stock      |        74 | 7480000000000000FF4700000000000000F8                   | 7480000000000000FF475F728000000000FF029DF00000000000FA |
| stock      |        72 | 7480000000000000FF475F728000000000FF0D7ECA0000000000FA | 7480000000000000FF4900000000000000F8                   |
| stock      |        78 | 7480000000000000FF475F728000000000FF063E890000000000FA | 7480000000000000FF475F728000000000FF09E0350000000000FA |
| stock      |        76 | 7480000000000000FF475F728000000000FF029DF00000000000FA | 7480000000000000FF475F728000000000FF063E890000000000FA |
| stock      |        80 | 7480000000000000FF475F728000000000FF09E0350000000000FA | 7480000000000000FF475F728000000000FF0D7ECA0000000000FA |
+------------+-----------+--------------------------------------------------------+--------------------------------------------------------+
5 rows in set (0.0144 sec)

sql> SELECT TIDB_DECODE_KEY('7480000000000000FF4700000000000000F8');
+---------------------------------------------------------+
| TIDB_DECODE_KEY('7480000000000000FF4700000000000000F8') |
+---------------------------------------------------------+
| 7480000000000000FF4700000000000000F8                    |
+---------------------------------------------------------+
1 row in set, 1 warning (0.0013 sec)
Warning (code 1105): invalid record/index key: 748000000000000047

sql> SELECT TIDB_DECODE_KEY('7480000000000000FF475F728000000000FF0D7ECA0000000000FA');
+---------------------------------------------------------------------------+
| TIDB_DECODE_KEY('7480000000000000FF475F728000000000FF0D7ECA0000000000FA') |
+---------------------------------------------------------------------------+
| {"_tidb_rowid":884426,"table_id":"71"}                                    |
+---------------------------------------------------------------------------+
1 row in set (0.0013 sec)
sql> SELECT TABLE_NAME, REGION_ID, TIDB_DECODE_KEY(START_KEY) sk, TIDB_DECODE_KEY(END_KEY) ek FROM information_schema.TIKV_REGION_STATUS WHERE TABLE_NAME='stock' AND IS_INDEX=0 ORDER BY IF(JSON_VALID(sk),sk->'$."_tidb_rowid"',0);
+------------+-----------+----------------------------------------+----------------------------------------+
| TABLE_NAME | REGION_ID | sk                                     | ek                                     |
+------------+-----------+----------------------------------------+----------------------------------------+
| stock      |        74 | 7480000000000000FF4700000000000000F8   | {"_tidb_rowid":171504,"table_id":"71"} |
| stock      |        76 | {"_tidb_rowid":171504,"table_id":"71"} | {"_tidb_rowid":409225,"table_id":"71"} |
| stock      |        78 | {"_tidb_rowid":409225,"table_id":"71"} | {"_tidb_rowid":647221,"table_id":"71"} |
| stock      |        80 | {"_tidb_rowid":647221,"table_id":"71"} | {"_tidb_rowid":884426,"table_id":"71"} |
| stock      |        72 | {"_tidb_rowid":884426,"table_id":"71"} | 7480000000000000FF4900000000000000F8   |
+------------+-----------+----------------------------------------+----------------------------------------+
5 rows in set, 2 warnings (0.0133 sec)
Warning (code 1105): invalid record/index key: 748000000000000047
Warning (code 1105): invalid record/index key: 748000000000000049

Which TiDB version(s) do your changes apply to? (Required)

  • [x] master (the latest development version)
  • [x] v5.4 (TiDB 5.4 versions)
  • [x] v5.3 (TiDB 5.3 versions)
  • [x] v5.2 (TiDB 5.2 versions)
  • [ ] v5.1 (TiDB 5.1 versions)
  • [ ] v5.0 (TiDB 5.0 versions)
  • [ ] v4.0 (TiDB 4.0 versions)
  • [ ] v3.1 (TiDB 3.1 versions)
  • [ ] v3.0 (TiDB 3.0 versions)
  • [ ] v2.1 (TiDB 2.1 versions)

dveeden avatar Nov 04 '21 12:11 dveeden

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment. After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review. Reviewer can cancel approval by submitting a request changes review.

ti-chi-bot avatar Nov 04 '21 12:11 ti-chi-bot

/cc @kolbe

dveeden avatar Nov 04 '21 12:11 dveeden

@dveeden this is great, but maybe you could also submit a patch to tidb to make tidb_decode_key do something more sensible with these values 🙂

kolbe avatar Nov 04 '21 17:11 kolbe

@kolbe yes, that's my plan.

dveeden avatar Nov 04 '21 17:11 dveeden

@kolbe: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

LGTM

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 ti-community-infra/tichi repository.

ti-chi-bot avatar Nov 04 '21 19:11 ti-chi-bot

/label needs-cherry-pick-release-5.2

dveeden avatar Nov 09 '21 08:11 dveeden

/cc @morgo

dveeden avatar Jan 17 '22 09:01 dveeden

/label needs-cherry-pick-release-5.4

dveeden avatar Jan 17 '22 09:01 dveeden

Removed the needs-cherry-pick-release-6.3 label because the v6.3 docs have been archived at https://docs-archive.pingcap.com/tidb/v6.3 and will no longer receive new updates.

qiancai avatar Feb 24 '23 11:02 qiancai

Removed the needs-cherry-pick-release-6.4 label because the v6.4 docs have been archived at https://docs-archive.pingcap.com/tidb/v6.4 and will no longer receive new updates.

qiancai avatar Apr 06 '23 07:04 qiancai

Removed the needs-cherry-pick-release-6.6 label because the v6.6 docs have been archived at https://docs-archive.pingcap.com/tidb/v6.6 and will no longer receive new updates.

qiancai avatar Jul 07 '23 06:07 qiancai

@mjonss: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

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.

ti-chi-bot[bot] avatar Nov 20 '23 09:11 ti-chi-bot[bot]

[LGTM Timeline notifier]

Timeline:

  • 2023-11-29 03:37:43.171066764 +0000 UTC m=+980291.836292958: :ballot_box_with_check: agreed by Oreoxmt.
  • 2023-11-30 07:24:19.746465569 +0000 UTC m=+1080288.411691765: :ballot_box_with_check: agreed by ran-huang.

ti-chi-bot[bot] avatar Nov 30 '23 07:11 ti-chi-bot[bot]

/approve

Oreoxmt avatar Dec 06 '23 01:12 Oreoxmt

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Oreoxmt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

ti-chi-bot[bot] avatar Dec 06 '23 01:12 ti-chi-bot[bot]

In response to a cherrypick label: new pull request created to branch release-7.1: #15604.

ti-chi-bot avatar Dec 06 '23 01:12 ti-chi-bot

In response to a cherrypick label: new pull request created to branch release-7.5: #15605.

ti-chi-bot avatar Dec 06 '23 01:12 ti-chi-bot

/assign

RobertCheng-956 avatar Dec 25 '23 14:12 RobertCheng-956

/translation done

RobertCheng-956 avatar Jan 11 '24 05:01 RobertCheng-956

/remove-translation welcome

RobertCheng-956 avatar Jan 11 '24 05:01 RobertCheng-956