[
https://issues.apache.org/jira/browse/KAFKA-16396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17829423#comment-17829423
]
ZhenChun Pan edited comment on KAFKA-16396 at 3/21/24 8:21 AM:
---------------------------------------------------------------
Procuder code is as follows,I didn't define the partition for records,just
define the key.
ProducerRecord<String, byte[]> producerRecord = new ProducerRecord<String,
byte[]>(
this.configuration.getStreamName(this.tunnelContext.getTunnelType()),
dataKey.toString(), sendValue);
Future<RecordMetadata> recordResult = producer.send(producerRecord);
RecordMetadata recordMetadata = recordResult.get();
if (recordResult.isDone() && recordMetadata != null &&
recordMetadata.offset() >= 0)
{ return recordMetadata; }
else
{ return null; }
was (Author: JIRAUSER280457):
Procuder code is as follows,I didn't define the partition for records,just
define the key.
ProducerRecord<String, byte[]> producerRecord = new
ProducerRecord<String, byte[]>(
this.configuration.getStreamName(this.tunnelContext.getTunnelType()),
dataKey.toString(), sendValue);
Future<RecordMetadata> recordResult = producer.send(producerRecord);
RecordMetadata recordMetadata = recordResult.get();
if (recordResult.isDone() && recordMetadata != null &&
recordMetadata.offset() >= 0) {
return recordMetadata;
} else {
return null;
}
> Producer use the same Key(string) result in multiple paritition
> ---------------------------------------------------------------
>
> Key: KAFKA-16396
> URL: https://issues.apache.org/jira/browse/KAFKA-16396
> Project: Kafka
> Issue Type: Bug
> Components: clients
> Affects Versions: 3.5.0
> Reporter: ZhenChun Pan
> Priority: Minor
>
> In orede to make record in order,we use the same
> key:event#Collector-2021-01-01-001#Probe-0001#1067267613#1002。In some
> situation(maybe the Kafka service has been restarted during producing), we
> find the same key records sent to partition 0 and 4.
> offset: 7422, key: event#Collector-2021-01-01-001#Probe-0001#1067267613#1002,
> partition: 0, topic: IES.tunnel.event.1002, timestamp: 1710483530474
> offset: 7433, key: event#Collector-2021-01-01-001#Probe-0001#1067267613#1002,
> partition: 4, topic: IES.tunnel.event.1002, timestamp: 1710483516370
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)