익명 사용자
로그인하지 않음
토론
기여
계정 만들기
로그인
IT 위키
검색
Primary Copy Two-Phase Locking
편집하기
IT 위키
이름공간
문서
토론
더 보기
더 보기
문서 행위
읽기
편집
원본 편집
역사
경고:
로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다.
로그인
하거나
계정을 생성하면
편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.
스팸 방지 검사입니다. 이것을 입력하지
마세요
!
'''Primary Copy Two-Phase Locking (2PL)''' is a concurrency control protocol used in distributed database systems where a primary copy of each data item is designated for lock management. Transactions must obtain locks from the primary copy of the data item to ensure consistency and serializability across the system. ==Key Concepts== *'''Primary Copy:''' A specific node in the distributed system is designated as the authoritative source for managing locks for a particular data item. *'''Consistency:''' By managing locks through the primary copy, the system ensures that all transactions follow a serializable schedule. *'''Two-Phase Locking:''' The protocol adheres to the Two-Phase Locking rules: **'''Growing Phase:''' Transactions acquire locks but do not release them. **'''Shrinking Phase:''' Transactions release locks but do not acquire new ones. ==How Primary Copy 2PL Works== The Primary Copy 2PL protocol operates as follows: #Each data item is associated with a primary copy stored at a specific node. #Transactions interact with the primary copy to acquire and release locks. #The primary copy follows the standard Two-Phase Locking protocol to manage locks. #Once a lock is granted by the primary copy, the transaction can read or write the data item at any replica site. ==Advantages== *'''Centralized Lock Management per Item:''' Simplifies lock management by delegating responsibility to the primary copy. *'''Consistency Guarantee:''' Ensures serializability by centralizing lock decisions at the primary copy. *'''Improved Performance:''' Reduces lock management overhead compared to fully distributed locking. ==Limitations== *'''Single Point of Failure:''' If the primary copy node fails, the data item becomes unavailable for transactions. *'''Communication Overhead:''' Lock requests and updates must be routed through the primary copy, increasing network traffic. *'''Limited Scalability:''' High contention for locks on frequently accessed data items can lead to bottlenecks. ==Example of Primary Copy 2PL== Consider a distributed database where: *Node 1 hosts the primary copy of data item A. *Node 2 hosts the primary copy of data item B. ===Scenario=== Transaction T1 and T2 execute as follows: {| class="wikitable" !Step!!Transaction T1!!Transaction T2!!Primary Copy Action |- |1||BEGIN TRANSACTION||BEGIN TRANSACTION||Both transactions start. |- |2||READ(A)||-||T1 requests a shared lock for A from Node 1 (primary copy for A). |- |3||-||WRITE(A)||T2 requests an exclusive lock for A from Node 1 but must wait as T1 holds a shared lock. |- |4||COMMIT||-||T1 releases the lock on A. |- |5||-||WRITE(A)||T2 acquires the exclusive lock on A and writes. |- |6||COMMIT||-||T2 releases the lock. |} ==Applications== Primary Copy 2PL is used in distributed systems where: *'''Global Consistency:''' Strict transaction isolation and serializability are required. *'''Read-Heavy Workloads:''' Reduces contention for locks by allowing transactions to read from replicas while acquiring locks from the primary copy. *'''Simplified Locking:''' Centralizing lock management for each data item simplifies implementation. ==Comparison with Primary Site 2PL== {| class="wikitable" !Feature!!Primary Copy 2PL!!Primary Site 2PL |- |Lock Management||Delegated to primary copy for each data item||Centralized for all operations on the primary site |- |Fault Tolerance||Affected by failure of the primary copy||Affected by failure of the primary site |- |Communication Overhead||Moderate (per data item)||Potentially higher for all transactions |- |Scalability||High (per data item)||Moderate (site-wide management) |} ==Challenges== Primary Copy 2PL faces the following challenges: *'''Replication Coordination:''' Ensuring consistency between the primary copy and replicas requires additional communication. *'''Hotspots:''' Frequently accessed data items can create contention on their primary copy. *'''Recovery Complexity:''' Managing recovery after a primary copy failure requires synchronization with replicas. ==See Also== *[[Two-Phase Locking]] *[[Primary Site 2PL]] *[[Distributed Database]] *[[Concurrency Control]] *[[Deadlock Detection]] *[[Replication]] *[[Serializability]] [[Category:Database]]
요약:
IT 위키에서의 모든 기여는 크리에이티브 커먼즈 저작자표시-비영리-동일조건변경허락 라이선스로 배포된다는 점을 유의해 주세요(자세한 내용에 대해서는
IT 위키:저작권
문서를 읽어주세요). 만약 여기에 동의하지 않는다면 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다.
저작권이 있는 내용을 허가 없이 저장하지 마세요!
취소
편집 도움말
(새 창에서 열림)
둘러보기
둘러보기
대문
최근 바뀜
광고
위키 도구
위키 도구
특수 문서 목록
문서 도구
문서 도구
사용자 문서 도구
더 보기
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보
문서 기록