问题
From the Zookeeper docs:
ctime The time in milliseconds from epoch when this znode was created.
mtime The time in milliseconds from epoch when this znode was last modified.
I presume that Zookeeper somehow syncs the (internal) real clock of all the nodes in the ZK cluster in order the time stamps to be consistent regardless of the node where the client connects. Is that so? If yes, how does it work?
All I found is:
Real time
ZooKeeper doesn't use real time, or clock time, at all except to put timestamps into the stat structure on znode creation and znode modification.
That is, it uses logical time whenever it's possible, but it doesn't say if real clock is synced or not.
Thanks!
回答1:
No, the real clock is only used in ctime and mtime. The current leader used the real clock to set a TxnHeader in the request, and then used as the ctime and mtime of zNode.
来源:https://stackoverflow.com/questions/19554377/how-does-zookeeper-synchronize-the-clock-in-the-cluster