How does zookeeper ensure the order consistency of transactions?

Alibaba cloud Q & A 2022-02-13 06:01:29 阅读数:314

zookeeper ensure order consistency transactions

zookeeper How to ensure the order consistency of transactions ?




Take the answer 1:

zookeeper A global incremental transaction is used Id To mark , be-all proposal( proposal ) It was added when it was proposed zxid,zxid It's actually a 64 Digit number , high 32 Is it epoch( period ; An era ; the ; The new age ) Used to identify leader cycle , If there's a new one leader To produce ,epoch Will increase by itself , low 32 Bits are used to increment the count . When new things come into being proposal When , According to the two-stage process of database , First of all, I'll talk to others server Issue transaction execution request , If more than half of the machines can execute and succeed , Then it will start to execute .


copyright:author[Alibaba cloud Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130601279547.html