Commit fff659e
authored
sync: key the scan cache locally, and replicate the executable bit (#47)
Two changes with one theme: fabric should agree with git about what a catalog
is, and a local cache must never take its key from a replicated structure.
THE CACHE. scan_folder reused a recorded hash when size and mtime matched what
the MANIFEST held. The manifest crosses the wire, so a local caching decision
was made from a value another machine chose. Two contending entries of equal
size could collide on size plus mtime, the cache reported content the file did
not hold, and the versions leapfrogged forever. That was the permanent
three-node divergence, and removing mtime stamping only removed the mechanism
that manufactured the collision, not the conflation that believed it.
A separate scan_cache now records what THIS machine observed on its own disk,
and never crosses the wire. It is deliberately NOT merged into the observed
receipt: that receipt decides whether a missing path becomes a tombstone, and a
tombstone is sent to peers, so loading a performance concern onto it would
repeat the original mistake mirrored. Two structures, two jobs. It is filled
only from real disk reads, never from a requested value, so a filesystem that
truncates a timestamp cannot make it miss forever. Absent in an older state
file, where serde default gives an empty one that warms on the first scan.
THE EXECUTABLE BIT. Fabric tracked content and nothing else. Git tracks content,
the executable bit and symlinks, and deliberately not mtime. The synced catalog
holds fabric binaries, and they arrived without the bit and could not be run
until somebody chmod-ed them by hand. The bit is now recorded and applied before
the atomic rename, so a file is never briefly visible with the wrong mode.
FileMeta.mtime is demoted rather than removed. It is documented as informational
and is never applied. Removing it would break parsing on any peer not yet
upgraded, because the field has no serde default; adding a field with a default
is safe in a way removing one is not.
Symlinks are still skipped, but they now say so and say that git tracks them.
Silence was the problem.
ONE CAUSE, TWO SYMPTOMS, NAMED IN ONE PLACE. local_write returns early when the
content hash is unchanged, which is what makes applying a peer's content
echo-free. So no change that alters zero bytes can propagate. An invisible
heartbeat and an invisible chmod are the same defect, not two. Both symptoms are
pinned by tests that assert they still do NOT propagate, so nobody fixes one and
assumes the other followed, and the chmod case is recorded as a DIVERGENCE FROM
GIT rather than an implementation note.
Verified by sabotage, not only by green: dropping mtime_nanos from the cache key
fails the sub-second test AND the three-node stress; never applying the mode
fails the executable test.
211 lib tests green, plus lifecycle, provisioning and the real-iroh sync slice.1 parent 560f83c commit fff659e
5 files changed
Lines changed: 701 additions & 128 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
11 | 71 | | |
12 | 72 | | |
13 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
850 | 850 | | |
851 | 851 | | |
852 | 852 | | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
853 | 884 | | |
854 | 885 | | |
855 | 886 | | |
| |||
0 commit comments