-
1. Overview
Transactions are omnipresent in today’s enterprise systems, providing data integrity even in highly concurrent environments. So let’s get started by first defining the term and the context where you might usually employ it. A transaction is a collection of read/write operations succeeding only if all contained operations succeed.
2. Description
2.1 Components
2.1.1 Atomicity
Atomicity takes individual operations and turns them into an all-or-nothing unit of work, succeeding if and only if all contained operations succeed.
A transaction might encapsulate a state change (unless it is a read-only one). A transaction must always leave the system in a consistent state, no matter how many concurrent transactions are interleaved at any given time.
2.1.2 Consistency
Consistency means that constraints are enforced for every committed transaction. That implies that all Keys, Data types, Checks and Trigger are successful and no constraint violation is triggered.
2.1.3 Isolation
Transactions require concurrency control mechanisms, and they guarantee correctness even when being interleaved. Isolation brings us the benefit of hiding uncommitted state changes from the outside world, as failing transactions shouldn’t ever corrupt the state of the system. Isolation is achieved through concurrency control using pessimistic or optimistic locking mechanisms.
2.1.4 Durability
For messaging systems like JMS, transactions are not mandatory. That’s why we have non-transacted acknowledgment modes.
File system operations are usually non-managed, but if your business requirements demand transaction file operations, you might make use a tool such as XADisk.
While messaging and file systems use transactions optionally, for database management systems transactions are compulsory.
2.2 Isolation Levels
2.2.1 Components
- READ_UNCOMMITTED
- READ_COMMITTED
- REPEATABLE_READ
- SERIALIZABLE
2.2.2 Associated Phenomena
Isolation Level Dirty Read Non-repeatable Read Phantom Read READ_UNCOMMITTED allowed allowed allowed READ_COMMITTED prevented allowed allowed REPEATABLE_READ prevented prevented allowed SERIALIZABLE prevented prevented prevented 3. References
https://vladmihalcea.com/a-beginners-guide-to-acid-and-database-transactions/
'DB > RDB' 카테고리의 다른 글
Dirty Read (0) 2019.09.30 Phantom Read (0) 2019.09.30 Transactional locking mechanism and Multi-version concurrency control(MVCC) (0) 2019.09.30 OLTP, OLAP, and ETL (0) 2019.09.11 Explain Query Plan and Query Performance with Postgres (0) 2019.08.23