ACID attribute of database

ACID(Atomicity Atomicity, Consistency consistency, Isolation isolation, Durability persistence) are a series of attributes.

These attributes ensure the reliability of database objects. In a database, a series of operations on data can be logically viewed as a whole operation, which is called things.

Atomicity” (atomicity)

Atomicity requires that all operations in each thing be either complete or as if none of them happened: if some of the operations in the thing fail, the whole thing fails, and the result is that the state in the database remains unchanged. Atomicity systems must ensure atomicity in all cases, including hosts.Power failure, host error, main engine crashes. To the outside world, a submitted thing seems to be inseparable, a failed thing to the outside world as if nothing had happened.

Consistency” (consistency)

Consistency ensures that everything changes the database from one legal state to another. Writing is guaranteed by defining various rules, including constraints, cascades, triggers, and their combinationsAll data entering the database must be legal. Consistency does not guarantee the correctness of things (programs), in other words, consistency does not necessarily follow what programmers expect (which should be the responsibility of application-level code), it only ensures that all data in the database does not violate the definition.Rules, whether or not the program has errors or even any errors, do not violate the defined rules.

Isolation” (isolation)

Isolation guarantees that the impact of concurrent execution of multiple things on the state of the system is the same as that of serialized execution of multiple things on the state of the system. Isolation is the main goal of concurrency control. Through concurrency control, the effect of an unfinished thing is invisible to other things.

Durability”

Persistence guarantees that once something is submitted, its state remains unchanged, even when the host is powered off, bursts, errors, etc. For example, in a relational database, once a set of SQL statements is executed, the result is permanently saved (even when things have just been submitted to the database system).Defeat). In order for the mainframe to withstand the risk of power failure, things (or the results of things) must be recorded in permanent storage.

 

realization

Processing a thing usually requires a series of operations, any one of which fails will lead to the failure of the whole thing, so there are many reasons for things to fail. For example, when the system’s disk is full, there’s no more space, or something has run out of the CPU allocated to it by the operating systemLamella. There are two popular technologies that are familiar to everyone: pre write logging and shadow paging. In these two technologies, it is necessary to get locks on all the information that will be updated. The acquired lock depends on the isolation level of the object, and it is possible that all the data is only read and that the acquired lock is required. Prewrite loggingIn technology, atomicity is guaranteed by copying raw (unchanged) data into a log record before changing the database. With logging, the database can be restored to the consistency state before the crash. In shadow paging technology, updates are applied to some copies of databases, when databases are used.When the thing is submitted, the new copy is activated.

Posted on Categories DB

Leave a Reply

Your email address will not be published. Required fields are marked *