Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-13767

Fetch from consumers should return immediately when preferred read replica is defined by the leader

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.4.0
    • 3.2.0
    • core
    • None

    Description

       

      def readFromLocalLog()
      ...
      
      if (preferredReadReplica.isDefined) {
        ....
        // If a preferred read-replica is set, skip the read
        val offsetSnapshot = partition.fetchOffsetSnapshot(fetchInfo.currentLeaderEpoch, fetchOnlyFromLeader = false)
        LogReadResult(info = FetchDataInfo(LogOffsetMetadata.UnknownOffsetMetadata, MemoryRecords.EMPTY),
          divergingEpoch = None,
          ....
      } 

       

      when  a preferred read-replica is set, skip the read ,return empty data. The fetch request maybe put into the delayFetchQueue and repeat execute the readFromLocalLog() . It might be better to return the response right away.

      Attachments

        Issue Links

          Activity

            People

              ZhaoBo03 zhaobo
              ZhaoBo03 zhaobo
              David Jacot David Jacot
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: