ACIDRefers to the four characteristics of the transaction in the database management system (DBMS): atomicity (atomicity), consistency (consistency), isolation (isolation, also known as independence), persistence (durability). In a database system, a transaction refers to a complete logical process consisting of a series of database operations. For example, bank transfer, deduction of the amount from the original account, and the addition of the amount to the target account, the sum of the two database operations constitutes a complete logical process that cannot be split. This process is called a transaction and has an acid characteristic.
-
Atomic Nature
-
All operations in the entire transaction, either complete or incomplete, are not likely to stall in one part of the middle. When an error occurs during execution, the transaction is rolled back (Rollback) to the state before the transaction begins, as if the transaction had never been executed.
-
Consistency
-
The integrity constraints of the database are not compromised until the transaction begins and after the transaction has ended.
-
Isolation of
-
The execution of two transactions is non-disruptive, and one transaction cannot see the data in the middle of a time when other transactions are running.
-
Durability
-
after the transaction is completed, the changes made to the database by the firm persist in the database and are not rolled back.
because an operation typically contains many sub-operations that can cause problems with hardware corruption or other factors, it is not easy to implement acid correctly. The acid recommendation database takes all data that needs to be updated and modified once, but it is not practical. There are two main ways to achieve acid: the first is write ahead logging, which is the way of logging. The second type is shadow paging. Compared to the Wal (write ahead logging) technology, shadow paging technology is relatively simple to implement, eliminating the overhead of writing log records to recover faster (no need for redo and undo). The disadvantage of shadow paging is that multiple blocks are output when a transaction commits, which makes the commit expensive and, in blocks, difficult to apply to situations where multiple transactions are allowed to execute concurrently-a fatal disadvantage. The central idea of WAL is that modifications to data files (which are vectors of tables and indexes) must only occur after those modifications have been logged-that is, after the log records have been flushed to the permanent storage. If we follow this process, then we don't need to flush the data page to disk every time the transaction commits, because we know that in the event of a crash, we can use the log to recover the database: Any record that has not yet been attached to the data page will first be redo from the log record, which is called forward scrolling recovery, also called REDO) Then the modifications made by those uncommitted transactions will be removed from the data page (this is called backward-scrolling recovery-UNDO).
ACID Properties of the database