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 endless chunk rewriting when db is idle - improvement #4000

Conversation

vreuland
Copy link
Contributor

Hello,

I would like to officially propose this change in the MVStore housekeeping and would be happy to get any feedback.
This is based on the comment I have made here: #3909 (comment)

Thank you in advance for your feedback.

int adjustedChunksFillRate = 100 - (100 - chunksFillRate) / 2;
int fillRateToCompare = isIdle() ? chunksFillRate : adjustedChunksFillRate;
int chunksFillRate = getChunksFillRate();
if (lastHousekeepingHasRewrittenChunks && chunksFillRate == previousChunksFillRate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this condition may yield true only by a coincident, because if last housekeeping has rewritten chunks, chunks fill rate is likely to change, even without any user activity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, It is based on the observations I have made on my database where practically the chunkFillRate was not moving during the housekeeping (quickly stayed in my case at 78%): Only the rewriteable chunk fill rate was incrementally increasing (up to 100%) until the retention time of the first rewritten chunks was hit, driving back the rewritable chunk fill rate to the starting point and restarting the useless housekeeping cycle.
The condition has also an equality ( and not a <=) because I needed a way to detect when to "resume" the housekeeping if some user operations were made (at least enough operations to have an impact on the chunkFillRate) and without using isIdle.
So the logic is really:

  1. The housekeeping has just rewritten some chunk with no impact on the chunkFillRate ? -> Yes, then stop performing the housekeeping
  2. When to resume the housekeeping? -> Whenever there was enough user operations to change the chunkFillRate (by at least a point)

But you are right, I guess the fact that the chunkFillRate is not "moved" by the housekeeping in my tests might very well be specific to my database(s). And depending on the database, we could probably have a situation where chunkFillRate is also somehow fluctuating (78, 79, 77, 78, 79, ...) after each housekeeping, blowing up the stopping condition.

I have seen you have made another proposal (in #4006). Thanks a lot for that. I will thoroughly test it and will come back to you as soon as I can.

@vreuland
Copy link
Contributor Author

Close/Declining this as @andreitokar PR has been merged

@vreuland vreuland closed this Mar 25, 2024
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.

None yet

2 participants