|
![]() ![]()
|
The Berkeley DB Concurrent Data Store product has a simple set of conventions for locking. It provides multiple-reader/single-writer semantics, but not per-page locking or transaction recoverability. As such, it does its locking entirely in the Berkeley DB interface layer.
(Berkeley DB Concurrent Data Store product 는 락을 위해 단순한 컨벤션 셋을 가지고 있다.이것은 멀티 리더/싱글 라이터를 지원한다.그러나 페이지당 락과 트랜젝션복구는 지원하지 않느다.이와같이 이것은 버클리 디비 인터페이스 레이어에서 전체적으로 락을 건다.)
The object it locks is the file, identified by its unique file number. The locking matrix is not one of the two standard lock modes, instead, we use a four-lock set, consisting of the following:
(이것이 락시키는 오브젝트는 유일성있는 파일넘버에 의해 구분되는 파일이다.락메트릭스는 두개의 표준락모드중의 하나가 아니고 대신 우리는 다음의 4개의 락 셋을 사용한다.)
The IWRITE lock is used for cursors that will be used for updating (IWRITE locks are implicitly obtained for write operations through the Berkeley DB handles, for example, DB->put or DB->del). While the cursor is reading, the IWRITE lock is held; but as soon as the cursor is about to modify the database, the IWRITE is upgraded to a WRITE lock. This upgrade blocks until all readers have exited the database. Because only one IWRITE lock is allowed at any one time, no two cursors can ever try to upgrade to a WRITE lock at the same time, and therefore deadlocks are prevented, which is essential because Berkeley DB Concurrent Data Store does not include deadlock detection and recovery.
(IWRITE 락은 업데이트를 위해 사용되는 커서를 위해사용된다.(IWRITE )락은 묵시적으로 버클리디비핸들을 통한 쓰기 오퍼레이션을 위해 걸리게 된다.예를들어 DB->put or DB->del).커서가 읽는 동안 IWRITE lock은 걸린다. 그러나 커서가 디비를 수정하기직전 IWRITE lock은 WRITE lock으로 업그레이드되고 리더가 디비를 떠날때까지 블락되게 된다.어떤순간에 오직 하나의 IWRITE 락이 허용되기 때문에 같은시간에 두개의 커서가 WRITE lock 으로 업그레이드될 수 없다.그리고 데드락이 억제된다. 이것은 Berkeley DB Concurrent Data Store 가 데드락 탐지와 복구를 포함하지 않기 때문에 필수 적이다.
Applications that need to lock compatibly with Berkeley DB Concurrent Data Store must obey the following rules:
(Berkeley DB Concurrent Data Store 와 호환가능한 락을 필요로한 애플리케이션은 다음을 따라야 한다.)
(다음의 락모드만 사용한다: DB_LOCK_NG, DB_LOCK_READ, DB_LOCK_WRITE, DB_LOCK_IWRITE. )
( 이미 리드락이 걸려있는 오브젝트에 쓰기락얻기를 시도하지 않아야 한다.)
![]() ![]()
|
Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.