Issue
From this oracle java tutorial:
A non-repeatable read occurs when transaction A retrieves a row, transaction B subsequently updates the row, and transaction A later retrieves the same row again. Transaction A retrieves the same row twice but sees different data.
What's the difference between a dirty read and the non-repeatable read? Is it not the same thing? reading the wrong result due to others' updating?
Thanks in advance.
Solution
The exact same page explains what a dirty read is:
Accessing an updated value that has not been committed is considered a dirty read because it is possible for that value to be rolled back to its previous value. If you read a value that is later rolled back, you will have read an invalid value.
So, non-repeatable read consists in reading two different committed values, whereas dirty read consists in reading a value that hasn't been committed yet. Quite different.
Answered By - JB Nizet
Answer Checked By - Mary Flores (JavaFixing Volunteer)