bshashikant commented on a change in pull request #2704:
URL: https://github.com/apache/ozone/pull/2704#discussion_r758025574
##########
File path:
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
##########
@@ -736,23 +744,48 @@ public void notifyTermIndexUpdated(long term, long index)
{
return f;
}
+ // Removes the stateMachine data from cache once both followers catch up
+ // to the particular index.
+ private void removeStateMachineDataIfNeeded(long index) {
+ if (waitOnBothFollowers) {
+ LOG.info("Removing data corresponding to log index {} from cache",
+ index);
+ try {
+ RaftServer.Division division =
ratisServer.getServer().getDivision(gid);
+ if (division.getInfo().isLeader() && Arrays
+ .stream(division.getInfo().getFollowerNextIndices())
+ .allMatch(i -> i >= index)) {
+ LOG.debug("Removing data corresponding to log index {} from cache",
+ index);
+ stateMachineDataCache.remove(index);
Review comment:
I think, the condition will be false only, if a follower is not able to
catch up . In this case, the pipeline will be closed down anyways. Other
situation can be case, where there are few entries remaining, there are no more
requests coming in, no more log transactions, no more configuration or metadata
transactions being done and the pipeline is just idle. In such cases, i beleive
its ok to have the entries in the cache. If a new request comes in, entries
will be removed .
I think We don't need to handle this particular corner case.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]