Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sstable: add ComparePrev, SetSnapshotPinnedProperties to RawWriter #3978

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

jbowens
Copy link
Collaborator

@jbowens jbowens commented Sep 27, 2024

Extend the RawWriter interface to support two additional methods required by compactions. The RawRowWriter.UnsafeLastPointUserKey method is adapted into ComparePrev so that it may be implemented by RawColumnWriter without materializing the previous key.

@jbowens jbowens requested a review from a team as a code owner September 27, 2024 19:45
@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:

Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @jbowens)


internal/compact/splitting.go line 209 at r1 (raw file):

// INVARIANT: nextUserKey must match the current frontier.
func (s *OutputSplitter) ShouldSplitBefore(
	nextUserKey []byte, estimatedFileSize uint64, comparePrevFn func([]byte) int,

[nit] I think we should make this equalToPrevFn func([]byte) bool so we don't have to worry about which key is on which side of the comparison

Copy link
Collaborator Author

@jbowens jbowens left a comment

Choose a reason for hiding this comment

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

TFTR!

Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @RaduBerinde)


internal/compact/splitting.go line 209 at r1 (raw file):

Previously, RaduBerinde wrote…

[nit] I think we should make this equalToPrevFn func([]byte) bool so we don't have to worry about which key is on which side of the comparison

Good idea

Extend the RawWriter interface to support two additional methods required by
compactions. The RawRowWriter.UnsafeLastPointUserKey method is adapted into
ComparePrev so that it may be implemented by RawColumnWriter without
materializing the previous key.
@jbowens jbowens merged commit 5e5904a into cockroachdb:master Sep 27, 2024
12 checks passed
@jbowens jbowens deleted the rawwriter-extensions branch September 27, 2024 20:09
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