Zero 0.20

Full Supabase support, performance improvements

Install

npm install @rocicorp/zero@0.20

Upgrading

There are two config changes for multinode deployments:

  • Required: Remove view-syncer's ZERO_CHANGE_STREAMER_URI env var and replace it with ZERO_CHANGE_STREAMER_MODE: "discover".
  • Optional: Change the ZERO_LITESTREAM_BACKUP_URL env var from being passed to both replication-manager and view-syncer nodes to being passed only to replication-manager. This config is no longer needed by view-syncer (and is ignored by it).

See hello-zero for an upgrade example using SST.

Additionally, the ZERO_TENANTS_JSON, feature was removed. We do not think anyone was using it, but if you were please reach out to us for options.

Features

  • Supabase is now fully supported. After upgrading, you should see that schema changes are incremental and don't reset the replica (docs).
  • Improve performance of single-key reads on client. Scale depends on size of data but 100x improvement is common (PR).
  • Implement short-circuiting for or queries. Because of permissions, one or more branches of or would often be empty, turning the entire or into a full-table scan. 100x improvement on chinook test dataset (PR).
  • Remove DNF conversion. This was intended to make consistency easier in the future, but was resulting in some queries exploding in size (PR, bug).
  • Autodiscovery for replication-manager. view-syncer nodes now find replication-manager using the Postgres changedb database, and no longer need an internal load balancer. See the new ZERO_CHANGE_STREAMER_MODE: "discover" config in the deployment docs (PR).
  • Make ZERO_LITESTREAM_BACKUP_URL specific to replication-manager. view-syncer nodes now ignore this config and learn it from replication-manager instead. This makes restarting replication less error-prone (PR, discussion).
  • OpenTelemetry support (docs).

Fixes

  • Allow dots in column names (only works with custom mutators) (PR).
  • Fix websocket liveness check to avoid false negatives when busy (PR).
  • Fix unhandled exception in zero-cache when processing query eviction (PR).
  • Keep microsecond precision across timezones (PR).
  • Fix unhandled exception in zero-cache during handleClose (PR).
  • Fix NOT IN in z2s (PR).
  • Mutators: assert provided columns actually exist (PR).
  • Fix ordering of columns in replicated index (PR).
  • Use a shorter keepalive for replication stream for compat with Neon (PR).
  • Allow destructuring where in query.related (PR).
  • Add flow control for large change DB transactions (PR).
  • Fix z2s handling of pg types with params (char, varchar, numeric, etc) (PR).
  • Support from and --schema-path in analyze-query (PR).

Breaking Changes

  • The autodiscovery feature for replication-manager is a breaking change for multinode deployments. See the upgrade instructions for details.
  • The ZERO_TENANTS_JSON config was removed 🫗.
  • The ZERO_INITIAL_SYNC_ROW_BATCH_SIZE config was removed. It is no longer needed because initial sync now adapts to available memory automatically.