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

autoid service rebase internal SQL should not meet transaction conflict #50819

Closed
tiancaiamao opened this issue Jan 30, 2024 · 1 comment · Fixed by #50820
Closed

autoid service rebase internal SQL should not meet transaction conflict #50819

tiancaiamao opened this issue Jan 30, 2024 · 1 comment · Fixed by #50820

Comments

@tiancaiamao
Copy link
Contributor

As the title says, there should be only one autoid service leader visiting the autoid meta key,
and that operation should be under lock protect, so there should never be a transaction conflict.

But from the log, I see the autoid been increased twice, get transaction conflict, result in "hole" in the id sequence.

[2024/01/26 09:29:56.070 +00:00] [INFO] [prewrite.go:444] ["prewrite encounters lock"] [session=0] [txnID=447286187399315470] [lock="key: 6d44423a3334383032ff3100000000000000f800000000000000684949443a33363930ff3630000000000000f9, primary: 6d44423a3334383032ff3100000000000000f800000000000000684949443a33363930ff3630000000000000f9, txnStartTS: 447286187399315472, lockForUpdateTS:0, minCommitTs:447286187399315473, ttl: 3003, type: Put, UseAsyncCommit: false, txnSize: 1"]
[2024/01/26 09:29:56.070 +00:00] [INFO] [prewrite.go:444] ["prewrite encounters lock"] [session=0] [txnID=447286187399315473] [lock="key: 6d44423a3334383032ff3100000000000000f800000000000000684949443a33363930ff3630000000000000f9, primary: 6d44423a3334383032ff3100000000000000f800000000000000684949443a33363930ff3630000000000000f9, txnStartTS: 447286187399315472, lockForUpdateTS:0, minCommitTs:447286187399315473, ttl: 3003, type: Put, UseAsyncCommit: false, txnSize: 1"]
[2024/01/26 09:29:56.071 +00:00] [WARN] [txn.go:167] [RunInNewTxn] ["retry txn"=447286187399315470] ["original txn"=447286187399315470] [error="[kv:9007]Write conflict, txnStartTS=447286187399315470, conflictStartTS=447286187399315472, conflictCommitTS=0, key=????, reason=Optimistic [try again later]"]
[2024/01/26 09:29:56.074 +00:00] [INFO] [autoid.go:214] ["rebase4Unsigned from"] [category="autoid service"] [dbID=348021] [tblID=369062] [from=273] [to=4274]
[2024/01/26 09:29:56.074 +00:00] [INFO] [autoid.go:255] ["rebase4Signed from"] [dbID=348021] [tblID=369058] [from=180] [to=4181] [category="autoid service"]
[2024/01/26 09:29:56.078 +00:00] [INFO] [autoid.go:214] ["rebase4Unsigned from"] [category="autoid service"] [dbID=348021] [tblID=369060] [from=288] [to=4292]
[2024/01/26 09:29:56.078 +00:00] [INFO] [prewrite.go:444] ["prewrite encounters lock"] [session=0] [txnID=447286187412160516] [lock="key: 6d44423a3334383032ff3100000000000000f800000000000000684949443a33363930ff3632000000000000f9, primary: 6d44423a3334383032ff3100000000000000f800000000000000684949443a33363930ff3632000000000000f9, txnStartTS: 447286187399315494, lockForUpdateTS:0, minCommitTs:447286187399315495, ttl: 3002, type: Put, UseAsyncCommit: false, txnSize: 1"]
[2024/01/26 09:29:56.079 +00:00] [INFO] [prewrite.go:444] ["prewrite encounters lock"] [session=0] [txnID=447286187412160515] [lock="key: 6d44423a3334383032ff3100000000000000f800000000000000684949443a33363930ff3538000000000000f9, primary: 6d44423a3334383032ff3100000000000000f800000000000000684949443a33363930ff3538000000000000f9, txnStartTS: 447286187412160514, lockForUpdateTS:0, minCommitTs:447286187412160515, ttl: 3002, type: Put, UseAsyncCommit: false, txnSize: 1"]
[2024/01/26 09:29:56.082 +00:00] [INFO] [autoid.go:214] ["rebase4Unsigned from"] [category="autoid service"] [dbID=348021] [tblID=369054] [from=156] [to=4157]
[2024/01/26 09:29:56.084 +00:00] [INFO] [autoid.go:214] ["rebase4Unsigned from"] [category="autoid service"] [dbID=348021] [tblID=369062] [from=4274] [to=8274]
[2024/01/26 09:29:56.084 +00:00] [INFO] [autoid.go:255] ["rebase4Signed from"] [dbID=348021] [tblID=369058] [from=4181] [to=8181] [category="autoid service"]
[2024/01/26 09:29:56.086 +00:00] [INFO] [autoid.go:214] ["rebase4Unsigned from"] [category="autoid service"] [dbID=348021] [tblID=369060] [from=4292] [to=8292]
[2024/01/26 09:29:56.154 +00:00] [WARN] [txn.go:167] [RunInNewTxn] ["retry txn"=447286187399315473] ["original txn"=447286187399315473] [error="[kv:9007]Write conflict, txnStartTS=447286187399315473, conflictStartTS=447286187399315485, conflictCommitTS=447286187412160528, key=????, reason=Optimistic [try again later]"]
[2024/01/26 09:29:56.160 +00:00] [WARN] [txn.go:167] [RunInNewTxn] ["retry txn"=447286187412160516] ["original txn"=447286187412160516] [error="[kv:9007]Write conflict, txnStartTS=447286187412160516, conflictStartTS=447286187399315494, conflictCommitTS=447286187412160521, key=????, reason=Optimistic [try again later]"]
[2024/01/26 09:29:56.162 +00:00] [INFO] [autoid.go:214] ["rebase4Unsigned from"] [category="autoid service"] [dbID=348021] [tblID=369060] [from=8292] [to=12292]
[2024/01/26 09:29:56.167 +00:00] [INFO] [autoid.go:214] ["rebase4Unsigned from"] [category="autoid service"] [dbID=348021] [tblID=369062] [from=8274] [to=12274]
[2024/01/26 09:29:56.180 +00:00] [WARN] [txn.go:167] [RunInNewTxn] ["retry txn"=447286187412160515] ["original txn"=447286187412160515] [error="[kv:9007]Write conflict, txnStartTS=447286187412160515, conflictStartTS=447286187412160514, conflictCommitTS=447286187412160522, key=????, reason=Optimistic [try again later]"]
[2024/01/26 09:29:56.187 +00:00] [INFO] [autoid.go:255] ["rebase4Signed from"] [dbID=348021] [tblID=369058] [from=8181] [to=12181] [category="autoid service"] 
@tiancaiamao tiancaiamao added type/bug This issue is a bug. severity/minor labels Jan 30, 2024
mittalrishabh pushed a commit to mittalrishabh/tidb that referenced this issue May 30, 2024
@seiya-annie
Copy link

/found customer

@ti-chi-bot ti-chi-bot bot added the found/customer Customers have encountered this bug. label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants