adapter: gracefully handle newer versions in migration shard #34037
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this change, if the leader environment restarted either during an in-progress 0dt upgrade or after an aborted one, it would fail to come up if that 0dt upgrade caused builtin item migrations to occur. The new version would poison the migration shard, and the old version would halt itself upon reading it.
This PR applies the minimal fix: When performing builtin item migrations in leader mode, we now ignore the existence of newer versions in the migration shard, instead of crashing upon observing them. Read-only processes still crash upon observing newer versions.
Additionally, this PR also introduces graceful skipping of undecodable entries in the migration shard. This lets a future version change the format of these entries without interfering with older versions that don't understand the new format.
This change is meant to derisk subsequent releases before the rewrite of the builtin item migrations lands. In contrast to that rewrite, this change is small enough to be backported into previous versions, so we can deploy it prior to the next release that requires migrations to occur.
Motivation
Stopgap for https://github.com/MaterializeInc/database-issues/issues/9755
Tips for reviewer
See discussion in Slack.
Checklist
$T ⇔ Proto$Tmapping (possibly in a backwards-incompatible way), then it is tagged with aT-protolabel.