Let us consider the two concurrent transaction A and B which is accessing the data at the same time. At the point T, the conflict has occurred between the two concurrent transactions. By considering this scenario as example, explain-
a. Write Read conflict
b. Read Write conflict
c. Lost update problem (WW)
а) Write Read Conflict:
Write read conflict means when the task reads uncommitted data. Suppose in transaction A, some data has been modified, but that isn't yet committed. In the meantime transaction B occurs, where the uncommitted data is read. This is an example of a dirty read. The change which is still uncommitted may be revoked, or some additional changes may take place in that particular object. So, if before the commitment occurs another task reads that object and takes some decision depending on the data it has received, there is a good probability that inconsistency may occur.
в) Read Write Conflict:
Read-write conflict occurs when one task has read some data, and it's not over yet, in the meantime another task (or transaction) may come in and change the data that the previous task read, and commit. Then the first task will have two different versions of the same data, and it will have to abort because it doesn't know what to do with two different versions of the data, 'cause how can it decide which value to choose?
For example, say Tx A has read some object x, but Tx A isn't over yet. In the meantime, Tx B comes in and overwrites the value of the object x. So, Tx A faces the same problem described above.
с) Lost Update problem:
Lost update problem occurs when two interleaving or concurrent transactions update or write the same object almost simultaneously, then the update due to the first transaction is lost. Assume Tx A, has started and it's updating a column in the database. In the mean time, before Tx A has committed the change, Tx B comes in and update the same column. In this case the data from the previous Tx, Tx A is completely lost, and it's simply overwritten by the Transaction B (Tx B). This is Lost update problem.
Comments
Leave a comment