Skip to content

core/rawdb/freezer: Report accurate freeze table size #27859

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

Closed
wants to merge 2 commits into from

Conversation

shyam-patel-kira
Copy link

This PR aims to fix the issue #27483 of inconsistent size reporting in the FreezerTable data structure. The problem arises when using tail deletion, where removed items are hidden but still kept in the file. The file is only removed when all elements become hidden. However, the current implementation doesn't consider these hidden items in the size calculation, resulting in misleading size reports.

This PR addresses this inconsistency and ensures that the reported size accurately reflects the live elements in the table, even when tail deletion is used.

Comment on lines +230 to +233
totalSize, _ := table.size()

// Get the number of tail-deleted elements.
tailDeletedSize := table.itemHidden.Load()
Copy link
Contributor

@holiman holiman Aug 8, 2023

Choose a reason for hiding this comment

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

The size() returns size returns the total data size in the freezer table. -- that is, a count of bytes.
The itemHidden, however, is the number of items marked as deleted. -- a count of 'items'.

So unfortunately you cannot just subtract the one from the other

@holiman
Copy link
Contributor

holiman commented Aug 17, 2023

Hi @shyam-patel-kira,
I do not know if you plan to rework this PR, or if it is abandoned? As I wrote in my review, this PR cannot be merged the way it is written, and we'd prefer keeping the number of open inactive "draft" PRs low.

I will close this PR, and if you keep working on the fix, please just open a new PR.

@holiman holiman closed this Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants