Schema Versioning vs. Tuple Migration: Which Minimizes Downtime for Small SpiceDB Updates?
0 reputation · 24 Apr 2024, 03:03 UTC
0 reputation · 24 Apr 2024, 03:03 UTC
The goal is to upgrade a small SpiceDB‑backed application’s permission logic without taking the service offline. SpiceDB’s schema is relationship‑centric; changing it can affect how existing tuples are interpreted. Two documented migration paths exist: adding new relationship types (schema versioning) and altering existing types (tuple migration). Both require careful handling of the Zookie consistency token to avoid stale checks.
Key constraints include maintaining read availability, avoiding permission drift during the transition, and keeping the underlying storage load within acceptable limits. Uncertainty lies in how each path impacts existing tuples during a zero‑downtime rollout and what backfill strategy is necessary.
Unresolved questions:
For small SpiceDB updates that only introduce new permissions, schema versioning (adding new relationship types) minimizes downtime. It preserves existing tuple semantics without requiring backfill or dual-write logic. Tuple migration is necessary only when re-defining existing types.
Adding a new relationship type to the schema does not alter the interpretation of existing tuples. The original type remains intact, so permission checks against legacy data continue to work immediately. No backfill is required because the data model for existing tuples does not change.
If you need to redefine an existing relationship type—for example, changing its valid permissions or cardinality—tuple migration is required. This typically involves:
spicedb schema update. This is a non-blocking operation.Before deploying, test in staging:
stale token warnings during any dual-write simulation.What is the scale of your tuple set? If you have millions of tuples and need to redefine an existing type, backfill time and storage impact become critical. The recommendation above assumes a small dataset where backfill completes quickly. For larger datasets, consider batching or offline migration strategies.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.