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

ddl operation triggers the implicit commit,user prompt message unfriendly and miss log:NewTxn() inside a transaction auto commit #24589

Open
vivid392845427 opened this issue May 12, 2021 · 1 comment
Labels
severity/minor sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@vivid392845427
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

1、do some transaction operation

mysql> create table t(a int, b varchar(20), primary key(a,b(3)));
ERROR 1105 (HY000): tikv aborts txn: Txn(Mvcc(PessimisticLockNotFound { start_ts: TimeStamp(424884930163769345), key: [116, 128, 0, 0, 0, 0, 0, 27, 42, 95, 105, 128, 0, 0, 0, 0, 0, 0, 1, 3, 128, 0, 0, 0, 0, 0, 0, 1, 1, 103, 114, 101, 97, 116, 32, 109, 101, 255, 0, 0, 0, 0, 0, 0, 0, 0, 247] }))
mysql> create table t(a int, b varchar(20), primary key(a,b(3)));
Query OK, 0 rows affected (0.12 sec)

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

create table sucess,as follows
mysql> create table t(a int, b varchar(20), primary key(a,b(3)));
Query OK, 0 rows affected (0.12 sec)

3. What did you see instead (Required)

create table fail,as follows
mysql> create table t(a int, b varchar(20), primary key(a,b(3)));
ERROR 1105 (HY000): tikv aborts txn: Txn(Mvcc(PessimisticLockNotFound { start_ts: TimeStamp(424884930163769345), key: [116, 128, 0, 0, 0, 0, 0, 27, 42, 95, 105, 128, 0, 0, 0, 0, 0, 0, 1, 3, 128, 0, 0, 0, 0, 0, 0, 1, 1, 103, 114, 101, 97, 116, 32, 109, 101, 255, 0, 0, 0, 0, 0, 0, 0, 0, 247] }))

then check the log,has no log :NewTxn() inside a transaction auto commit
[2021/05/12 08:46:29.137 +00:00] [INFO] [gc_worker.go:1531] ["[gc worker] sent safe point to PD"] [uuid=5e56bb02384000c] ["safe point"=424884930163769345]
[2021/05/12 08:47:49.771 +00:00] [INFO] [client_batch.go:791] ["recycle idle connection"] [target=172.16.4.202:10162]
[2021/05/12 08:47:49.772 +00:00] [INFO] [client_batch.go:791] ["recycle idle connection"] [target=172.16.4.202:10161]
[2021/05/12 08:54:41.146 +00:00] [INFO] [session.go:2764] ["CRUCIAL OPERATION"] [conn=2933] [schemaVersion=6930] [cur_db=zy] [sql="create table t(a int, b varchar(20), primary key(a,b(3)))"] [[email protected]]
[2021/05/12 08:54:41.160 +00:00] [WARN] [snapshot.go:641] ["2PC failed"] [error="tikv aborts txn: Txn(Mvcc(PessimisticLockNotFound { start_ts: TimeStamp(424884930163769345), key: [116, 128, 0, 0, 0, 0, 0, 27, 42, 95, 105, 128, 0, 0, 0, 0, 0, 0, 1, 3, 128, 0, 0, 0, 0, 0, 0, 1, 1, 103, 114, 101, 97, 116, 32, 109, 101, 255, 0, 0, 0, 0, 0, 0, 0, 0, 247] }))"]
[2021/05/12 08:54:41.161 +00:00] [WARN] [session.go:549] ["can not retry txn"] [conn=2933] [label=general] [error="tikv aborts txn: Txn(Mvcc(PessimisticLockNotFound { start_ts: TimeStamp(424884930163769345), key: [116, 128, 0, 0, 0, 0, 0, 27, 42, 95, 105, 128, 0, 0, 0, 0, 0, 0, 1, 3, 128, 0, 0, 0, 0, 0, 0, 1, 1, 103, 114, 101, 97, 116, 32, 109, 101, 255, 0, 0, 0, 0, 0, 0, 0, 0, 247] }))"] [IsBatchInsert=false] [IsPessimistic=true] [InRestrictedSQL=false] [tidb_retry_limit=10] [tidb_disable_txn_auto_retry=true]
[2021/05/12 08:54:41.161 +00:00] [WARN] [session.go:564] ["commit failed"] [conn=2933] ["finished txn"="Txn{state=invalid}"] [error="tikv aborts txn: Txn(Mvcc(PessimisticLockNotFound { start_ts: TimeStamp(424884930163769345), key: [116, 128, 0, 0, 0, 0, 0, 27, 42, 95, 105, 128, 0, 0, 0, 0, 0, 0, 1, 3, 128, 0, 0, 0, 0, 0, 0, 1, 1, 103, 114, 101, 97, 116, 32, 109, 101, 255, 0, 0, 0, 0, 0, 0, 0, 0, 247] }))"]
[2021/05/12 08:54:41.161 +00:00] [INFO] [tidb.go:242] ["rollbackTxn for ddl/autocommit failed"]
[2021/05/12 08:54:41.161 +00:00] [WARN] [session.go:1429] ["run statement failed"] [conn=2933] [schemaVersion=6930] [error="tikv aborts txn: Txn(Mvcc(PessimisticLockNotFound { start_ts: TimeStamp(424884930163769345), key: [116, 128, 0, 0, 0, 0, 0, 27, 42, 95, 105, 128, 0, 0, 0, 0, 0, 0, 1, 3, 128, 0, 0, 0, 0, 0, 0, 1, 1, 103, 114, 101, 97, 116, 32, 109, 101, 255, 0, 0, 0, 0, 0, 0, 0, 0, 247] }))"] [session="{\n "currDBName": "zy",\n "id": 2933,\n "status": 2,\n "strictMode": true,\n "user": {\n "Username": "root",\n "Hostname": "127.0.0.1",\n "CurrentUser": false,\n "AuthUsername": "root",\n "AuthHostname": "%"\n }\n}"]

4. What is your TiDB version? (Required)

Release Version: v5.0.1
Edition: Community
Git Commit Hash: 1145e34
Git Branch: heads/refs/tags/v5.0.1
UTC Build Time: 2021-04-23 05:51:17
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@vivid392845427 vivid392845427 added the type/bug The issue is confirmed as a bug. label May 12, 2021
@cfzjywxk
Copy link
Contributor

Related to #24591.
The ddl operation commit the last transaction implicitly and the commit failed. The problem is that the error message is confusing for the user, maybe it's needed to make the error information more understandable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants