Category 1 lost updates
When transaction A is canceled, the updated data of transaction B that has been committed is overwritten. This error may cause serious problems. You can see it through the following account withdrawal transfer:
Time |
Withdrawal transaction |
Transfer transaction B |
T1 |
Start transaction |
|
T2 |
|
Start transaction |
T3 |
The account balance is USD 1000. |
|
T4 |
|
The account balance is USD 1000. |
T5 |
|
Remit 100 yuan to change the balance to 1100 yuan |
T6 |
|
Commit transactions |
T7 |
Retrieve 100 yuan and change the balance to 900 yuan |
|
T8 |
Cancel transaction |
|
T9 |
Balance restored to 1000 Metadata (lost updates) |
|
When transaction A revokes the transaction, it accidentally erased the amount that transaction B has transferred to the Account.
Type 2 lost updates
Transaction A overwrites the data already submitted by transaction B, resulting in the loss of operations performed by transaction B:
Time |
Transfer transaction |
Withdrawal transaction B |
T1 |
|
Start transaction |
T2 |
Start transaction |
|
T3 |
|
The account balance is USD 1000. |
T4 |
The account balance is USD 1000. |
|
T5 |
|
Retrieve 100 yuan and change the balance to 900 yuan |
T6 |
|
Commit transactions
|
T7 |
Import 100 RMB |
|
T8 |
Commit transactions |
|
T9 |
Change balance to 1100 Metadata (lost updates) |
|
In the above example, the check transfer transaction overwrites the withdrawal transaction's updates to the deposit balance, resulting in the Bank's final loss of 100 yuan. On the contrary, if the transfer transaction is committed first, the user account will lose 100 yuan.