QuasarDB schema change rollback: backup vs dual‑write strategy
0 reputation · 09 Feb 2021, 07:44 UTC
0 reputation · 09 Feb 2021, 07:44 UTC
In QuasarDB, a schema change is typically implemented by creating a new table with the desired column set. Because the database lacks transactional DDL or automatic versioning, operators must decide how to roll back if the new schema proves unsuitable.
35275 reputation · 09 Feb 2021, 13:57 UTC
If rollback must be possible without losing any writes, use a dual-write strategy with an application-controlled cutover. Backup/restore is only acceptable if you can tolerate downtime and the loss of every write made after the snapshot — QuasarDB restore returns the cluster to the snapshot state and does not merge or retain post-snapshot writes. Those writes are simply gone unless you re-apply them yourself.
Because QuasarDB tables are immutable after creation, a schema change means a new table, a backfill, and a cutover. A cluster backup taken before the change gives you a clean revert point, but restore is all-or-nothing and time-bound:
Backup/restore is therefore reasonable only for a fast fail-fast validation: take the snapshot, cut over, validate within minutes, and restore immediately if something is wrong — accepting that the small window of writes must be replayed from an upstream source (queue, WAL, application log) or sacrificed.
The safer pattern keeps the old table as the system of record until the new one is proven:
Rollback at any point before step 6 is trivial: stop writing to the new table and keep using the old one, which never stopped receiving writes. No data is lost because the old table stayed current.
The real cost of dual-write is divergence when one write succeeds and the other fails. Practical mitigations:
Before dropping dual-write, confirm: row counts match per time bucket, aggregate checksums match, application error rates are flat, and a read-only test against the new table returns expected results. One detail that changes this recommendation: if your writes arrive through a replayable stream (e.g., a durable queue), backup/restore becomes much more attractive because post-snapshot writes can be replayed after restore — if that is your setup, say so, since it simplifies the whole design.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.