I have a question regarding implementation two-phase-commit protocol in zookeeper cluster to coordinate certain transaction among multiple client connections. Right now I have the following idea:
C
register transaction node /app/tx
/app/tx/%d (Ni)
Ni
Ni
about new transaction tx
Ni
checks that its node is created Ni
sets transaction to prepare()/abort() C
recieves the result from all the parties and decides abort/continue Ni
executes query N
i notifies C
with ok/fail C
decides abort|commit C
notifies everybody about the result. tx
is commited But I am not sure is it a right direction ? And I am not sure how to implement this in python kazoo or any other language (Java)? It would be nice if you can help me by providing snippet or correcting my algorithm ? In addition, how to extend this protocol for inter-zookeeper communication? Say, we maintain multiple different zookeeper clusters that are wrapped into zones or any other abstract entity and we would like to perform such explicit transactions on particular zone using two-phase commit ?
An important tweak to your algorithm based on 2PC using Zk is,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.