You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Ranganath Samudrala (Jira)" <ji...@apache.org> on 2025/03/20 15:20:00 UTC

[jira] [Updated] (KAFKA-19022) Display cluster IDs being compared when encountering INCONSISTENT_CLUSTER_ID error

     [ 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]
{quote} 

    private boolean hasValidClusterId(String requestClusterId) {
        // We don't enforce the cluster id if it is not provided.
        if (requestClusterId == null){

             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()));

         }

.

.

 

```
{quote}

  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 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?)

[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) {
            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()));
        }

.

.

 

```
{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: 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]
> {quote} 
>     private boolean hasValidClusterId(String requestClusterId) {
>         // We don't enforce the cluster id if it is not provided.
>         if (requestClusterId == null){
>              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()));
>          }
> .
> .
>  
> ```
> {quote}



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