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

Fix(builder): Too many small tables when compression is enabled #1549

Merged
merged 4 commits into from
Oct 3, 2020

Conversation

ahsanbarkati
Copy link
Contributor

@ahsanbarkati ahsanbarkati commented Oct 1, 2020

This fixes the issue of too many sst files of very small sizes when compression is enabled. We now account for the actual sizes of blocks after compression and we assume that the table capacity is reached if the sum of actual sizes of block buffers is more than 90% of the table capacity.


This change is Reviewable

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm: One comment.

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ahsanbarkati, @ashish-goswami, and @jarifibrahim)


table/builder.go, line 364 at r1 (raw file):

		5*(uint32(len(b.tableIndex.Offsets))) // approximate index size

	return estimateSz >= uint32(float64(cap)*0.90)

Do the calculation upfront, and set cap to that calculation.

@jarifibrahim jarifibrahim merged commit 5d1bab4 into master Oct 3, 2020
@jarifibrahim jarifibrahim deleted the ahsan/builder branch October 3, 2020 15:03
jarifibrahim pushed a commit that referenced this pull request Oct 5, 2020
…ed (#1549)"

This reverts commit 5d1bab4.
We'reverting this commit because it seems to cause a strange issue while
writing data. Running `go run -tags main.go benchmark write --sorted
--compression=true --block-cache-mb=100` creates a directory which does
not have all the keys. I don't know why this would fix the issue but the
test works fine after reverting this commit.
jarifibrahim pushed a commit that referenced this pull request Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants