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

tbcd: move block header cache from items to size #360

Merged
merged 18 commits into from
Jan 9, 2025

Conversation

marcopeereboom
Copy link
Contributor

Summary
We really should use size as the metric to determine cache size. This flips that for blockheaders.

Changes
This fixes a major bug in headers only mode where headers were not purged from the cache. This may have caused problems we had not diagnosed.

@marcopeereboom marcopeereboom requested a review from a team as a code owner January 8, 2025 11:54
@github-actions github-actions bot added the area: tbc This is a change to TBC (Tiny Bitcoin) label Jan 8, 2025
database/tbcd/level/headercache.go Outdated Show resolved Hide resolved
database/tbcd/level/level.go Outdated Show resolved Hide resolved
database/tbcd/level/level.go Outdated Show resolved Hide resolved
database/tbcd/level/headercache.go Outdated Show resolved Hide resolved
database/tbcd/level/headercache.go Outdated Show resolved Hide resolved
database/tbcd/level/headercache.go Outdated Show resolved Hide resolved
@joshuasing joshuasing changed the title Move block cache from items to size tbcd: move block header cache from items to size Jan 8, 2025
database/tbcd/level/headercache.go Outdated Show resolved Hide resolved
database/tbcd/level/headercache.go Show resolved Hide resolved
Copy link
Contributor

@joshuasing joshuasing left a comment

Choose a reason for hiding this comment

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

Would the term "evictions" make more sense for cache stats, then "purges"?
"purge" sounds like all items are removed, vs just one item being evicted 🤔

database/tbcd/database.go Show resolved Hide resolved
database/tbcd/level/blockcache.go Outdated Show resolved Hide resolved
@marcopeereboom marcopeereboom merged commit 67a1ccb into main Jan 9, 2025
7 checks passed
@marcopeereboom marcopeereboom deleted the marco/cache_size branch January 9, 2025 17:25
@AL-CT AL-CT mentioned this pull request Jan 9, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: tbc This is a change to TBC (Tiny Bitcoin)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants