Expand description
One-shot startup probe of the SQLite and file-system storage backends.
Consensus writes to disk on every view, taking the database’s (or data directory’s) single writer lock. A validator on a network filesystem, a volatile filesystem, or a disk with slow fsync sees that cost as consensus timeouts, with nothing pointing at the storage layer. This module answers that once per process start, and never fails startup: every part that can error degrades to an unknown/absent value and logs at DEBUG.
The fs backend never calls fsync itself (fs::Persistence writes via std::fs::write, which
does not sync); the fsync number still bounds sync_data cost there, and the filesystem
classification is backend-neutral either way.
Structs§
- FsInfo
- Fsync
Stats p50/maxtime the whole write loop (seek+write_all+sync_data), so they measure durable-write latency, notsync_dataalone.- Sqlite
Pragmas - Storage
Probe
Enums§
- FsClass
- How suitable a filesystem is for a SQLite database that consensus writes to on every view.
Constants§
- BUDGET 🔒
- CONTAINER_
FS 🔒 - FSYNC_
ERROR 🔒 - p50 fsync latency above which the disk is logged as ERROR. Deliberately far above anything healthy, because there is no validated threshold yet: ordinary cloud block storage sits at 0.5-2ms and ZFS on an encrypted volume at ~3ms, so a lower bar flags working nodes. At half a second per commit a single durable write already costs a quarter of a ~2s view. Everything below this is reported as a number and left to the operator.
- LOCAL_
FS 🔒 - MAX_
SAMPLES 🔒 - MOUNTINFO_
PATH 🔒 - NETWORK_
FS 🔒 - Filesystem types where POSIX advisory locking is unreliable: remote/distributed filesystems,
the FUSE drivers that proxy to one, and the host-shared mounts Docker Desktop, Colima, Lima
and VirtualBox use to bind a directory from outside the VM/container. Other
fuse.*drivers (e.g.fuse.gocryptfs,fuse.bindfs) are local-backed, so they fall through toFsClass::Unknowninstead. - PROBE_
TIMEOUT 🔒 - Hard ceiling on the whole blocking half of the probe. Sampling is bounded to
BUDGET, so only an unresponsive filesystem gets near this: a single uninterruptiblefdatasyncorstatagainst a dead hard-mounted NFS server. Reaching it aborts startup, because a node that cannot touch its data directory cannot persist consensus state either. - VOLATILE_
FS 🔒
Functions§
- classify_
fs 🔒 - Unrecognized filesystem types are
FsClass::Unknownrather than assumed local; asserting safety for a filesystem this probe has never seen would defeat the point of probing. - fs_
class_ 🔒label - fsync_
probe 🔒 - Writes and syncs a scratch file inside
dir, sized topage_size(SQLite’s own page size, or 4096 if unknown), and returns fsync latency stats. The file is written and synced once before sampling to preallocate its page; each sample then seeks back to the start and overwrites in place, mirroring SQLite’s steady-state writes rather than growing the file every iteration, so thatsync_data(fdatasyncon Linux) need not flush changed metadata such as file size. - log_
fs_ 🔒info - parse_
mountinfo 🔒 - Longest mount point that is a prefix of
path.pathis already canonicalized. - parse_
mountinfo_ 🔒line - Parses one
/proc/self/mountinfoline into(mount_point, fs_type, source). - probe
- Runs the blocking half on a dedicated thread under
PROBE_TIMEOUT, and returns an error if it expires.canonicalizeis inside that half deliberately:staton a hung hard mount blocks uninterruptibly, so the classification can hang before the fsync probe is even reached. - resolve_
fs_ 🔒info - unknown_
fs_ 🔒info