4 ms·
"Here fsync at every write is mandatory because if nodes go down and restart, they MUST have the latest value of the “current” key." Why could not a node that
by fernly 11y ago
"Here fsync at every write is mandatory because if nodes go down and restart, they MUST have the latest value of the “current” key."
Why could not a node that is restarting, simply do the algorithm and set its own "current" from the $NEXTID it gets? In other words, a single failed-restarting node does not need to rely on having a recent disk value for "current", as long as it can call on a majority of non-failed nodes.
Only if _all_ nodes failed (a system-wide crash) and had to restart, the consensus value of "current" might be less than some (possibly all, if it reset to 0) IDs that were issued prior to the crash.
However there could be a protocol for recovery from a system-wide crash, requiring all nodes, before they go on-line, to scan their most recent ID-stamped transactions and start their "current" at the maximum seen. Then following this disaster you might issue IDs that were less than some that were issued pre-crash, but it would not matter if none of the "lost" IDs were never recorded in transactions.
- skybrian 11y agoThe problem is a single node doesn't whether it can safely skip fsync or not, because it doesn't know what's going on with the other nodes. In the case of three nodes recieving an update and dying at once in a five node system, the first node to recover needs to tell the other two what happened.