[ 
https://issues.apache.org/jira/browse/KAFKA-19022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ranganath Samudrala updated KAFKA-19022:
----------------------------------------
    Description: 
While migrating Kafka from zookeeper to kraft, we see errors in logs like

INCONSISTENT_CLUSTER_ID in FETCH response 

or

INCONSISTENT_CLUSTER_ID in VOTER response 

But cluster IDs being compared is not displayed in logs so there is not enough 
information to see where the issue is. Is the class data *clusterId* empty 
(which could potentially be a bug?) or incoming *clusterId* empty or incorrect?

[KafkaRaftClient|https://github.com/apache/kafka/blob/31e1a57c41cf9cb600751669dc71bcd9596b45f9/raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java#L1459]
{code:java}
    private boolean hasValidClusterId(String requestClusterId) {
        // We don't enforce the cluster id if it is not provided.
        if (requestClusterId == null)Unknown macro: {
                      return true;
                 }


                return clusterId.equals(requestClusterId);
     }


.


.
    private CompletableFuture<FetchResponseData> handleFetchRequest(
        RaftRequest.Inbound requestMetadata,
        long currentTimeMs
    ) {
        FetchRequestData request = (FetchRequestData) requestMetadata.data();


        if (!hasValidClusterId(request.clusterId())) {


                     return completedFuture(new 
FetchResponseData().setErrorCode(Errors.INCONSISTENT_CLUSTER_ID.code()));
                 }


.


.
{code}

  was:
While migrating Kafka from zookeeper to kraft, we see errors in logs like

INCONSISTENT_CLUSTER_ID in FETCH response 

or

INCONSISTENT_CLUSTER_ID in VOTER response 

But cluster IDs being compared is not displayed in logs so there is not enough 
information to see where the issue is. Is the class data *clusterId* empty 
(which could potentially be a bug?) or incoming *clusterId* empty or incorrect?

[KafkaRaftClient|https://github.com/apache/kafka/blob/31e1a57c41cf9cb600751669dc71bcd9596b45f9/raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java#L1459]
{quote}
{{    private boolean hasValidClusterId(String requestClusterId) {}}
{{        // We don't enforce the cluster id if it is not provided.}}
{{{}        if (requestClusterId == null){}}}{{{}Unknown macro: {{}}}{quote}
{quote}{{             return true;}}{quote}
{quote}{{         }}}{{        return clusterId.equals(requestClusterId);}}
{{    }}}{quote}
{quote}{{.}}{quote}
{quote}{{.}}
{{    private CompletableFuture<FetchResponseData> handleFetchRequest(}}
{{        RaftRequest.Inbound requestMetadata,}}
{{        long currentTimeMs}}
{{    ) {}}
{{        FetchRequestData request = (FetchRequestData) 
requestMetadata.data();}}{quote}
{quote}{{{}        if (!hasValidClusterId(request.clusterId())){}}}{{{}Unknown 
macro: {{}}}{quote}
{quote}{{             return completedFuture(new 
FetchResponseData().setErrorCode(Errors.INCONSISTENT_CLUSTER_ID.code()));}}{quote}
{quote}{{         }}}{quote}
{quote}{{.}}{quote}
{quote}{{{}.{}}}{{{}{}}}{quote}


> Display cluster IDs being compared when encountering INCONSISTENT_CLUSTER_ID 
> error
> ----------------------------------------------------------------------------------
>
>                 Key: KAFKA-19022
>                 URL: https://issues.apache.org/jira/browse/KAFKA-19022
>             Project: Kafka
>          Issue Type: Improvement
>          Components: kraft, logging
>    Affects Versions: 3.9.0
>            Reporter: Ranganath Samudrala
>            Priority: Major
>
> While migrating Kafka from zookeeper to kraft, we see errors in logs like
> INCONSISTENT_CLUSTER_ID in FETCH response 
> or
> INCONSISTENT_CLUSTER_ID in VOTER response 
> But cluster IDs being compared is not displayed in logs so there is not 
> enough information to see where the issue is. Is the class data *clusterId* 
> empty (which could potentially be a bug?) or incoming *clusterId* empty or 
> incorrect?
> [KafkaRaftClient|https://github.com/apache/kafka/blob/31e1a57c41cf9cb600751669dc71bcd9596b45f9/raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java#L1459]
> {code:java}
>     private boolean hasValidClusterId(String requestClusterId) {
>         // We don't enforce the cluster id if it is not provided.
>         if (requestClusterId == null)Unknown macro: {
>                       return true;
>                  }
>                 return clusterId.equals(requestClusterId);
>      }
> .
> .
>     private CompletableFuture<FetchResponseData> handleFetchRequest(
>         RaftRequest.Inbound requestMetadata,
>         long currentTimeMs
>     ) {
>         FetchRequestData request = (FetchRequestData) requestMetadata.data();
>         if (!hasValidClusterId(request.clusterId())) {
>                      return completedFuture(new 
> FetchResponseData().setErrorCode(Errors.INCONSISTENT_CLUSTER_ID.code()));
>                  }
> .
> .
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to