【 TiDB 使用环境】测试环境
【 TiDB 版本】v7.1.0
【复现路径】执行以下sql
“SELECT * FROM " + table_name + " WHERE obj_key=? FOR UPDATE”
INSERT INTO " + table_name + " VALUES(?,?) ON DUPLICATE KEY UPDATE obj_value = ?
【遇到的问题:问题现象及影响】
性能很差,查看tidb日志有大量如下报错:
[2023/11/07 10:38:06.078 +08:00] [ERROR] [2pc.go:700] [“commit failed”] [session=6550030460196536895] [error=“try to commit with invalid txnStartTS: 18446744073709551615”]
[2023/11/07 10:38:06.078 +08:00] [WARN] [session.go:967] [“can not retry txn”] [label=general] [error=“try to commit with invalid txnStartTS: 18446744073709551615”] [IsBatchInsert=false] [IsPessimistic=false] [InRestrictedSQL=false] [tidb_retry_limit=10] [tidb_disable_txn_auto_retry=true]
[2023/11/07 10:38:06.078 +08:00] [WARN] [session.go:983] [“commit failed”] [“finished txn”=“Txn{state=invalid}”] [error=“try to commit with invalid txnStartTS: 18446744073709551615”]
[2023/11/07 10:38:06.078 +08:00] [ERROR] [terror.go:317] [“function call errored”] [error=“try to commit with invalid txnStartTS: 18446744073709551615”] [stack=“github.com/pingcap/tidb/parser/terror.Call\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/parser/terror/terror.go:317\ngithub.com/pingcap/tidb/server.(*clientConn).executePreparedStmtAndWriteResult\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn_stmt.go:357\ngithub.com/pingcap/tidb/server.(*clientConn).executePlanCacheStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn_stmt.go:226\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmtExecute\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn_stmt.go:218\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1399\ngithub.com/pingcap/tidb/server.(*clientConn).Run\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1153\ngithub.com/pingcap/tidb/server.(*Server).onConn\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/server.go:677”]
【资源配置】进入到 TiDB Dashboard -集群信息 (Cluster Info) -主机(Hosts) 截图此页面
【附件:截图/日志/监控】
其中:try to commit with invalid txnStartTS: 18446744073709551615, 时间戳的值为2^64 - 1