差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
study:database:lock [2008/07/01 15:33] bananastudy:database:lock [2008/07/26 12:48] (現在) banana
行 10: 行 10:
 |repeatable reads \\ (read consistency)|① Time 10:00:00 : transaction1이 명시적으로 transaction.begin() \\ ② Time 10:00:01 : transactin1이 좌석수 조회. 결과 잔여석 2 \\ ③ Time 10:00:02 : transaction2가 좌석수를 2에서 으로 변경 \\ ④ Time 10:00:03 : transactin1이 좌석수 조회. 결과 잔여석 2 |같은 transaction내에서 읽기 일관성이 유지되는 것을 말한다 | |repeatable reads \\ (read consistency)|① Time 10:00:00 : transaction1이 명시적으로 transaction.begin() \\ ② Time 10:00:01 : transactin1이 좌석수 조회. 결과 잔여석 2 \\ ③ Time 10:00:02 : transaction2가 좌석수를 2에서 으로 변경 \\ ④ Time 10:00:03 : transactin1이 좌석수 조회. 결과 잔여석 2 |같은 transaction내에서 읽기 일관성이 유지되는 것을 말한다 |
 |phantom reads|① Time 10:00:00 : transaction1이 명시적으로 transaction.begin() \\ ② Time 10:00:01 : transactin1이 좌석수 조회. 결과 잔여석 2. cabin99 좌석예매가능\\ ③ Time 10:00:02 : transaction2가 cabin99좌석 예매. Reservation table에 추가 \\ ④ Time 10:00:03 : transactin1이 좌석수 조회. 결과 잔여석 2. 하지만 cabin99 예매 불가|transaction1의 첫번째 조회에는 보이지 않았지만, 두번째 조회에는 보였으므로 Reservation table에 추가된 cabin99예매 데이타는 phantom data | |phantom reads|① Time 10:00:00 : transaction1이 명시적으로 transaction.begin() \\ ② Time 10:00:01 : transactin1이 좌석수 조회. 결과 잔여석 2. cabin99 좌석예매가능\\ ③ Time 10:00:02 : transaction2가 cabin99좌석 예매. Reservation table에 추가 \\ ④ Time 10:00:03 : transactin1이 좌석수 조회. 결과 잔여석 2. 하지만 cabin99 예매 불가|transaction1의 첫번째 조회에는 보이지 않았지만, 두번째 조회에는 보였으므로 Reservation table에 추가된 cabin99예매 데이타는 phantom data |
 +
  
  
行 20: 行 21:
 |exclusive write locks|현재 transaction의 쓰기가 종료될때까지 다른 transaction의 읽기,쓰기를 금지한다. \\ 그러므로 다른 transaction에 의한 dirty reads를 방지할 수 있다. \\ 어떤 vendor의 database는 자신의 data 읽기도 금지한다.| | |exclusive write locks|현재 transaction의 쓰기가 종료될때까지 다른 transaction의 읽기,쓰기를 금지한다. \\ 그러므로 다른 transaction에 의한 dirty reads를 방지할 수 있다. \\ 어떤 vendor의 database는 자신의 data 읽기도 금지한다.| |
 |snapshots|transaction이 시작될때 저장된 frozen view이다. \\ snapshots은 dirty reads, nonrepeatable reads, phantom reads를 방지할 수 있지만, data가 real-time이 아니므로 주의해야 한다.| | |snapshots|transaction이 시작될때 저장된 frozen view이다. \\ snapshots은 dirty reads, nonrepeatable reads, phantom reads를 방지할 수 있지만, data가 real-time이 아니므로 주의해야 한다.| |
 +
 +
 +
 +
 +
 +
 +
 +===== Transaction Isolation Levels =====
 +^isolation level^dirty reads^nonrepeatable reads^phantom reads^%%ControlDescriptor Constant%%^
 +|Read Uncommitted| 〇 | 〇 | 〇 | TRANSACTION_READ_UNCOMMITTED |
 +|Read Committed| × | 〇 | 〇 | TRANSACTION_READ_COMMITTED |
 +|Repeatable Read| × | × | 〇 | TRANSACTION_REPEATABLE_READ |
 +|Serializable| × | × | × | TRANSACTION_SERIALIZABLE |
 +
 +
 +
 +===== reference =====
 +  - [[http://www.unix.com.ua/orelly/java-ent/ebeans/ch08_03.htm]] : Isolation and Database Locking

QR Code
QR Code study:database:lock (generated for current page)