Database5 [DB/2-1. Lock-based Protocols] 1️⃣ Lock-based Protocols Lock-based Protocols locking protocol : set of rules followed by all transactions while requesting and releasing locks → 동시성 제어를 위해 개발, 트랜잭션 스케줄을 제어하여 원하는 트랜잭션 스케줄만을 생성하도록 함 [ Lock modes ] exclusive (X) mode : Read or Write ⇒ lock-X() shared (S) mode : Read only ⇒ lock-S() [ Lock 호환성 ] S X S true false X false false → lock-S()끼리만 호환 가능 이외의 것들은 conflict 발생함 ❓lock-X()가 호환되.. 2024. 3. 30. [DB/1-4. Recoverability(회복 가능)] 4️⃣ Recoverability 복구 : 원자성 (Atomicity) 위해 필요 Recoverable Schedules Recoverable Schedule? : Write연산이 Read연산을 하기 전에 먼저 commit 되어야 함. → recoverable함 T8의 rollback 전에 commit됨 → inconsistent함 만약 commit 후 rollback해야 하는 상황? abort 발생해서 rollback된 상황 근데 commit은 이미 완료 Commit을 연기해서 방지 (rollback 끝나고 수행) => DB는 스케줄이 recoverable하도록 보장해야 함. Cascading Rollbacks : a single transaction failure leads to a series of.. 2024. 3. 27. [DB/1-3. How to Test Serializability] 3️⃣ How to Test Serializability Testing for Conflict Serializability Precedence graph의 Cycle 유무를 검사 a direct graph where the vertices are the transactions We draw an arc from Ti to Tj if the two transactions conflict, and Ti accesses the data item on which the conflict arises earlier we may label the arc by the item that is accessed Node : 트랜잭션, Edge : 충돌연산 있을 때 데이터를 먼저 읽는 방향으로. ⇒ 만약 사이클 존재? con.. 2024. 3. 27. [DB/1-2.Serializability(직렬성)] 2️⃣ Serializability Correct Execution Two widely accepted criteria Conflict serializable View serializable → 두 개 중 하나만이라도 만족하면 correct execution (* serial execution of transaction is always correct) Nonserializable Execution 비순차적인 연산의 문제점 1. dirty read : Rollback으로 인해 A는 처음 상태로 → T2의 A는 잘못된 값을 읽고 있는 것임 2. lost update : Effect (update) of T2 is lost 최종적으로는 T1에서 A+50한 값이 write됨 (T2연산이 사라짐 → lost u.. 2024. 3. 24. [DB/1-1. Transaction(트랜잭션)] 1️⃣ Transaction Concept Transaction transaction : 하나의 논리적 작업을 수행하는 데이터베이스 연산의 순서 수행하고자 하는 연산의 논리적 단위 query의 순서를 가지는 집합 Transaction Concept A transaction is a unit of database program that accesses and possibly updates various data items DB에 적용되는 모든 연산 → Read / Write 연산으로 단순화할 수 있음 트랜잭션 : 응용 프로그램 내에서 DB에 대해 read/write 연산이 나오는 프로그램의 일부 A계좌에서 B계좌로 $50을 송금하는 단순화된 트랜잭션 예제 read(A) A = A - 50 write(A) .. 2024. 3. 18. 이전 1 다음