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 the check command to support diagnosing a subtree #580

Closed
ahrtr opened this issue Oct 18, 2023 · 29 comments
Closed

Enhance the check command to support diagnosing a subtree #580

ahrtr opened this issue Oct 18, 2023 · 29 comments

Comments

@ahrtr
Copy link
Member

ahrtr commented Oct 18, 2023

The whole db is indexed using b+tree. The existing check functionality checks the whole db, naming the whole tree. It would be useful if it supports checking a sub-tree, naming support checking starting from a pageId or pageId + elementId.

Based on this new feature, we will be able to know whether any sub-tree is healthy or corrupted.

@ishan16696
Copy link
Contributor

Hi @ahrtr,
I can work on this, would you like to assign this issue to me ?

@ahrtr
Copy link
Member Author

ahrtr commented Oct 25, 2023

Thanks @ishan16696

@ahrtr
Copy link
Member Author

ahrtr commented Nov 6, 2023

@ishan16696 any update on this?

@ishan16696
Copy link
Contributor

Hi @ahrtr ,
I've started working on this but I require some time to deliver this feature.

@ishan16696
Copy link
Contributor

naming support checking starting from a pageId or pageId + elementId.

@ahrtr do you want to take pageID as an argument ?

bbolt check [Path to db] [PageID]

@ahrtr
Copy link
Member Author

ahrtr commented Nov 13, 2023

For the CMD, let's add two optional flags --pageId and --elementIdx,

bbolt check path-2-db --pageId <pageId> --elementIdx <elementIdx>

If users do not specify the pageId and elementIdx, then the default behaviour is still checking the whole db file. Also note that it doesn't make sense only specifying --elementIdx if not specifying --pageId.

For the (*Tx) Check, please get the new options/parameters included in the CheckOption, so as to be backward compatible.

@ishan16696
Copy link
Contributor

Also note that it doesn't make sense only specifying --elementIdx if not specifying --pageId.

make sense, at the same only specifying the --pageId can work ... right ?

@ahrtr
Copy link
Member Author

ahrtr commented Nov 14, 2023

at the same only specifying the --pageId can work ... right ?

YES. If only --pageId is specified, then we need to check all elements in the page.

@ahrtr
Copy link
Member Author

ahrtr commented Nov 24, 2023

any update? Please let me know if you need my assistance?

@ishan16696
Copy link
Contributor

yes, I have made some progress. I have plan to work on this feature this weekend.

Please let me know if you need my assistance?

thanks, I will try to open a draft PR and you can have a look.

@ahrtr
Copy link
Member Author

ahrtr commented Dec 28, 2023

Discussed with @ishan16696 offline, I will take over the task and @ishan16696 will continue to work on the cmd change.

  • The first step: Refactor the implementation of check #651
  • Enhance the check method to support checking starting from a pageId and an elementIdx (@ahrtr will provide a draft PR)
    func (tx *Tx) check(kvStringer KVStringer, ch chan error) {
  • Add test case to verify the change. @Elbehery can you take care of this ?
    • Create a db file, which contains at least one branch page, and multiple leaf pages. Intentionally corrupt one of the leaf page. Verify that checking on the corrupted page will fail, while other pages should succeed
  • Update cmd side change. Also add sanity test case. @ishan16696 will take care of it.

@Elbehery
Copy link
Member

Shall i cherry pick this PR and continue atop of it ?

@ahrtr
Copy link
Member Author

ahrtr commented Dec 28, 2023

We can merge #651 directly after it being reviewed. I will raise another draft PR, then you can cherry-pick it.

@ahrtr
Copy link
Member Author

ahrtr commented Feb 6, 2024

  • Update cmd side change. Also add sanity test case. @ishan16696 will take care of it.

@ishan16696 Please feel free to deliver a PR to update the cmd. thx

@ahrtr
Copy link
Member Author

ahrtr commented Feb 21, 2024

@ishan16696 are you still interested working on this? I will take over if there is no response in this week. thx

@Elbehery
Copy link
Member

@ahrtr i can continue working on it

@ahrtr
Copy link
Member Author

ahrtr commented Feb 21, 2024

@ahrtr i can continue working on it

thx. Let's wait for @ishan16696 's response firstly, if there is no response this week, then please feel free to raise a PR to update the CLI.

@ishan16696
Copy link
Contributor

thx. Let's wait for @ishan16696 's response firstly, if there is no response this week, then please feel free to raise a PR to update the CLI.

I have open a PR. Please have a look.

@ahrtr
Copy link
Member Author

ahrtr commented Apr 4, 2024

Does anyone have bandwidth and be interested in resolve comment below?

#698 (comment)

cc @Elbehery @ivanvc

@Elbehery
Copy link
Member

Elbehery commented Apr 4, 2024

@ahrtr on me 👍🏽

@ivanvc
Copy link
Member

ivanvc commented Apr 4, 2024

@ahrtr, are we fine re-implementing as a cobra-style command? We know that pflags are not compatible with Go-native flags (as they're not POSIX compliant).

@ahrtr
Copy link
Member Author

ahrtr commented Apr 4, 2024

@ahrtr, are we fine re-implementing as a cobra-style command? We know that pflags are not compatible with Go-native flags (as they're not POSIX compliant).

It should be ok as long as there is no any behaviour change from users' perspective.

@Elbehery
Copy link
Member

Elbehery commented Apr 8, 2024

@ahrtr hello ✋🏽

Shall i work on this or @ivanvc will do ?

@ahrtr
Copy link
Member Author

ahrtr commented Apr 8, 2024

@ahrtr hello ✋🏽

Shall i work on this or @ivanvc will do ?

Please feel free to work on it, since @ivanvc already thumbed up your comment above #580 (comment)

@ivanvc
Copy link
Member

ivanvc commented Apr 8, 2024

Sorry for the confusion @Elbehery. Yes, my thumbs up meant that I ACK'd that you would work on it. I just wanted to confirm the decision to migrate the command to cobra-style ✌️

@Elbehery
Copy link
Member

i rasied #723 to fix #580 (comment)

@ahrtr
Copy link
Member Author

ahrtr commented Apr 21, 2024

We still need to enhance the bbolt check command to support the flag --pageId. Please refer to #698 (comment)

cc @Elbehery @ivanvc

@Elbehery
Copy link
Member

@ahrtr raised #737

@ahrtr
Copy link
Member Author

ahrtr commented Apr 23, 2024

All done. Thanks all.

@ahrtr ahrtr closed this as completed Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants