Document the one-second mtime change-detection window as a known limitation #12
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Change detection compares
old.mtime < ev.rec.mtime(scan.go:246) where mtime isModTime().Unix()(scan.go:574,scan.go:713) — whole seconds. A file rewritten in place, at the same size, within the same wall-clock second as the recorded mtime is classifiedunchangedand keeps its stale hashes forever. No later scan will ever notice.The code matches the spec: README §Database defines
mtimeas Unix seconds and §scan mode describes the skip rule in those terms. The problem is that README §scan mode also promises "the database only ever contains signatures verified by the most recent scan that covered them", which reads as a stronger guarantee than the implementation gives.Two ways to close the gap.
Option A (recommended): document it. Add it to the existing "Known limitation (accepted)" list. Cost: zero. The window requires a same-second, same-size, in-place rewrite, which is rare for the target workload of media, downloads and extracted archives.
Option B: store nanosecond mtime. Eliminates the window permanently, and pre-1.0 is the only free moment to change the schema. But
PRAGMA user_versionwould go to 2, and README §Database makes any unrecognized version fatal — so every existing database is invalidated and every deployment pays a full re-hash of every file. At the stated 150 TB scale that is a very expensive answer to a very rare failure.Going with Option A. Reopen or comment if you would rather pay for Option B before the tag; after 1.0 it becomes a real migration.
Definition of done
make checkgreen.