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

Enhance check functionality to support checking starting from a pageId #661

Closed
wants to merge 1 commit into from

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Jan 3, 2024

Link to #580

Only support specifying pageId in this PR. The reason of giving up supporting elementIdx is

  • it complicates the overall design and implementation;
  • the functionality of specifying elementIdx can also be achieved by only specifying pageId.

@ishan16696 @Elbehery @fuweid Please let me know if you have any comments on this PR.

@Elbehery Please feel free to cherry-pick the commit in this PR and add test cases in your PR.

}
case p.IsLeafPage():
for i := range p.LeafPageElements() {
elem := p.LeafPageElement(uint16(i))
Copy link
Member

Choose a reason for hiding this comment

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

IMO, we should try to get key/value here because the ksize/vsize might be wrong here

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a new checking, let's take care of it in a separate PR. Also it shouldn't be included in this method (each function/method should do only one thing); instead we can add a separate invariant checker in checkInvariantProperties, or gets it included in the existing recursivelyCheckPageKeyOrder (needs to change the method name if we follow this approach).

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good.

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

tx_check.go Outdated
Comment on lines 35 to 36
// Close the channel to signal completion.
defer close(ch)
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, closing of channel should be the responsibility of caller.

Copy link
Member Author

Choose a reason for hiding this comment

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

sort of agreeing on this, but not a big deal.

Let's take care of in a followup PR with change in the method Check something like below,

go func() {
    defer close(ch)
    tx.check(chkConfig, ch)
}()

Copy link
Member Author

Choose a reason for hiding this comment

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

Raised a separate PR #666

case p.IsBranchPage():
for i := range p.BranchPageElements() {
elem := p.BranchPageElement(uint16(i))
tx.recursivelyCheckBucketInPage(elem.Pgid(), reachable, freed, kvStringer, ch)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just trying to understand:
Can you explain me the relationship b/w page and buckets or you can point out to me some article. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIU, pages holds the bucket.
Can't it be possible that 1 page(Page size: 4KB) unable to hold whole bucket as bucket size is bigger than 4KB

Copy link
Member Author

Choose a reason for hiding this comment

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

Conceptually, a bucket is similar a table in RDBMS, a bucket can contain key/value pairs. But from implementation perspective, a bucket is actually a key/value pair, in which the key is the bucket name, and the value is the,

  • for nested bucket (which contains very few data), it contains a nested page, in which all data of that bucket are contained;
  • for normal bucket, the value just contains a pageId, which points to the page in which all data are included.

I may consider to write some document to make it clearer.

@ahrtr ahrtr closed this in #666 Jan 6, 2024
@ahrtr ahrtr reopened this Jan 6, 2024
@ahrtr ahrtr force-pushed the enhance_check_20231231 branch from d772fee to 37ad8fa Compare January 6, 2024 11:10
Copy link
Contributor

@ishan16696 ishan16696 left a comment

Choose a reason for hiding this comment

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

LGTM!!

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM on new commit

@ahrtr
Copy link
Member Author

ahrtr commented Feb 3, 2024

Superseded by #659

@ahrtr ahrtr closed this Feb 3, 2024
@ahrtr ahrtr deleted the enhance_check_20231231 branch June 26, 2024 15:38
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