client-rust
client-rust copied to clipboard
What is the cause of the error "PessimisticLock error: MultipleKeyErrors([KeyError(KeyError { locked: None, retryable: "Error(Txn(Error(Mvcc(Error(WriteConflict"..."?
What is the cause of the error "PessimisticLock error: MultipleKeyErrors([KeyError(KeyError { locked: None, retryable: "Error(Txn(Error(Mvcc(Error(WriteConflict"..."? After this error occurs, does it mean the entire transaction was not executed, and the database state remains the same as before the transaction? Is there any solution to this?
What is the cause of the error
There was another transaction with start timestamp of conflict_ts and commit timestamp of conflict_commit_ts modified data after current transaction started.
After this error occurs, does it mean the entire transaction was not executed
Yes.
and the database state remains the same as before the transaction?
No, another transaction change the database.
Is there any solution to this?
Up to your business. E.g, if your business do a = a + 1, you need to retry from start a new transaction, read the a, then modify and commit again.
I'm using pessimistic transactions. Aren't pessimistic transactions supposed to acquire locks and prevent write conflicts? @pingyu