Skip to main content
When fsync returns, POSIX says the data is on stable storage. This test checks what another reader of a Vercel Drive sees after the writer’s fsync has returned. Sandbox A mounts a Drive read-write, writes a 4 KiB file and a 64 MiB file with dd conv=fsync, runs sync on the directory, and records each file’s sha256. After a delay, the script reads the Drive without going through sandbox A:
  • snapshot: mount drive.snapshot() in a new sandbox. Vercel describes a snapshot as the Drive “as it was at the moment you mounted it”.
  • snapshot, writer still writing: the same, while sandbox A keeps writing other data to the Drive.
  • fork: drive.fork(), then mount the fork in a new sandbox.
  • stop: call sandbox.stop() on sandbox A right after fsync, then mount the Drive read-write in a new sandbox.
Each file is reported as ok, missing (not present), or corrupt (wrong sha256).

Results

Region pdx1, 10 trials per cell. The delay is the time from fsync returning to the snapshot or fork request; the reading sandbox takes about another 0.8 s to start. A Drive fsync is therefore not durable: when it returns, the write hasn’t reached the storage that snapshots and forks are made from.
  • Corrupt copies: the 64 MiB file was full size, but its last 12 to 28 MiB read as zeros. Reading it again 60 s later, with the reader’s page cache dropped, returned the same zeros.
  • Stop, then mount read-write: the file was intact in 10 of 10 trials, and the Drive could be mounted again about 3 s after fsync returned. Stopping a sandbox lets Vercel flush the host before handing the Drive to the next sandbox, so this doesn’t show what happens if the host fails, which a user can’t test.
  • Archil: an Archil disk mounted in a new sandbox right after fsync returned had both files intact in 20 of 20 trials. An Archil fsync returns once the write is stored redundantly across Availability Zones; see Data durability.

Run it

The script uses only the Vercel Python SDK and standard tools in the sandbox. It creates its own Drive and sandboxes and deletes them when it finishes; use a dedicated project.
vercel-fsync-durability.py