Home>Article> What are the three types of data inconsistencies caused by concurrent operations?

What are the three types of data inconsistencies caused by concurrent operations?

青灯夜游
青灯夜游 Original
2020-09-02 13:20:01 20106browse

Concurrent operations bring data inconsistency including: lost modifications, non-repeatable reading, and reading "dirty" data. The reason for these three phenomena is that concurrent operations destroy the isolation of transactions. In order to deal with these data inconsistencies, the main technologies are: blocking, timestamps, and optimistic control methods.

What are the three types of data inconsistencies caused by concurrent operations?

What data inconsistencies will be caused by concurrent operations ( )

A. Lost modifications, non-repeatable reads, dirty reads, deadlock

B. Non-repeatable read, dirty read, deadlock

C. Lost modifications, dirty reads, deadlock

D. Lost modifications, non-repeatable reads, dirty reads

Correct answer: D

Answer analysis:

Transactions are controlled by concurrency The basic unit, ensuring the ACID characteristics of a transaction is an important task in transaction processing. One of the reasons why the ACID characteristics of a transaction may be damaged is due to the concurrent operations of multiple transactions on the database.

The main data inconsistencies caused by concurrent operations include lost modifications, non-repeatable reading, and reading "dirty" data.

1. Lost modifications

Two transactions T1 and T2 read the same data and modified it. The result submitted by T2 destroyed the result submitted by T1, causing the modification of T1 to be lost. Typical example: buying airplane tickets or train tickets.

2. Non-repeatable reading

Non-repeatable reading means that after transaction T1 reads data, transaction T2 performs an update operation, making T1 unable to reproduce the results of the previous read.

is divided into the following three situations:

(1) After transaction T1 reads a certain data, transaction T2 modifies it. When transaction T1 reads the data again, it gets A different value than the previous time.

(2) After transaction T1 reads certain data, transaction T2 deletes the records in it. When transaction T1 reads the data again, it is found that some records have mysteriously disappeared.

(3) After transaction T1 reads certain data, transaction T2 inserts some new records. When transaction T1 reads the data again, it finds some more records.

The latter two operations are called phantom phenomena.

3. Reading "dirty" data

Reading "dirty" data only requires transaction T1 to modify certain data and write it back to the disk. After transaction T2 reads certain data, T1 cancels the operation for some reason and restores the original value. At this time, the data read by T2 is inconsistent with the data in the database, which is called reading "dirty" data.

The reason for the above three phenomena is that concurrent operations destroy the isolation of transactions. In order to deal with these data inconsistencies, the main technologies are: blocking, timestamps, and optimistic control methods.

For more related knowledge, please visit:PHP Chinese website!

The above is the detailed content of What are the three types of data inconsistencies caused by concurrent operations?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn