Zero 1.6
Postgres 17 Replication Failover and Performance
Installation
npm install @rocicorp/zero@1.6Upgrading
PlanetScale Replication Failover
Previous Zero versions lost replication slots after a PlanetScale Postgres failover, forcing resync. Zero 1.6 fixes this problem. To enable support, run zero-cache with ZERO_UPSTREAM_PG_REPLICATION_SLOT_FAILOVER=true. You must then do a resync, and register the full range of slots in PlanetScale's failover configuration. See High Availability and Failover for the full setup.
Features
- Litestream Region: Added support for deployments in non-standard AWS partitions like GovCloud (thanks @ericykim!).
Performance
- ~5% CPU reduction in replication-manager benchmarks by reusing stringified payloads across subscribers
- Faster
EXISTSsubqueries via the newCapoperator — can turn exists-heavy queries that previously timed out into ones that complete in milliseconds - Bulk-insertion optimization in Replicache via
putMany, speeding up large sync patches (3-5x faster for typical sync batches, up to 50x+ for large preloads) - Batch deletes/upserts in
SQLiteStorewrites (~8x faster on 1k-put commits) - Batch concurrent
SQLiteStoreget/hasreads into fewer database queries - Parallelize I/O during pull and rebase
- Heap-based k-way merge in
fetchMergeSort(O(log K) per row vs O(K)) - Initial sync progress reporting uses
pg_classestimates instead of full scans - De-dupe SQLite requests in flip-join when children want the same parent
zero-sqlite3now gathers up to 128 STAT4 samples per index, improving SQLite query planning for skewed indexed data
Fixes
- Returning to an app after stale-tab GC or CVR purge caused a full page reload
"Row already exists"assertion failures during poke processing- Deadlock during post-initial-sync
changeLogreset - Zombie
ViewSyncers inflatedactive-client-groupsmetric ConcurrentModificationExceptionnow reconnects instead of erroringzero-cachestartup errors during change-streamer init not publishedTypeError: Expected string at context.query. Got null- Replication slots were lost after a PlanetScale Postgres failover
- Replication slot creation timeouts crashed the server during backfill retries
- Shadow sync threw when a synced table could not be queried by ZQL
- Shadow sync now reports metrics and logs verification-success counts
- WebSocket errors are now logged as warnings instead of errors
- Inspector now reports last query hydration time instead of histogram
- Query/mutator functions now allow omitting
args - Reoduce log volume at
INFOlevel - Reclassify common Postgres config errors as warnings instead of errors
- Union-fan-in queries could ignore reverse ordering
- Abort
zero-cachewhen ChangeDB CDC tables go missing - CVR purge failures retried immediately in a tight loop instead of backing off
Breaking Changes
None.