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_TRX can not parse CURRENT_SQL_DIGEST_TEXT where use two tidb #27058

Closed
vivid392845427 opened this issue Aug 10, 2021 · 2 comments
Closed
Labels
sig/transaction SIG:Transaction type/question The issue belongs to a question. type/stale This issue has not been updated for a long time.

Comments

@vivid392845427
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t;
create table t (a int primary key, b int);
insert into t values (1, 10), (2, 20), (3, 30);
/* tidb0 / begin;
/
tidb0 / update t set b=11 where a =1;
/
tidb1 session1*/ update t set b=12 where a =1; ---block
/* tidb1 session2*/ select * from TIDB_TRX\G ---check result

2. What did you expect to see? (Required)

parse CURRENT_SQL_DIGEST and CURRENT_SQL_DIGEST_TEXT correctly;

3. What did you see instead (Required)

parse CURRENT_SQL_DIGEST correctly, but CURRENT_SQL_DIGEST_TEXT is null,as follow:

mysql> select * from TIDB_TRX\G
*************************** 1. row ***************************
ID: 426921474408841217
START_TIME: 2021-08-10 06:16:21.064000
CURRENT_SQL_DIGEST: 3b491f15bc52ff182a37547ba0ccb3103f658e6d7935303836017fbf5cc0c75c
CURRENT_SQL_DIGEST_TEXT: NULL
STATE: Committing
WAITING_START_TIME: NULL
MEM_BUFFER_KEYS: 1
MEM_BUFFER_BYTES: 29
SESSION_ID: 7
USER: root
DB: test
ALL_SQL_DIGESTS: ["3b491f15bc52ff182a37547ba0ccb3103f658e6d7935303836017fbf5cc0c75c"]
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

Release Version: v5.2.0-alpha-562-ge539f9d62
Edition: Community
Git Commit Hash: e539f9d
Git Branch: master
UTC Build Time: 2021-08-09 11:35:07
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@vivid392845427 vivid392845427 added type/bug The issue is confirmed as a bug. sig/transaction SIG:Transaction labels Aug 10, 2021
@MyonKeminta
Copy link
Contributor

This is an expected behavior on our current implementation.

  • information_schema.tidb_trx internally uses statements_summary and statements_summary_history tables to retrieve the current_sql_digest_text information, so it only access only the current TIDB node to retrieve current_sql_digest_text information. cluster_statements_summary and cluster_statements_summary_history is not used, in order to reduce the overhead.
  • Currently, only statements that has been finished will be collected to statement summary tables.

So in this case, the tidb1 executes the statement "update t set b=12 where a =1;" for the first time and has not yet finished. At this time, it's expected that we cannot get the SQL digest text on this node.

@cfzjywxk cfzjywxk added type/question The issue belongs to a question. and removed type/bug The issue is confirmed as a bug. severity/major labels Aug 23, 2021
@jebter
Copy link

jebter commented Jun 6, 2024

The issue has not been updated for too long, so I will close it. If there are any updates, you can reopen it.

@jebter jebter closed this as completed Jun 6, 2024
@jebter jebter added the type/stale This issue has not been updated for a long time. label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/transaction SIG:Transaction type/question The issue belongs to a question. type/stale This issue has not been updated for a long time.
Projects
None yet
Development

No branches or pull requests

5 participants