Skip to content

sstable: return error from EncodeSpan on same-boundary trailer misord…#5855

Merged
sumeerbhola merged 1 commit intocockroachdb:masterfrom
sumeerbhola:missing_err_return
Mar 23, 2026
Merged

sstable: return error from EncodeSpan on same-boundary trailer misord…#5855
sumeerbhola merged 1 commit intocockroachdb:masterfrom
sumeerbhola:missing_err_return

Conversation

@sumeerbhola
Copy link
Collaborator

…ering

RawColumnWriter.EncodeSpan had two error paths for span ordering violations: one for same boundaries with wrong trailer order, and one for overlapping different boundaries. The second path returned the error to the caller, but the first only stored it in w.err without returning, allowing the invalid span to be silently added to the block.

Add the missing return w.err so the error is surfaced immediately, consistent with the other error path.

@sumeerbhola sumeerbhola requested review from a team and RaduBerinde March 23, 2026 16:24
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

:lgtm:

@RaduBerinde made 2 comments.
Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion (waiting on sumeerbhola).


sstable/colblk_writer.go line 327 at r1 (raw file):

		}
		for i := range w.blockPropCollectors {
			if err := w.blockPropCollectors[i].AddRangeKeys(span); err != nil {

This path should also set w.err, since we already adjusted props and potentially added the keys to some block prop collectors.

…ering

RawColumnWriter.EncodeSpan had two error paths for span ordering
violations: one for same boundaries with wrong trailer order, and one
for overlapping different boundaries. The second path returned the error
to the caller, but the first only stored it in w.err without returning,
allowing the invalid span to be silently added to the block.

Add the missing `return w.err` so the error is surfaced immediately,
consistent with the other error path.

Additionally, set w.err on another path in addition to returning the
error.

Co-Authored-By: roachdev-claude <[email protected]>
Copy link
Collaborator Author

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

TFTR!

@sumeerbhola made 2 comments and resolved 1 discussion.
Reviewable status: 0 of 5 files reviewed, all discussions resolved (waiting on RaduBerinde).


sstable/colblk_writer.go line 327 at r1 (raw file):

Previously, RaduBerinde wrote…

This path should also set w.err, since we already adjusted props and potentially added the keys to some block prop collectors.

Done

@sumeerbhola sumeerbhola merged commit 656fb2a into cockroachdb:master Mar 23, 2026
8 of 9 checks passed
@sumeerbhola sumeerbhola deleted the missing_err_return branch March 23, 2026 18:41
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