Skip to content

db: derive minimumFormatMajorVersion from contents in Batch.Apply#6088

Merged
annrpom merged 1 commit into
cockroachdb:masterfrom
annrpom:annie/setrepr-fmv-ratchet
Jun 1, 2026
Merged

db: derive minimumFormatMajorVersion from contents in Batch.Apply#6088
annrpom merged 1 commit into
cockroachdb:masterfrom
annrpom:annie/setrepr-fmv-ratchet

Conversation

@annrpom

@annrpom annrpom commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Previously, Batch.Apply asserted (under invariants) that the source batch's minimumFormatMajorVersion was at least the minimum required by each record kind. Not all batch construction paths populate the field; for example, SetRepr on a batch with a nil db skips refreshMemTableSize and leaves minimumFormatMajorVersion at zero

Replace the assertion with a ratchet of the receiver's minimumFormatMajorVersion from the per-kind lookup table. The receiver ends up with the correct floor regardless of how the source batch was constructed.

Previously, Batch.Apply asserted (under invariants) that the source
batch's minimumFormatMajorVersion was at least the minimum required by
each record kind. Not all batch construction paths populate the field;
for example, SetRepr on a batch with a nil db skips refreshMemTableSize
and leaves minimumFormatMajorVersion at zero

Replace the assertion with a ratchet of the receiver's
minimumFormatMajorVersion from the per-kind lookup table. The receiver
ends up with the correct floor regardless of how the source batch was
constructed.
@annrpom
annrpom requested a review from RaduBerinde June 1, 2026 21:35
@annrpom
annrpom requested a review from a team as a code owner June 1, 2026 21:35
@cockroach-teamcity

Copy link
Copy Markdown
Member

This change is Reviewable

@RaduBerinde RaduBerinde left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@RaduBerinde made 1 comment.
Reviewable status: 0 of 1 files reviewed, all discussions resolved.

@annrpom

annrpom commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

TFTR! ('-')7

@annrpom
annrpom merged commit 615cb41 into cockroachdb:master Jun 1, 2026
8 checks passed
@annrpom
annrpom deleted the annie/setrepr-fmv-ratchet branch June 1, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants