Skip to content

Conversation

@kamilsa
Copy link
Contributor

@kamilsa kamilsa commented Jun 12, 2025

Referenced issues

Closes #2468

Description of the Change

We have noticed that historical votes contribute the most to the grow of the database.
The problem was that KAGOME didn't have pruning mechanism for historical votes.
To solve that problem this PR:

  1. Creates a new RocksDB column for historical votes, instead of using default column
  2. New column will have a TTL of 2 minutes, meaning all historical votes will be expired after two minutes.

Note, that in reality historical votes won't be cleared every two minutes, but rather their database entries will be marked as expired. The real removal of expired historical votes database entries will happen during database compaction, which happens automatically once in a while

Possible Drawbacks

None

Checklist Before Opening a PR

Before you open a Pull Request (PR), please make sure you've completed the following steps and confirm by answering 'Yes' to each item:

  1. Code is formatted: Have you run your code through clang-format to ensure it adheres to the project's coding standards? Yes
  2. Code is documented: Have you added comments and documentation to your code according to the guidelines in the project's contributing guidelines? Yes
  3. Self-review: Have you reviewed your own code to ensure it is free of typos, syntax errors, logical errors, and unresolved TODOs or FIXME without linking to an issue? Yes
  4. Zombienet Tests: Have you ensured that the zombienet tests are passing? Zombienet is a network simulation and testing tool used in this project. It's important to ensure that these tests pass to maintain the stability and reliability of the project. Yes

@kamilsa kamilsa requested a review from xDimon June 13, 2025 07:19
@kamilsa kamilsa marked this pull request as ready for review June 14, 2025 06:12
Copy link
Member

@xDimon xDimon left a comment

Choose a reason for hiding this comment

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

How about to use in-memory storage for such data?


inline auto historicalVotesKey(AuthoritySetId set, RoundNumber round) {
auto key = storage::kGrandpaHistoricalVotesPrefix;
common::Buffer key;
Copy link
Member

Choose a reason for hiding this comment

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

Remove unused anymore key storage::kGrandpaHistoricalVotesPrefix

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.

[Bug]: Storage is growing too fast

4 participants