TiDB Error: Timestamp Not Assigned

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: Tidb报错,时间戳未赋值

| username: TiDBer_qijtMMBk

[Test Environment] Testing environment
[TiDB Version] v7.1.0
[Reproduction Path] Execute the following SQL
“SELECT * FROM " + table_name + " WHERE obj_key=? FOR UPDATE”
INSERT INTO " + table_name + " VALUES(?,?) ON DUPLICATE KEY UPDATE obj_value = ?
[Encountered Problem: Symptoms and Impact]
Performance is very poor, and there are a large number of the following errors in the TiDB logs:
[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”]

[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page

[Attachments: Screenshots/Logs/Monitoring]

Among them: try to commit with invalid txnStartTS: 18446744073709551615, the timestamp value is 2^64 - 1

| username: h5n1 | Original post link

Check the current TSO:

begin;
select tidb_current_tso();
| username: tidb菜鸟一只 | Original post link

Why is your timestamp so large? Mine is only 445472863055511553.

| username: TiDBer_qijtMMBk | Original post link

The value of current_tso is fine: 445473530876788738. The error value is UINT64_MAX, which seems like an overflow or something similar.

| username: Fly-bird | Original post link

TSO time configuration issue

| username: andone | Original post link

Are the PD and TiDB times not synchronized?

| username: zhanggame1 | Original post link

Check if there are any lock conflict issues.
Handling TiDB Lock Conflict Issues | PingCAP Documentation Center

| username: TiDBer_qijtMMBk | Original post link

The reason is that when multiple threads are concurrently processing transactions, transactions without an explicit commit default to using optimistic mode, causing the startTSO to not be successfully assigned.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.