Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current state: Under Discussion Accepted

Discussion thread: here

JIRA: here

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

...

When running kafka-metadata-quorum script to get the quorum replication status, the LastFetchTimestamp and LastCaughtUpTimestamp output is not human-readable.

I will It would be convenient to add an optional flag (-hr, --human-readable) to enable a human-readable format showing the operation delay in ms (i.e. 366 ms ago).

This delay is computed as (now - timestamp), where they are both represented as Unix time (UTC based).

Public Interfaces

A new optional flag called --human-readable with the shortcut -hr will be added to the kafka-metadata-quorum tool.

Code Block
languagebash
$ bin/kafka-metadata-quorum.sh describe -h
usage: kafka-metadata-quorum [-h] --bootstrap-server BOOTSTRAP_SERVER describe [-h] [-command-config COMMAND_CONFIGstatus] [--replication] [--hr] {describe} ...

This tool describes kraft metadata quorum status.

positional arguments:
  {describe}
    describe             Describe the metadata quorum info

human-readable]

optional arguments:
  -h, --help             show this help message and exit

Status:
  --bootstrap-server BOOTSTRAP_SERVER
status               A short summary of the quorum status and the other provides Adetailed comma-separatedinformation list of host:port pairs to use for establishing the connection to the Kafka cluster.
about the status of replication.

Replication:
  --command-config COMMAND_CONFIG
replication          Detailed information about the status            Property file containing configs to be passed to Admin Client.of replication
  -hr, --human-readable  Print human     Human-readable timestamps (default: false)output

Proposed Changes

The current default --replication output is as follows and will remain unchanged.

...

Instead, when passing the new flag, we will have the following output (note how argparse4j support abbreviations).

Code Block
languagebash
$ bin/kafka-metadata-quorum.sh --bootstrap-server :9092 -hr describe --replication --human-readable
NodeId	LogEndOffset	Lag	LastFetchTimestamp	LastCaughtUpTimestamp	Status  	
2     	541 8689        	0  	34 ms ago          	34 ms ago             	Leader  	
3     	541 8689        	0  	366148 ms ago        	366148 ms ago           	Follower	
4     	5418689         	0  	366148 ms ago        	366148 ms ago           	Follower


$ bin/kafka-metadata-quorum.sh --bootstrap-serverboot :9092 describe --human-readablere describe --replicationhu
NodeId	LogEndOffset	Lag	LastFetchTimestamp	LastCaughtUpTimestamp	Status  	
2     	54161          	0  	35 ms ago          	35 ms ago             	Leader  	
3     	54161          	0  	36656 ms ago         	36656 ms ago            	Follower	
4     	54161          	0  	36656 ms ago         	36656 ms ago            	Follower

Compatibility, Deprecation, and Migration Plan

The default behavior will remain unchanged to avoid breaking any tool relying on the current timestamp formatoutput.

Test Plan

A new test method will be added to MetadataQuorumCommandTest to verify default and new behaviors with regard to the timestamp formattingoutput.

Rejected Alternatives

Adding the full date in a human-readable format Using a date/time formatting (i.e. May 10, 15:54:55 UTC) won't add much information herein most cases and you will have to deal with locale.