chia7712 opened a new pull request, #13075:
URL: https://github.com/apache/kafka/pull/13075

   ```
   [2019-06-11 17:58:46,304] ERROR [ReplicaAlterLogDirsThread-1]: Error due to 
(kafka.server.ReplicaAlterLogDirsThread)
    org.apache.kafka.common.KafkaException: Error processing data for partition 
metrics_timers-35 offset 4224887
    at 
kafka.server.AbstractFetcherThread.$anonfun$processFetchRequest$7(AbstractFetcherThread.scala:342)
    at scala.Option.foreach(Option.scala:274)
    at 
kafka.server.AbstractFetcherThread.$anonfun$processFetchRequest$6(AbstractFetcherThread.scala:300)
    at 
kafka.server.AbstractFetcherThread.$anonfun$processFetchRequest$6$adapted(AbstractFetcherThread.scala:299)
    at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
    at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
    at 
kafka.server.AbstractFetcherThread.$anonfun$processFetchRequest$5(AbstractFetcherThread.scala:299)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:251)
    at 
kafka.server.AbstractFetcherThread.processFetchRequest(AbstractFetcherThread.scala:299)
    at 
kafka.server.AbstractFetcherThread.$anonfun$maybeFetch$3(AbstractFetcherThread.scala:132)
    at 
kafka.server.AbstractFetcherThread.$anonfun$maybeFetch$3$adapted(AbstractFetcherThread.scala:131)
    at scala.Option.foreach(Option.scala:274)
    at 
kafka.server.AbstractFetcherThread.maybeFetch(AbstractFetcherThread.scala:131)
    at 
kafka.server.AbstractFetcherThread.doWork(AbstractFetcherThread.scala:113)
    at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:82)
    Caused by: java.lang.IllegalStateException: Offset mismatch for the future 
replica metrics_timers-35: fetched offset = 4224887, log end offset = 0.
    at 
kafka.server.ReplicaAlterLogDirsThread.processPartitionData(ReplicaAlterLogDirsThread.scala:107)
    at 
kafka.server.AbstractFetcherThread.$anonfun$processFetchRequest$7(AbstractFetcherThread.scala:311)
   ```
   The race condition of processing LeaderAndIsrRequest and 
AlterReplicaLogDirsRequest causes above error (on V2 message format). Also, the 
error can be reproduced easily on V1 since there is no epoch cache.  The 
ReplicaAlterLogDirsThread checks the offset of “future log” rather than “log. 
Hence, here is my two cents, we can replace log.highWatermark by 
futureLog.highWatermark to resolve this issue. I tested it on our cluster and 
it works well (on both V1 and V2).
   
   ### 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 to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to