fix: only update revisions if currentRev is updated #414
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We encountered issues with our setup after updating Kine to version v0.13.7. The issues we encountered where similar to the ones described in #357 and were supposed to be fixed in #360 and #365.
While I noticed that our custom SQLite DSN was missing a few options that seem to help remedy the issues, I still had the impression something else was not playing nice as well.
So after building a local test setup and using the
jobloader
example to create a small load generator that matched our usage profile (guess in hindsight that wasn't even necessary) I was able to reproduce the issue.We noticed in the test logs that at a certain moment in time the compaction process stopped all together, just as it does in our production setup. Before it stopped it already failed a few times (each time with the
database is locked
error), but each time (except for the last time) it resumed/tried again after 5 minutes.What caught my eye when comparing logs with the test setup and our production logs is that it only stopped completely when there wasn't a single successful compaction done before the
database is locked
error was received. When looking at the code with that in mind it was easy to see the minor mistake in the code that was responsible for this behavior.As
currentRev
is declared in the loop, it's reset to 0 on each iteration. So if it's not updated at least oncetargetCompactRev
will be set to 0 at the end of the loop and will prevent any compaction to be done from that point on.