3 ms·
I've implemented interval tree clocks, they're not the most accessible idea. Condensed rationale: Logical clocks are used to keep track of the ordering of even
by hedgehog 6y ago
I've implemented interval tree clocks, they're not the most accessible idea. Condensed rationale:
Logical clocks are used to keep track of the ordering of events in distributed systems, for example updates in a multi-master database. With a single node you can just stamp each update with a sequence number from a counter. With multiple nodes a single counter doesn't work, for starters because of the race condition. You can instead use an array of sequence numbers, with one slot updated by each node and one counter per node. These vectors then are perfectly ordered locally and globally mostly ordered. That's the idea behind "vector clocks".
Vector clocks don't by themselves handle the case of adding and removing nodes. Interval Tree Clocks do the same job as vector clocks but allow adding + removing nodes without relying on some out of band process. The price is complexity.
There's a whole lot of published work but you can get most of the idea from Wikipedia:
https://en.wikipedia.org/wiki/Logical_clock https://en.wikipedia.org/wiki/Logical_clock
https://en.wikipedia.org/wiki/Vector_clock https://en.wikipedia.org/wiki/Vector_clock