[ https://issues.apache.org/jira/browse/KAFKA-7794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniele Ascione updated KAFKA-7794: ----------------------------------- Description: For some input for the timestamps (different from -1 or -2) the GetOffset is not able to retrieve the offset. For example, if _x_ is the timestamp in that "not working range", and you execute: {code:java} bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list $KAFKA_ADDRESS --topic $MY_TOPIC--time x {code} The output is: {code:java} MY_TOPIC:8: MY_TOPIC:2: MY_TOPIC:5: MY_TOPIC:4: MY_TOPIC:7: MY_TOPIC:1: MY_TOPIC:9:{code} while after the last ":" an integer representing the offset is expected. ---- Steps to reproduce it: # Consume all the messages from the beginning with the timestamp: {code:java} bin/kafka-simple-consumer-shell.sh --no-wait-at-logend --broker-list $KAFKA_ADDRESS --topic $MY_TOPIC --property print.timestamp=true > messages{code} # Sort the messages by timestamp and get some of the oldest messages: {code:java} awk -F "CreateTime:" '{ print $2}' messages > msg_sorted{code} # Take (for example) the timestamp of the 10th oldest message, and see if GetOffsetShell is not able to print the offset: {code:java} timestamp="$(sed '10q;d' msg_sorted | cut -f1)" bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list $KAFKA_ADDRESS --topic $MY_TOPIC--time $timestamp # The output should be something like: # MY_TOPIC:1: # MY_TOPIC:2: (repeated for every partition){code} # Verify that the message with that timestamp is still in Kafka: {code:java} bin/kafka-simple-consumer-shell.sh --no-wait-at-logend --broker-list $KAFKA_ADDRESS --topic $MY_TOPIC --property print.timestamp=true | grep "CreateTime:$timestamp" {code} was: For some input for the timestamps (different from -1 or -2) the GetOffset is not able to retrieve the offset. For example, if _x_ is the timestamp in that "not working range", and you execute: {code:java} bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list $KAFKA_ADDRESS --topic $MY_TOPIC--time x {code} The output is: {code:java} MY_TOPIC:8: MY_TOPIC:2: MY_TOPIC:5: MY_TOPIC:4: MY_TOPIC:7: MY_TOPIC:1: MY_TOPIC:9:{code} while after the last ":" an integer representing the offset is expected. ---- Steps to reproduce it: # Consume all the messages from the beginning with the timestamp: {code:java} bin/kafka-simple-consumer-shell.sh --no-wait-at-logend --broker-list $KAFKA_ADDRESS --topic $MY_TOPIC --property print.timestamp=true > messages{code} # Sort the messages by timestamp and get some of the oldest messages: {code:java} awk -F "CreateTime:" '{ print $2}' messages > msg_sorted{code} # Take (for example) the timestamp of the 10th oldest message, and see if GetOffsetShell is not able to print the offset: {code:java} timestamp="$(sed '10q;d' invals.ts.sorted.txt | cut -f1)" bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list $KAFKA_ADDRESS --topic $MY_TOPIC--time $timestamp # The output should be something like: # MY_TOPIC:1: # MY_TOPIC:2: (repeated for every partition){code} # Verify that the message with that timestamp is still in Kafka: {code:java} bin/kafka-simple-consumer-shell.sh --no-wait-at-logend --broker-list $KAFKA_ADDRESS --topic $MY_TOPIC --property print.timestamp=true | grep "CreateTime:$timestamp" {code} > kafka.tools.GetOffsetShell does not return the offset in some cases > ------------------------------------------------------------------- > > Key: KAFKA-7794 > URL: https://issues.apache.org/jira/browse/KAFKA-7794 > Project: Kafka > Issue Type: Bug > Components: tools > Affects Versions: 0.10.2.0, 0.10.2.1, 0.10.2.2 > Reporter: Daniele Ascione > Priority: Critical > Labels: Kafka, ShellCommands, kafka-0.10, offset, shell, > shell-script, shellscript, tools, usability > > For some input for the timestamps (different from -1 or -2) the GetOffset is > not able to retrieve the offset. > For example, if _x_ is the timestamp in that "not working range", and you > execute: > {code:java} > bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list > $KAFKA_ADDRESS --topic $MY_TOPIC--time x > {code} > The output is: > {code:java} > MY_TOPIC:8: > MY_TOPIC:2: > MY_TOPIC:5: > MY_TOPIC:4: > MY_TOPIC:7: > MY_TOPIC:1: > MY_TOPIC:9:{code} > while after the last ":" an integer representing the offset is expected. > ---- > Steps to reproduce it: > # Consume all the messages from the beginning with the timestamp: > {code:java} > bin/kafka-simple-consumer-shell.sh --no-wait-at-logend --broker-list > $KAFKA_ADDRESS --topic $MY_TOPIC --property print.timestamp=true > > messages{code} > # Sort the messages by timestamp and get some of the oldest messages: > {code:java} > awk -F "CreateTime:" '{ print $2}' messages > msg_sorted{code} > # Take (for example) the timestamp of the 10th oldest message, and see if > GetOffsetShell is not able to print the offset: > {code:java} > timestamp="$(sed '10q;d' msg_sorted | cut -f1)" > bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list > $KAFKA_ADDRESS --topic $MY_TOPIC--time $timestamp > # The output should be something like: > # MY_TOPIC:1: > # MY_TOPIC:2: > (repeated for every partition){code} > # Verify that the message with that timestamp is still in Kafka: > {code:java} > bin/kafka-simple-consumer-shell.sh --no-wait-at-logend --broker-list > $KAFKA_ADDRESS --topic $MY_TOPIC --property print.timestamp=true | grep > "CreateTime:$timestamp" {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)