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 assert in background compression and encryption. #1366

Merged
merged 3 commits into from
Jun 15, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions table/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,12 @@ func (b *Builder) handleBlock() {
// that means the data from this block cannot be stored in its existing
// location and trying to copy it over would mean we would over-write
// some data of the next block.
y.AssertTruef(uint32(len(blockBuf)) <= item.end+padding,
"newend: %d item.end: %d padding: %d", len(blockBuf), item.end, padding)
allocatedSpace := (item.end - item.start) + padding

Choose a reason for hiding this comment

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

This may be off by 1.

y.AssertTruef(uint32(len(blockBuf)) <= allocatedSpace,
"newend: %d item.end: %d padding: %d",
(allocatedSpace-uint32(len(blockBuf)))+item.end,
item.end,
padding)

// Acquire the buflock here. The builder.grow function might change
// the b.buf while this goroutine was running.
Expand Down