Computer Science Series: Database system Concepts Reading notes (14)--Business

Source: Internet
Author: User
Tags volatile

The set of operations that make up a single logical unit of work is called a transaction (transaction).

Even if there is a failure, the database system must ensure that the transaction is executed correctly-either the entire transaction is executed or the operation belonging to the transaction is not executed.

1. Concept of transactions

Transactions are typically caused by advanced data manipulation languages or programming languages that access written user programs through JDBC or ODBC embedded databases.

Four characteristics: atomicity, isolation, consistency, persistence

Atomicity: If a transaction starts executing, but fails for some reason, any possible modifications to the database by the transaction are revoked. This is true regardless of whether the transaction itself fails, or if the operating system crashes, or if the computer stops running.

Isolation: The database system must take special care to ensure that the transaction executes properly without being disturbed by the database statements that are executed concurrently.

Persistence: The operation of a transaction must be permanent even after a system crash.

Consistency: Maintains database consistency when performing transactions.

ACID properties: atomicity, consistency, isolation, durability

2. A simple physical Model 3. Storage structure

Volatile memory: Information in volatile memory typically does not survive a system crash. Examples of this memory include main memory and buffer memory. Volatile memory accesses are very fast, on the one hand because of the speed of the memory access itself and, on the other hand, any data item in the volatile memory can be accessed directly.

Nonvolatile Memory: Non-volatile memory survives after a system crash. Examples of nonvolatile memory include level two storage devices (such as disks and Flash memory) for online storage, and level three storage devices (such as optical media and tapes) for archival storage.

Stability Memory: never lost.

4. Atomicity and permanence of transactions

Status of the transaction:

Active (Active): The initial state in which the transaction executes.

Partially committed (partially committed): After the last statement is executed.

Failed (failed): After the discovery of normal execution cannot continue.

Aborted (aborted): The transaction is rolled back and the database has been restored to the state before the transaction started executing.

Submitted by (committed): after successful completion.

5. Transaction Isolation 6. Serializable 7. Transactional isolation and atomicity 7.1 recoverable dispatch

Recoverability scheduling satisfies: For each team transaction Ti and TJ, if TJ reads the data items previously written by Ti, then Ti commits before TJ.

7.2 Cascade-Free Scheduling

No cascade scheduling satisfies: For each team transaction Ti and TJ, if TJ reads the data item previously written by TI, then TI must be committed before the TJ read operation.

8. Transaction ISOLATION Level 9. Implementation of Isolation Level 9.1 lock

Two-phase blockade protocol: one stage only acquires the lock does not release the lock, and the other phase only releases the lock without acquiring the lock.

Shared locks: Many transactions can hold a shared lock on a data item at the same time

Exclusive lock: Only one transaction is allowed to acquire an exclusive lock when the other transaction does not hold a lock on a data item (whether a shared or exclusive lock).

9.2 Time Stamp

For the same data item, the system holds two timestamp, maximum read timestamp, and maximum write timestamp.

When access is not possible, the offending transaction will be aborted and will be assigned to an up-to-date timestamp to start again.

9.3 Multi-version and Snapshot isolation

Each transaction starts with a copy of its own version of the database, and the transaction reads the data from the private database version, so it is isolated from other database operations, and the update appears only in private database operations without affecting the actual database. When a transaction is committed, the information about the update is saved and is written to the real database.

Computer Science Series: Database system Concepts Reading notes (14)--Business

Related Article

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.