-
Notifications
You must be signed in to change notification settings - Fork 441
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
Compact dbs manually #6595
Conversation
@@ -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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this 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.
65b3a67
to
bfd91b5
Compare
bfd91b5
to
a55635d
Compare
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. |
(cherry picked from commit d0ed28b)
Fixes #6575
No need in resync; very first compaction may take a while.
Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?