lokeshj1703 commented on pull request #170:
URL: https://github.com/apache/incubator-ratis/pull/170#issuecomment-672642449


   > @lokeshj1703, if I understand correctly, this fix will purge the logs 
instead of evicting them from cache.
   > 
   > This might lead to more frequent install snapshots requests if a follower 
is lagging behind a few log segments. Currently in Ozone, the maximum number of 
cached segments is set to 2 in both Datanodes and Ozone.
   > 
   
   I think you are referring to the change in 
TestSegmentedRaftLog#syncWithSnapshot. So this function is called in follower 
after install snapshot or notify install snapshot. Since the snapshot has 
already been installed in the follower I think it is ok to purge the logs. 
Leader would have the snapshot too. 
   Currently purge is called in StateMachineUpdater#takeSnapshot. I think 
follower where snapshot is getting installed would not call takeSnapshot until 
later and thus may not be able to purge logs.
   
   > 1. Instead of purging logs when they need to be evicted from cache, can 
the purge implementation be fixed to also consider the logs  on disk and not in 
cache. With this approach, we would have  to take care of tracking on disk logs 
for other cases as well (for example {{RaftLog#getStartIndex}}).
   
   The change will not purge logs when they need to be evicted. If you look at 
SegmentedRaftLogCache#evictCache it only evicts the entry cache. It still 
tracks the log segment in the SegmentedRaftLogCache#closedSegments list. Log 
segments are removed from closedSegments during purge or truncate.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to