Merge branch 'localdb-per-table-snapshot' — LocalDb 0.3.0 pin: per-table needs_snapshot baselining (residual #2 / R1)

This commit is contained in:
Joseph Doherty
2026-08-15 03:44:53 -04:00
4 changed files with 30 additions and 4 deletions
@@ -118,6 +118,17 @@ public static class SiteLocalDbSetup
// to any genuine remote write of the same key and wins only where the peer has no
// version at all. It is idempotent (ON CONFLICT DO NOTHING) and therefore free on
// every boot after the first, which is why it is unconditional rather than a flag.
//
// The PER-TABLE loop is load-bearing as of LocalDb 0.3.0, not just tidy. The snapshot
// flag baselining raises is now per-table, and it is raised by the call that actually
// seeded something — so adding an ELEVENTH table to ReplicatedTables on an already
// replicating site now streams a snapshot of that one table, where through 0.2.x the
// flag was a single per-database bit and the same edit re-streamed all eleven in full,
// in both directions. Nothing about the first boot changes: enabling replication on a
// site that has been running without it seeds all ten at once, the flagged set is
// therefore every registered table, and the library sends that as an ordinary full
// snapshot. A hypothetical "register the whole list in one call" API would silently
// give the coarse behaviour back.
foreach (var table in ReplicatedTables)
db.RegisterReplicated(table, baselineExistingRows: true);