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

Compact dbs manually #6595

Merged
merged 5 commits into from Jan 30, 2024
Merged

Compact dbs manually #6595

merged 5 commits into from Jan 30, 2024

Conversation

flcl42
Copy link
Contributor

@flcl42 flcl42 commented Jan 23, 2024

Fixes #6575

No need in resync; very first compaction may take a while.

Changes

  • Compact blobs db manually, as there is no settings found to enable auto-compaction for a column db

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

@@ -55,6 +58,10 @@ private void CleanProcessedTransactionsDb(long newlyFinalizedBlockNumber)

if (_logger.IsDebug) _logger.Debug($"Cleaned processed blob txs from block {_lastFinalizedBlock} to block {newlyFinalizedBlockNumber}");

_db.Compact();
Copy link
Member

Choose a reason for hiding this comment

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

Can we guard the compaction not use to many resources? (Threads? I/O?) So it won't starve anything else in block processing.

@@ -55,6 +58,10 @@ private void CleanProcessedTransactionsDb(long newlyFinalizedBlockNumber)

if (_logger.IsDebug) _logger.Debug($"Cleaned processed blob txs from block {_lastFinalizedBlock} to block {newlyFinalizedBlockNumber}");

_db.Compact();
Copy link
Member

Choose a reason for hiding this comment

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

Shall we only run compaction only after enough transactions were deleted from the db? Put some threshold?

Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

OnBlocksFinalized should be between block processing, so should be fine.

@flcl42 flcl42 marked this pull request as draft January 26, 2024 08:18
@flcl42 flcl42 force-pushed the cleanup-blobs-db branch 5 times, most recently from 65b3a67 to bfd91b5 Compare January 29, 2024 10:49
@flcl42 flcl42 marked this pull request as ready for review January 30, 2024 09:20
@flcl42
Copy link
Contributor Author

flcl42 commented Jan 30, 2024

It takes 1-3 seconds to compact every 6 minutes. Seems OK for now.

I'm experimenting with more db options which requires long runs, the only thing that may change is these seconds will be spent by rocksdb in manner opaque for us + maybe less IO spent on compaction.

@flcl42 flcl42 merged commit d0ed28b into master Jan 30, 2024
68 checks passed
@flcl42 flcl42 deleted the cleanup-blobs-db branch January 30, 2024 09:26
MarekM25 pushed a commit that referenced this pull request Feb 6, 2024
(cherry picked from commit d0ed28b)
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.

On Devnet-12 after blobs spamming DB size is significantly bigger than for other ELs
3 participants