ACID properties of the database-detailed terminology _ database other

Source: Internet
Author: User

Acid is: atomicity (atomicity), consistency (consistency), isolation (isolation), and persistence (durabilily).

1. Atomic Sex

The atomicity attribute is used to identify whether a transaction is completely completed, any updates to a transaction are completely completed on the system, and if for some reason the transaction does not complete its entire task, the system returns to the state before the transaction started.

Let's take another look at the example of bank transfers. If an error occurs during the transfer process, the entire transaction is rolled back. The transaction is written to disk and the changes are persisted only if all parts of the transaction are executed successfully.

In order to provide the ability to rollback or undo uncommitted changes, many data sources use a logging mechanism. For example, SQL Server uses a write-ahead transaction log, which is written on the transaction log before the data is applied (or submitted to) to the actual data page. However, some other data sources are not relational database management systems (RDBMS), and they manage uncommitted transactions in a completely different way. This technique should be available for managing transactions whenever a transaction rolls back and the data source can undo all uncommitted changes.

2. Consistency

Transactions enforce consistency in system integrity, which is achieved by ensuring that any transaction of the system is finally in a valid state. If the transaction completes successfully, all changes in the system are applied correctly and the system is in a valid state. If an error occurs in a transaction, all changes in the system are automatically rolled back and the system returns to its original state. Because affairs Open

The system is in a consistent state at the beginning, so the system is still in a consistent state.

Let's look back at the example of bank transfers, which are in a valid state before the account conversion and the transfer of funds. If the transaction completes successfully, and the transaction is committed, the account is in a new, valid state. If a transaction fails, the account returns to its original valid state after termination.

Remember that transactions are not responsible for enforcing data integrity, but only for ensuring that the data is returned to a consistent state after the transaction commits or terminates. The task of understanding data integrity rules and writing code to achieve integrity often falls on the developer's shoulders, and they are designed according to business requirements.

When many users use and modify the same data at the same time, transactions must maintain the integrity and consistency of their data. So we further study the next feature in a C I-D feature: Isolation.

3. Isolation

Perform transactions in the quarantine state so that they appear to be the only actions that the system performs within a given time. If there are two transactions running at the same time and performing the same function, the isolation of the transaction will ensure that each transaction is considered only in the system by the transaction.

This attribute is sometimes referred to as serialization, in order to prevent confusion between transaction operations, the request must be serialized or serializable so that only one request at a time is used for the same data.

Importantly, the state of the system may be inconsistent in the isolated state, ensuring that the system is in a consistent state before closing the transaction. However, in each individual transaction, the state of the system may change. If a transaction is not running in isolation, it may access data from the system, and the system may be in an inconsistent state. By providing things

Quarantine can prevent the occurrence of such incidents.

In the case of the bank, this means that in this system, other processes and transactions do not see any changes in our transactions until our transaction is complete, which is important for the termination. If there is another process that is handled according to the account balance, and it can see the changes it has made before our transaction completes, then the decision of the process may

Based on the wrong data, because our transaction may terminate. This explains why the transaction has changed until the transaction is complete before it is visible to other parts of the system.

Isolation not only guarantees that multiple transactions cannot modify the same data at the same time, but also guarantees that the changes in the transaction will not be visible to another transaction until the change is committed or terminated, and that the concurrent transactions have no effect on each other. This means that all data required to be modified or read has been locked in the transaction until the transaction completes to be released. Most databases, such as SQL Server and other RDBMS, are isolated by using locks, and each data item or dataset involved in a transaction uses locks to prevent concurrent access.

4. Durability

Persistence means that any changes that occur in the system will be permanent once the transaction is executed successfully. There should be some checkpoints to prevent loss of information when the system fails. Even if the hardware itself fails, the state of the system can still be rebuilt by recording the tasks completed in the log. The concept of persistence allows developers to assume that the completed transaction is a permanent part of the system, regardless of the changes that have taken place in the system.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.