cowsql / raft

Asynchronous C implementation of the Raft consensus protocol
https://raft.readthedocs.io
Other
53 stars 6 forks source link

log: Don't append duplicate entries that are still referenced #101

Closed freeekanayaka closed 1 year ago

freeekanayaka commented 1 year ago

This fixes the following scenario, surfaced by Jepsen tests:

In that case, E is still referenced by the local log when it gets received, which leads to an assertion failure.

codecov[bot] commented 1 year ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (a5fd654) 74.81% compared to head (8664f00) 74.83%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #101 +/- ## ========================================== + Coverage 74.81% 74.83% +0.01% ========================================== Files 53 53 Lines 9356 9357 +1 Branches 2343 2345 +2 ========================================== + Hits 7000 7002 +2 - Misses 1018 1019 +1 + Partials 1338 1336 -2 ``` | [Files](https://app.codecov.io/gh/cowsql/raft/pull/101?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cowsql) | Coverage Δ | | |---|---|---| | [src/log.c](https://app.codecov.io/gh/cowsql/raft/pull/101?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cowsql#diff-c3JjL2xvZy5j) | `92.32% <100.00%> (ø)` | | | [src/recv\_append\_entries.c](https://app.codecov.io/gh/cowsql/raft/pull/101?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cowsql#diff-c3JjL3JlY3ZfYXBwZW5kX2VudHJpZXMuYw==) | `58.33% <0.00%> (ø)` | | | [src/replication.c](https://app.codecov.io/gh/cowsql/raft/pull/101?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cowsql#diff-c3JjL3JlcGxpY2F0aW9uLmM=) | `68.41% <50.00%> (+0.04%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/cowsql/raft/pull/101/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cowsql)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.