Repository navigation
[bug](txn) fix concurrent txns's status data race - #17893
Conversation
|
clang-tidy review says "All clean, LGTM! 👍" |
357fd2c to
c00c314
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
1 similar comment
|
clang-tidy review says "All clean, LGTM! 👍" |
|
run buildall |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
787438b to
4c321b6
Compare
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
|
TeamCity pipeline, clickbench performance test result: |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
Proposed changes
Issue Number: close #xxx
Problem summary
Recently, we found that in a high-concurrency import scenario, one version was consistently missing across all three replicas of a certain tablet. However, when we ran grep ${tablet_id} | grep publish | grep missed_version on the backend, we could not find the corresponding logs. After checking the transaction numbers of the missed_version-1 and missed_version+1, we finally identified the transaction number of the missing version. We then used this transaction ID to search for logs in the frontend, and found the following:

The same transaction timed out while attempting to acquire a write lock and was aborted, but it was later successfully committed. However, the abort transaction was also cleared on the backend by "clear transaction" rpc. As a result, the publish task corresponding to this transaction can never succeed.
After reviewing the code related to transactions, it appears that there are many places where access to the transactionState is not thread-safe. Additionally, even the unprotectedCommitTransaction2PC method can successfully commit a transaction without satisfying the required status limitations.
The transaction code does not fully consider duplicate concurrent RPCs, and the current code is tightly coupled and difficult to modify. This pull request can only attempt to handle the issue with unprotectedCommitTransaction2PC on a case-by-case basis, while also adding a read lock to ensure thread-safe access to transactionState (although this may not be sufficient).
Describe your changes.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...