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

Investigate FetcherTest's/FetchRequestManager's duplicate metadata update in assignFromUserNoId

    XMLWordPrintableJSON

Details

    Description

      The unit tests FetcherTest and FetchRequestManagerTest have methods named assignFromUser() and assignFromUserNoId() that appear to perform duplicate metadata updates:

      private void assignFromUser(Set<TopicPartition> partitions) {
          subscriptions.assignFromUser(partitions);
          client.updateMetadata(initialUpdateResponse);
      
          // A dummy metadata update to ensure valid leader epoch.
          metadata.updateWithCurrentRequestVersion(
                  RequestTestUtils.metadataUpdateWithIds(
                      "dummy",
                      1, 
                      Collections.emptyMap(),
                      singletonMap(topicName, 4),
                      tp -> validLeaderEpoch, topicIds
                  ),
                  false,
                  0L
          );
      }
      

      client.updateMetadata() eventually calls metadata.updateWithCurrentRequestVersion(). Determine why the test is updating the cluster metadata twice with different values.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kirktrue Kirk True
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: