akshatha ramesh created KAFKA-21354:
---------------------------------------

             Summary: kafka-metadata-quorum remove-controller output contains 
an extra space before "KRaft"
                 Key: KAFKA-21354
                 URL: https://issues.apache.org/jira/browse/KAFKA-21354
             Project: Kafka
          Issue Type: Bug
          Components: tools
    Affects Versions: 4.2.2, 4.1.2, 4.0.2, 3.9.2, 4.3.2
         Environment: All platforms
            Reporter: akshatha ramesh


The success message printed by kafka-metadata-quorum.sh remove-controller 
contains two spaces before "KRaft".

Actual output:

Removed  KRaft controller 2003 with directory id MkWfVYpS_qAWFaz7GuOkRg

The dry-run output has the same issue:

DRY RUN of removing  KRaft controller 2003 with directory id 
MkWfVYpS_qAWFaz7GuOkRg

Expected output:

Removed KRaft controller 2003 with directory id MkWfVYpS_qAWFaz7GuOkRg

DRY RUN of removing KRaft controller 2003 with directory id 
MkWfVYpS_qAWFaz7GuOkRg

Cause:

The value supplied for %s already ends with a space, while the format string 
adds another space after %s:

System.out.printf("%s KRaft controller %d with directory id %s%n",
    dryRun ? "DRY RUN of removing " : "Removed ",
    controllerId,
    directoryId);

Suggested change:

System.out.printf("%sKRaft controller %d with directory id %s%n",
    dryRun ? "DRY RUN of removing " : "Removed ",
    controllerId,
    directoryId);

The corresponding unit-test expectation should also be changed to use one space.

This issue affects Apache Kafka 3.9.x through 4.3.x. It is already corrected in 
4.4.0 and trunk as part of KAFKA-20395 / PR #22191, but the correction has not 
been backported to the affected release branches.

There is no functional impact; this only corrects the CLI output formatting.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to