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

[Updated] LogCache should not cache on StoreLogs error #460

Merged
merged 6 commits into from
Apr 16, 2021
Merged

Conversation

schristoff
Copy link
Contributor

Original author was #430
[FIXED] LogCache should not cache on StoreLogs error
LogCache was caching logs and then invoking store.StoreLogs().
However, if StoreLogs() fails to store, LogCache.Get() could still
return logs that had not been persisted into storage, which could
lead to a node failing to restart with a "log not found" panic.

This PR ensures that LogCache only cache logs if StoreLogs was
successful.

Resolves #429

Signed-off-by: Ivan Kozlovic [email protected]

LogCache was caching logs and then invoking store.StoreLogs().
However, if StoreLogs() fails to store, LogCache.Get() could still
return logs that had not been persisted into storage, which could
lead to a node failing to restart with a "log not found" panic.

This PR ensures that LogCache only cache logs if StoreLogs was
successful.

Resolves #429

Signed-off-by: Ivan Kozlovic <[email protected]>
Copy link
Contributor

@notnoop notnoop left a comment

Choose a reason for hiding this comment

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

LGTM. Minor nitpicks. Like the test to code change ratio ;-).

log_cache.go Outdated Show resolved Hide resolved
log_cache_test.go Outdated Show resolved Hide resolved
log_cache_test.go Outdated Show resolved Hide resolved
log_cache_test.go Show resolved Hide resolved
raft_test.go Show resolved Hide resolved
log_cache_test.go Outdated Show resolved Hide resolved
@schristoff schristoff merged commit f810f43 into main Apr 16, 2021
@schristoff schristoff deleted the cp-430 branch April 16, 2021 19:52
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.

Restarting RAFT node could fail with panic: log not found [recovered] when using LogCache
3 participants