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 all commits
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
14 changes: 7 additions & 7 deletions table/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ func (b *Builder) handleBlock() {
blockBuf = eBlock
}

// The newend should always be less than or equal to the original end
// plus the padding. If the new end is greater than item.end+padding
// 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)
// BlockBuf should always less than or equal to allocated space. If the blockBuf is greater
// than allocated space 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.
allocatedSpace := (item.end - item.start) + padding + 1
y.AssertTruef(uint32(len(blockBuf)) <= allocatedSpace, "newend: %d oldend: %d padding: %d",
item.start+uint32(len(blockBuf)), item.end, padding)

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