[
https://issues.apache.org/jira/browse/RATIS-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rui Wang resolved RATIS-2843.
-----------------------------
Fix Version/s: 3.4.0
Resolution: Fixed
> Fix cache misses and stale entries in FollowerInfoMap
> -----------------------------------------------------
>
> Key: RATIS-2843
> URL: https://issues.apache.org/jira/browse/RATIS-2843
> Project: Ratis
> Issue Type: Improvement
> Components: server
> Reporter: Guangcun Li
> Assignee: Guangcun Li
> Priority: Major
> Fix For: 3.4.0
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> h3. 1. Repeated cache misses when the configuration includes the leader
> {{LeaderStateImpl.isSameSize()}} compares the configuration’s voter count
> with the number of {{FollowerInfo}} entries in the corresponding list. Since
> {{FollowerInfoMap.map}} has no entry for the leader, the check fails whenever
> the configuration includes the leader. {{CurrentOldFollowerInfos}} then sets
> its {{conf}} field to {{{}null{}}}, so {{isSameConf()}} returns {{false}} on
> subsequent lookups with the same configuration.
> Update {{isSameSize()}} to subtract one from the expected list size if the
> configuration being checked includes the leader.
> h3. 2. Stale replication progress after a LogAppender restart
> A {{LogAppender}} restart can replace a peer’s {{FollowerInfo}} in
> {{FollowerInfoMap.map}} without changing the configuration. Once the cache
> can be reused, a cache hit may still return the old {{{}FollowerInfo{}}},
> causing {{getMajorityMin()}} to compute the majority index using a stale
> match index.
> Invalidate the cache when {{put()}} replaces an existing entry.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)