Vitess Binary Rollback and MySQL State Interoperability
0 reputation · 17 Oct 2025, 22:47 UTC
0 reputation · 17 Oct 2025, 22:47 UTC
Vitess supports rolling upgrades by maintaining N and N-1 version compatibility between vtgate, vtctld, and vttablet. While stateless components like vtgate can be reverted by redeploying previous binaries, the vttablet interacts directly with the MySQL instance and the topology server.
Certain upgrades introduce changes to the _vt database, MySQL system tables, or topology records. If an upgrade fails after these on-disk artifacts have been modified, reverting to the N-1 vttablet binary may result in an incompatible state where the older version cannot interpret the updated metadata.
The documented recovery path often suggests restoring from a pre-upgrade backup to ensure consistency, but this approach results in data loss for any writes accepted during the upgrade window unless a binlog-based replay is performed.
vttablet remain viable if the upgrade process has already modified the topology or sidecar schema?31275 reputation · 18 Oct 2025, 08:28 UTC
A binary-only downgrade of vttablet is viable only if the failed upgrade left no incompatible on-disk or topology state behind: the _vt sidecar schema is unchanged (or changed only additively), topology records still parse under the old binary, no vreplication or online-DDL workflows were created or advanced under the new version, and MySQL itself was not upgraded. If any of those conditions fails, the safe path is restoring the pre-upgrade backup and replaying binlogs to recover writes accepted during the upgrade window.
Vitess's version compatibility promise is about mixed-version operation during a rolling upgrade — an N-1 vtgate talking to an N vttablet, and vice versa. It is not a promise that an older binary can correctly interpret state written by a newer one. That asymmetry is the core of your question:
vttablet may fail to load them at startup. The failure mode here is usually loud — the tablet won't come up healthy — which is actually the better outcome._vt sidecar database. This is the subtler risk. Purely additive migrations (new tables, new columns) are often tolerated because vttablet queries explicit column lists rather than SELECT *. But semantic changes — altered vreplication state values, changed position or timestamp encodings, resumable-DDL redo tables — can make the N-1 binary misbehave silently: it starts, serves, and quietly does the wrong thing._vt database plus some global variables and users. But if your upgrade bundled a MySQL minor/major upgrade, the old mysqld may be unable to open the data directory at all — MySQL in-place downgrades are heavily restricted and are a separate problem from the Vitess rollback.Binary rollback alone is sufficient when all of the following hold:
_vt schema is identical to its pre-upgrade state, or differs only additively.In that case: stop the new vttablet, start the N-1 binary, and verify — tablet health via vtctldclient, replication lag, and that any existing vreplication streams resume. Do not treat "process is up" as proof of correctness; check replication and throttler behavior explicitly.
A full restore is required when any of these is true:
Restore the pre-upgrade backup — not a backup taken by the newer version, whose metadata or format N-1 may not understand — then replay binlogs from the backup's position forward to recover writes accepted during the upgrade window.
If the rolling upgrade was interrupted mid-fleet, any replica still running N-1 with intact state can serve as the source to resync the affected tablet (re-parent or restore-from-peer depending on your setup). This avoids both the full restore and the data-loss trade-off, and is often the fastest recovery when only one or two tablets got as far as writing new state.
Before choosing a path, establish facts rather than inferring them from how far the upgrade appeared to get:
SHOW CREATE TABLE for each _vt table against a pre-upgrade capture or a still-on-N-1 peer.etcdctl, zkCli, or Consul, depending on your topo implementation) for the Vitess key prefix.The specific viability of any rollback depends on the exact N to N-1 pair and on what your upgrade actually executed; treat the criteria above as the decision framework, and confirm against the version-specific release notes. If you can share which two versions are involved and whether the upgrade reached the point of running sidecar migrations, the recommendation can be narrowed further. For next time: take a fresh backup and a topo export immediately before upgrading, quiesce vreplication workflows, and keep the vttablet upgrade window short — then a rollback never has to trade data loss against consistency.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.