using an optimization strategy with optimization can solve the concurrency problem as shown below:
| the first transaction started |
| |
| select a row |
| | the second transaction started
| update the row with version checking |
| | select the same row
| commit txn |
| | update the row with version checking
| |
| | rolls back because version is dirty
But what if, in extremely rare cases, if the update is in the second transaction after udpate in the first transaction, but before the transaction is completed?
| the first transaction started |
| | the second transaction started
| select a row |
| | select the same row
| update the row with version checking |
| | update the row with version checking
| commit txn |
| | rolls back because version is dirty // will it?
| |
| |
I did an experiment according to which the update in the second transaction cannot read the dirty version, since the first transaction has not yet been completed. Will the second transaction fail in this case?
source share