-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Primary lock fallen back from async commit cannot be resolved #24384
Comments
Remember to resolve client-c and client-java. I just realized that tispark doesn't support async-commit fallback. |
Bug1. Root Cause Analysis (RCA) (optional)See the issue description. 2. Symptom (optional)See the issue description. 3. All Trigger Conditions (optional)See the issue description. 4. Workaround (optional)No 5. Affected versions[v5.0.0:v5.0.1] 6. Fixed versionsv5.0.2 (estimated) |
@sticnarf does |
|
Bug Report
1. Minimal reproduce step (Required)
It is hard to reproduce the issue deterministically. So the reproduce steps contain technical details.
Commit an async-commit transaction with multiple keys. Prewriting the primary lock triggers a fallback (probably because TiKV executes the command too slow), while the secondary lock is prewritten successfully with the async-commit protocol. Then, the TiDB instance crashes without committing any key.
Now, if we meet the secondary lock of the above transaction, TiDB cannot resolve that lock so the statement will be blocked.
https://github.com/pingcap/tidb/blob/v5.0.1/store/tikv/lock_resolver.go#L489
Here we set
current_ts
to zero if the lock we first meet is an async-commit lock. Therefore, the primary lock is never rolled back incheck_txn_status
. And because the lock returned bycheck_txn_status
is not an async-commit lock, the following logic does not treat this case well, the lock remains unresolved forever.2. What did you expect to see? (Required)
The locks of the transaction can be successfully resolved, so the locks will not block other readers forever.
3. What did you see instead (Required)
The secondary lock can block other readers forever.
4. What is your TiDB version? (Required)
5.0.0~5.0.1
The text was updated successfully, but these errors were encountered: