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

Page management when deleting by prefix #384

Open
4 tasks
Scooletz opened this issue Aug 30, 2024 · 2 comments · May be fixed by #393
Open
4 tasks

Page management when deleting by prefix #384

Scooletz opened this issue Aug 30, 2024 · 2 comments · May be fixed by #393
Labels
💾 disk size A change makes the disk size smaller

Comments

@Scooletz
Copy link
Contributor

Scooletz commented Aug 30, 2024

Currently, Paprika allows removal by prefix. It is done with scanning pages and asking each page to DeleteByPrefix. This should not happen a lot and is believed that it's ok to have it use full subtree traversal. One thing that is missing though is that it's possible that at a given level a prefix of NibblePath will be empty. This effectively means that both, this page and all its descendants should be reclaimed and batch.RegisterForFutureReuse. To make it work, it should be possible to return a kind of null-page, that can have its address retrieved with batch.GetAddress(page). This address should return DbAddress.Null to allow updating it just as a regular page. To make it work the following items should be tackled:

  • IBatchContext.NullPage property returning a Page that resides at 0 (this will be the first RootPage but it's ok, it will be used just for reference
  • introduce checks for prefix.IsEmpty in all the DeleteByPrefix where if a prefix is empty, the page is registered for the reuse and IBatchContext.NullPage is returned from the call
  • make the page that is no longer needed register itself in batch.RegisterForFutureReuse
  • propagate the call with emtpy to the children so that it has a nice recursive behavior.
@Scooletz Scooletz added this to Paprika Aug 30, 2024
@Scooletz Scooletz converted this from a draft issue Aug 30, 2024
@ssonthal
Copy link
Contributor

ssonthal commented Sep 2, 2024

Hi @Scooletz can I pick this one?

@Scooletz
Copy link
Contributor Author

@shubham-sonthalia I just updated the description to match the current version

@Scooletz Scooletz changed the title Delete accounts by prefix Page management when deleting by prefix Sep 17, 2024
@Scooletz Scooletz added the 💾 disk size A change makes the disk size smaller label Sep 17, 2024
@ssonthal ssonthal linked a pull request Sep 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💾 disk size A change makes the disk size smaller
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants