[ https://issues.apache.org/jira/browse/KAFKA-6949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16491438#comment-16491438 ]
ASF GitHub Bot commented on KAFKA-6949: --------------------------------------- lindong28 opened a new pull request #5081: KAFKA-6949; alterReplicaLogDirs() should grab partition lock when accessing log of the future replica URL: https://github.com/apache/kafka/pull/5081 NoSuchElementException will be thrown if ReplicaAlterDirThread replaces the current replica with future replica right before the request handler thread executes `futureReplica.log.get.dir.getParent` in the ReplicaManager.alterReplicaLogDirs(). The solution is to grab the partition lock when request handler thread attempts to check the destination log directory of the future replica. *Summary of testing strategy (including rationale) for the feature or bug fix. Unit and/or integration tests are expected for any behaviour change and system tests should be considered for larger changes.* ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > alterReplicaLogDirs() should grab partition lock when accessing log of the > future replica > ----------------------------------------------------------------------------------------- > > Key: KAFKA-6949 > URL: https://issues.apache.org/jira/browse/KAFKA-6949 > Project: Kafka > Issue Type: Bug > Reporter: Jason Gustafson > Assignee: Dong Lin > Priority: Major > > I found this in a failed execution of > kafka.admin.ReassignPartitionsClusterTest.shouldExpandCluster. Looks like > we're missing some option checking. > {code} > [2018-05-25 08:03:53,310] ERROR [ReplicaManager broker=100] Error while > changing replica dir for partition my-topic-2 (kafka.server.ReplicaManager:76) > java.util.NoSuchElementException: None.get > at scala.None$.get(Option.scala:347) > at scala.None$.get(Option.scala:345) > at > kafka.server.ReplicaManager$$anonfun$alterReplicaLogDirs$1.apply(ReplicaManager.scala:584) > at > kafka.server.ReplicaManager$$anonfun$alterReplicaLogDirs$1.apply(ReplicaManager.scala:576) > at > scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234) > at > scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234) > at scala.collection.Iterator$class.foreach(Iterator.scala:891) > at scala.collection.AbstractIterator.foreach(Iterator.scala:1334) > at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) > at scala.collection.AbstractIterable.foreach(Iterable.scala:54) > at scala.collection.TraversableLike$class.map(TraversableLike.scala:234) > at scala.collection.AbstractTraversable.map(Traversable.scala:104) > at > kafka.server.ReplicaManager.alterReplicaLogDirs(ReplicaManager.scala:576) > at > kafka.server.KafkaApis.handleAlterReplicaLogDirsRequest(KafkaApis.scala:2037) > at kafka.server.KafkaApis.handle(KafkaApis.scala:138) > at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:69) > at java.lang.Thread.run(Thread.java:748) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)