Atomic Test And Set Of Disk Block Returned False For Equality |top| 🆒 🆕
Some storage devices (especially network-attached ones) do not support true atomic test-and-set across power failures or multiple initiators. If your device cannot guarantee sector-level write atomicity, you may see spurious equality failures. Switch to a device that supports NVMe’s Compare and Write or SCSI’s COMPARE AND WRITE command.
do expected = read_disk_block(block_id); new_value = expected + 1; while (!atomic_test_and_set(block_id, expected, new_value)); do expected = read_disk_block(block_id)
Let’s dissect what this means, why it happens, and why your database cluster might refuse to talk to itself because of it. new_value = expected + 1
: It often occurs in clustered environments where multiple hosts share the same datastore. A "false for equality" result means the host could not acquire a lock on the metadata because another entity had already updated or locked it. Let’s dissect what this means