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

tidb_row_checksum(): Update docs #17633

Merged
merged 5 commits into from
May 31, 2024
Merged

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented May 27, 2024

What is changed, added or deleted? (Required)

  1. The statement in the example had syntax errors
  2. The variable docs didn't link to the function

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

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v8.2 (TiDB 8.2 versions)
  • v8.1 (TiDB 8.1 versions)
  • v8.0 (TiDB 8.0 versions)
  • v7.6 (TiDB 7.6 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)
  • v5.3 (TiDB 5.3 versions)
  • v5.2 (TiDB 5.2 versions)
  • v5.1 (TiDB 5.1 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 27, 2024
@dveeden
Copy link
Contributor Author

dveeden commented May 27, 2024

This doesn't fix all issues:

For me the example returns NULL instead of the checksum:

sql> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v8.1.0
Edition: Community
Git Commit Hash: 945d07c5d5c7a1ae212f6013adfb187f2de24b23
Git Branch: HEAD
UTC Build Time: 2024-05-21 03:51:57
GoVersion: go1.21.10
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.0011 sec)

sql> SET GLOBAL tidb_enable_row_level_checksum = ON;
Query OK, 0 rows affected (0.0223 sec)

sql> USE test;
Default schema set to `test`.
Fetching global names, object names from `test` for auto-completion... Press ^C to stop.

sql> CREATE TABLE t (id INT PRIMARY KEY, k INT, c CHAR(1));
Query OK, 0 rows affected (0.1103 sec)

sql> INSERT INTO t values (1, 10, 'a');
Query OK, 1 row affected (0.0045 sec)

sql> SELECT *, TIDB_ROW_CHECKSUM() FROM t WHERE id = 1;
+----+----+---+---------------------+
| id | k  | c | TIDB_ROW_CHECKSUM() |
+----+----+---+---------------------+
|  1 | 10 | a | NULL                |
+----+----+---+---------------------+
1 row in set (0.0014 sec)
  1. I don't think the "FastPlan" that is mentioned here is documented well enough.

Is "FastPlan" a generic term for PointGet and TableDual and Set?

https://github.com/pingcap/tidb/blob/df64c343ddfc4063891900acf95e2b3640c79f29/pkg/executor/adapter.go#L398-L417

@dveeden
Copy link
Contributor Author

dveeden commented May 27, 2024

Looks like a re-connect is needed for this to work:

dvaneeden@dve-carbon:~$ mysqlsh mysql://root@127.0.0.1:4000/test

sql> SHOW GLOBAL VARIABLES LIKE 'tidb_enable_row_level_checksum';
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| tidb_enable_row_level_checksum | OFF   |
+--------------------------------+-------+
1 row in set (0.0009 sec)

sql> SHOW SESSION VARIABLES LIKE 'tidb_enable_row_level_checksum';
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| tidb_enable_row_level_checksum | OFF   |
+--------------------------------+-------+
1 row in set (0.0013 sec)

sql> SET GLOBAL tidb_enable_row_level_checksum = ON;
Query OK, 0 rows affected (0.0186 sec)

sql> SHOW GLOBAL VARIABLES LIKE 'tidb_enable_row_level_checksum';
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| tidb_enable_row_level_checksum | ON    |
+--------------------------------+-------+
1 row in set (0.0014 sec)

sql> SHOW SESSION VARIABLES LIKE 'tidb_enable_row_level_checksum';
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| tidb_enable_row_level_checksum | ON    |
+--------------------------------+-------+
1 row in set (0.0015 sec)

sql> USE test;
Default schema set to `test`.
Fetching global names, object names from `test` for auto-completion... Press ^C to stop.

sql> CREATE TABLE t (id INT PRIMARY KEY, k INT, c CHAR(1));
Query OK, 0 rows affected (0.1069 sec)

sql> INSERT INTO t values (1, 10, 'a');
Query OK, 1 row affected (0.0124 sec)

sql> SELECT *, TIDB_ROW_CHECKSUM() FROM t WHERE id = 1;
+----+----+---+---------------------+
| id | k  | c | TIDB_ROW_CHECKSUM() |
+----+----+---+---------------------+
|  1 | 10 | a | NULL                |
+----+----+---+---------------------+
1 row in set (0.0016 sec)

sql> 
Bye!
dvaneeden@dve-carbon:~$ mysqlsh mysql://root@127.0.0.1:4000/test

sql> SELECT *, TIDB_ROW_CHECKSUM() FROM t WHERE id = 1;
+----+----+---+---------------------+
| id | k  | c | TIDB_ROW_CHECKSUM() |
+----+----+---+---------------------+
|  1 | 10 | a | NULL                |
+----+----+---+---------------------+
1 row in set (0.0016 sec)

sql> delete from t;
Query OK, 1 row affected (0.0038 sec)

sql> INSERT INTO t values (1, 10, 'a');
Query OK, 1 row affected (0.0112 sec)

sql> SELECT *, TIDB_ROW_CHECKSUM() FROM t WHERE id = 1;
+----+----+---+---------------------+
| id | k  | c | TIDB_ROW_CHECKSUM() |
+----+----+---+---------------------+
|  1 | 10 | a | 3813955661          |
+----+----+---+---------------------+
1 row in set (0.0018 sec)

sql> 

@dveeden
Copy link
Contributor Author

dveeden commented May 27, 2024

I'm not sure if the intended use of this function is clearly described. Is this only for TiCDC? Or is this also useful in other cases? How does this relate to ADMIN CHECKSUM TABLE?

Copy link

ti-chi-bot bot commented May 29, 2024

@3AceShowHand: 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.

system-variables.md Outdated Show resolved Hide resolved
@hfxsd hfxsd added the needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. label May 31, 2024
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
@hfxsd hfxsd added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed missing-translation-status This PR does not have translation status info. labels May 31, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label May 31, 2024
Copy link
Collaborator

@Oreoxmt Oreoxmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

system-variables.md Outdated Show resolved Hide resolved
functions-and-operators/tidb-functions.md Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 31, 2024
Copy link

ti-chi-bot bot commented May 31, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-31 06:01:31.484356613 +0000 UTC m=+3015445.241492178: ☑️ agreed by hfxsd.
  • 2024-05-31 06:25:44.200848852 +0000 UTC m=+3016897.957984425: ☑️ agreed by Oreoxmt.

dveeden and others added 2 commits May 31, 2024 08:38
Co-authored-by: Aolin <aolinz@outlook.com>
Co-authored-by: Aolin <aolinz@outlook.com>
@hfxsd
Copy link
Collaborator

hfxsd commented May 31, 2024

/approve

Copy link

ti-chi-bot bot commented May 31, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hfxsd

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 ti-chi-bot bot added the approved label May 31, 2024
@ti-chi-bot ti-chi-bot bot merged commit 3146fc9 into pingcap:master May 31, 2024
9 checks passed
@ti-chi-bot
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants