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

colblk: implement synthetic prefix and suffix #3997

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RaduBerinde
Copy link
Member

@RaduBerinde RaduBerinde commented Oct 2, 2024

First commit is #3996

colblk: implement synthetic prefix and suffix

DataBlockIter now takes into account the synthetic prefix and suffix
transforms.

@RaduBerinde RaduBerinde requested a review from a team as a code owner October 2, 2024 23:57
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RaduBerinde
Copy link
Member Author

Forgot to add some benchmarks and compare the no-transform case before/after, will do that soon.

Copy link
Collaborator

@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.

:lgtm:

Reviewed 2 of 9 files at r2, all commit messages.
Reviewable status: 2 of 9 files reviewed, 2 unresolved discussions (waiting on @RaduBerinde)


sstable/colblk/data_block.go line 947 at r2 (raw file):

		!i.transforms.HideObsoletePoints &&
		!i.transforms.SyntheticPrefix.IsSet() &&
		!i.transforms.SyntheticSuffix.IsSet()

should we put this on a AnySet() Transforms method or the like?


sstable/colblk/data_block.go line 977 at r2 (raw file):

}

// seekGEInternal has is a wrapper around keySeeker.SeekGE which takes into

nit: s/has is/is/

Copy link
Member Author

@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.

TFTR!

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


sstable/colblk/data_block.go line 947 at r2 (raw file):

Previously, jbowens (Jackson Owens) wrote…

should we put this on a AnySet() Transforms method or the like?

Good point, done.

`DataBlockIter` now takes into account the synthetic prefix and suffix
transforms.
@RaduBerinde
Copy link
Member Author

Updated benchmark as well.
Short benchmark before/after:

name                                                                                old time/op    new time/op    delta
CockroachDataBlockIterShort/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8/Next-10           12.2ns ± 0%    12.6ns ± 0%  +3.05%  (p=0.001 n=7+7)
CockroachDataBlockIterShort/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8/SeekGE-10          114ns ± 0%     114ns ± 1%    ~     (p=0.454 n=8+8)
CockroachDataBlockIterShort/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128/Next-10      10.5ns ± 0%    10.5ns ± 0%  -0.28%  (p=0.024 n=8+8)
CockroachDataBlockIterShort/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128/SeekGE-10    91.0ns ± 0%    91.1ns ± 1%    ~     (p=0.555 n=8+8)

Transform benchmark shows very little difference, which is pretty cool!

name                                                                                                     time/op
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8/Next-10                         12.6ns ± 1%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8/SeekGE-10                        114ns ± 1%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8,SynthSeqNum/Next-10             12.8ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8,SynthSeqNum/SeekGE-10            114ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8,HideObsolete/Next-10            13.6ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8,HideObsolete/SeekGE-10           116ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8,SyntheticPrefix/Next-10         12.6ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8,SyntheticPrefix/SeekGE-10        116ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8,SyntheticSuffix/Next-10         13.0ns ± 4%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=8,Shared=4,ValueLen=8,SyntheticSuffix/SeekGE-10        117ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128/Next-10                    10.8ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128/SeekGE-10                  91.6ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128,SynthSeqNum/Next-10        10.8ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128,SynthSeqNum/SeekGE-10      91.7ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128,HideObsolete/Next-10       11.3ns ± 1%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128,HideObsolete/SeekGE-10     94.2ns ± 1%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128,SyntheticPrefix/Next-10    10.7ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128,SyntheticPrefix/SeekGE-10  94.1ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128,SyntheticSuffix/Next-10    10.9ns ± 0%
CockroachDataBlockIterTransforms/AlphaLen=8,Prefix=128,Shared=64,ValueLen=128,SyntheticSuffix/SeekGE-10  95.6ns ± 0%

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