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: relax reserve eviction during GC #3566

Merged
merged 4 commits into from Nov 23, 2022
Merged

fix: relax reserve eviction during GC #3566

merged 4 commits into from Nov 23, 2022

Conversation

aloknerurkar
Copy link
Contributor

@aloknerurkar aloknerurkar commented Nov 21, 2022

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

The localstore reserve size calculation is not correct and for storage incentives, we manually calculate the syncing index to calculate the reserve size.

In the private testnet we observed that the reserve eviction was causing some inconsistencies in the samples generated. During GC, we evict chunks from the reserve till we reach 90% capacity and move them to the cache. As we no longer consider cache chunks in the sample calculation, we have decided to relax the eviction till we are at 100% capacity. So, only evict if we have more chunks.

Also, as the storage radius is now dynamic, we will need to calculate the reserve size using the current radius during eviction. This might lead to node having to store some more data, but eventually, all the expiring batches should be cleaned up.


This change is Reviewable

pkg/localstore/gc.go Outdated Show resolved Hide resolved
pkg/localstore/gc.go Show resolved Hide resolved
Copy link
Member

@janos janos left a comment

Choose a reason for hiding this comment

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

👍

target = db.reserveCapacity
} else {
reserveSizeStart, err = db.reserveSize.Get()
}
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend moving the error check also into the else block.

if err != nil {
return 0, false, err
}
db.logger.Debug("gc: reserve eviction", "reserveSizeStart", reserveSizeStart, "target", target)
Copy link
Contributor

@mrekucci mrekucci Nov 22, 2022

Choose a reason for hiding this comment

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

Using snake-case instead of camel-case for log keys is preferable.

@istae istae merged commit fb10cfa into master Nov 23, 2022
@istae istae deleted the relaxGC branch November 23, 2022 10:39
@aloknerurkar aloknerurkar added this to the 1.10.0 milestone Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants