예, 준비 메시지를 보내기 전에 실행됩니다. 모든 것이 이미 실행 된 후에 commit() 작업 내에서 전체 2PC 프로토콜이 실행된다고 가정해야합니다. 결국 커밋되는 분산 트랜잭션의 상상 된 다음 추적을 고려하십시오. 당신이 준비 메시지는 이전 트랜잭션의 컨텍스트 내에서 뭔가를 실행했다, 따라서 이전에 등록을 한 해당 사이트에 코디네이터로 전송됩니다 볼 수 있듯이, 사실
transactionalOperation() is a procedure at some client site
begin() is a remote invocation to the coordinator
create global XID
return global XID
XID is added to the thread-local context at the caller
executeOperation(params) is a remote invocation to a participant site
XID is implicitly propagated to the server side thread
inform coordinator that this site is a participant
execute the operation! (acquiring locks)
... more operations ....
commit() is a remote invocation to the coordinator
XID is implicitly propagated to the server side thread
-------------- 2PC starts here ----------------
for all registered participants:
prepare(XID) is a remote invocation to each site
make sure that the transaction can be committed,
usually by writing and flushing a log
return OK
gather decisions
for all reguistered participants:
commit(XID) is a remote invocation to each site
log transaction commit
(release locks)
-------------- 2PC ends here ----------------
XID is removed from the thread-local context at the caller
transaction is complete!
: 들여 쓰기 프로 시저 중첩을 의미 거래에 참여한 사람.
출처
2012-11-17 16:38:49
jop
2PC가 시작되기 전에 두 번 이상의 통신 왕복이 발생 했습니까? 정확하게 얼마나 많은 오버 헤드 왕복이 발생하고 있습니까? executeOperation 후 2PC가 시작되기 전에 코디네이터가 실패하면 어떻게됩니까? – user782220
트랜잭션을 시작하기 위해 코디네이터를 한 번 더 왕복 여행 한 다음 각 참가자를 등록하기 위해 하나를 추가로 왕복합니다. 커미트가 커밋 전에 실패하면, 모든 참여자는 트랜잭션의 일방적 인 롤백을 자유롭게 할 수 있기 때문에 차단이 없습니다. – jop