lokeshj1703 commented on pull request #170:
URL: https://github.com/apache/incubator-ratis/pull/170#issuecomment-673994822
> When purge is called next, log_11_20 will not be purged as it is not in
the cached closedSegments list.
Good point! I think this can be fixed by the following change.
```
void loadSegment(LogPathAndIndex pi, boolean keepEntryInCache,
Consumer<LogEntryProto> logConsumer, long lastIndexInSnapshot) throws
IOException {
LogSegment logSegment = LogSegment.loadSegment(storage,
pi.getPath().toFile(),
pi.getStartIndex(), pi.getEndIndex(), pi.isOpen(), keepEntryInCache,
logConsumer, raftLogMetrics);
if (logSegment != null) {
addSegment(logSegment);
}
}
```
The point is if we have a list of all log segments during startup the purge
works correctly. The log segment references should be light-weight if the entry
cache is evicted from the log segment. I think we can avoid directory scan
during purge with this precondition.
----------------------------------------------------------------
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]