'highWatermark and NOT_ENOUGH_REPLICAS_AFTER_APPEND in kafka 0.10.2

I was looking at the class kafka.cluster.Partition in the function checkEnoughReplicasReachOffset between the line numbers 327 and 335 it says:

if (leaderReplica.highWatermark.messageOffset >= requiredOffset) {
          /*
           * The topic may be configured not to accept messages if there are not enough replicas in ISR
           * in this scenario the request was already appended locally and then added to the purgatory before the ISR was shrunk
           */
          if (minIsr <= curInSyncReplicas.size)
            (true, Errors.NONE)
          else
            (true, Errors.NOT_ENOUGH_REPLICAS_AFTER_APPEND)

So if highWatermark.messageOffset >= requiredOffset then anyway minimum number of replica should have received the message that's why the HW has moved forward. Hence my question is,

  1. If that's true then why are we checking minIsr <= curInSyncReplicas.size?
  2. And looking at else condition, in what condition HW can move forward without the minimum number of replica receiving the message?


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source