ijuma commented on a change in pull request #8979:
URL: https://github.com/apache/kafka/pull/8979#discussion_r455486328



##########
File path: core/src/main/scala/kafka/server/ReplicaManager.scala
##########
@@ -712,10 +708,13 @@ class ReplicaManager(val config: KafkaConfig,
         } catch {
           case e@(_: InvalidTopicException |
                   _: LogDirNotFoundException |
-                  _: ReplicaNotAvailableException |
                   _: KafkaStorageException) =>
-            warn("Unable to alter log dirs for %s".format(topicPartition), e)
+            warn(s"Unable to alter log dirs for $topicPartition", e)
             (topicPartition, Errors.forException(e))
+          case e: NotLeaderOrFollowerException =>
+            warn(s"Unable to alter log dirs for $topicPartition", e)
+            // Retaining REPLICA_NOT_AVAILABLE exception for 
ALTER_REPLICA_LOG_DIRS for older versions for compatibility
+            (topicPartition, if (config.interBrokerProtocolVersion >= 
KAFKA_2_7_IV0) Errors.NOT_LEADER_OR_FOLLOWER else Errors.REPLICA_NOT_AVAILABLE)

Review comment:
       Yeah, this was a bad suggestion on my part as I didn't realize that we 
were using this from clients/tools versus internally. Maybe we should revert to 
using REPLICA_NOT_AVAILABLE here.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to