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

Conversation

Elbehery
Copy link
Member

Found this bug while working on #580

Pgid initial state was sat to 0, while the code here traverses the bucket & sub-buckets, it should start from the current pgid

cc @ahrtr @fuweid

Signed-off-by: Mustafa Elbehery <[email protected]>
@@ -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 👍🏽

@ahrtr
Copy link
Member

ahrtr commented Dec 18, 2023

READ #642 (comment)

@ahrtr ahrtr closed this Dec 18, 2023
@Elbehery Elbehery deleted the fix_checkbucket_page_traversal branch January 12, 2024 20:43
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