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: pgid initial state #642

Closed
Closed
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
2 changes: 1 addition & 1 deletion tx_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (tx *Tx) checkBucket(b *Bucket, reachable map[common.Pgid]*common.Page, fre
}

// Ensure each page is only referenced once.
for i := common.Pgid(0); i <= common.Pgid(p.Overflow()); i++ {
for i := common.Pgid(p.Id()); i <= common.Pgid(p.Overflow()); i++ {
var id = p.Id() + i
Copy link
Member

Choose a reason for hiding this comment

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

I don't think so. id has p.Id() as base

Copy link
Member Author

Choose a reason for hiding this comment

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

yes exactly, the base should be Pgid(p.Id())

currently, it is Pgid(0) regardless of the rootPageId we starting from this specific func call

please correct me if i misunderstanding :)

Copy link
Member

Choose a reason for hiding this comment

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

The change isn't correct. Let's work with an example,

Assuming p.Id() == 100, and overflow == 3, then we need to iterate pages: 100, 101, 102.

Copy link
Member Author

Choose a reason for hiding this comment

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

ahhhh i got it now, p.Overflow() contains count, not the pageIds 👍🏽

sorry my bad 👍🏽

if _, ok := reachable[id]; ok {
ch <- fmt.Errorf("page %d: multiple references (stack: %v)", int(id), stack)
Expand Down