You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
I'm encountering an issue when trying to create a topic with replicaAssignments. Below is the code snippet used:
connection.createTopic({topic: "my-topic",numPartitions: -1,// Also tried declaring only `topic` and `replicaAssignments`replicationFactor: -1,//replicaAssignments: [{partition: 0,replicas: [0,1,2]}]});
The error message I receive is:
time="2024-11-22T11:23:47Z" level=error msg="Failed to create topic., OriginalError: [42] Invalid Request: this most likely occurs because of a request being malformed by the client library or the message was sent to an incompatible broker, se the broker logs for more details" error="Failed to create topic., OriginalError: [42] Invalid Request: this most likely occurs because of a request being malformed by the client library or the message was sent to an incompatible broker, se the broker logs for more details"
Observations:
Upon checking the code, I noticed that in this section of the source code, default values for NumPartitions and ReplicationFactor are set to 1 if they are <= 0.
if topicConfig.NumPartitions <= 0 {
topicConfig.NumPartitions = 1
}
if topicConfig.ReplicationFactor <= 0 {
topicConfig.ReplicationFactor = 1
}
This behavior seems incorrect when using replicaAssignments since NumPartitions and ReplicationFactor should be inferred from the replicaAssignments field according to the Kafka protocol.
Suggested Fix:
The library should allow NumPartitions and ReplicationFactor to remain unset or explicitly -1 when replicaAssignments is provided. This would align the behavior with Kafka’s protocol and similar libraries.
The text was updated successfully, but these errors were encountered:
Thank you for your work on the xk6-kafka project—it’s been incredibly useful for our Kafka-related testing needs.
I’ve encountered an issue when trying to create a topic with replicaAssignments and have provided a detailed report [above/in this issue]. It seems like the library sets default values for NumPartitions and ReplicationFactor even when replicaAssignments is provided, which contradicts Kafka’s protocol.
Would you be able to take a look when you have time? I’ve included links to relevant Kafka documentation and test cases from kafka-go library to help clarify the context.
Let me know if there’s any additional information I can provide or steps I can take to assist. Thanks again for maintaining this project!
I'm currently swamped with work and won't be able to address this issue in the next few weeks. I'll circle back to it as soon as I have some bandwidth.
Hi!
Environment:
3.7.0
running in Kubernetesmostafamoradian/xk6-kafka:0.28.0
Description:
I'm encountering an issue when trying to create a topic with
replicaAssignments
. Below is the code snippet used:The error message I receive is:
Observations:
Upon checking the code, I noticed that in this section of the source code, default values for NumPartitions and ReplicationFactor are set to 1 if they are <= 0.
This behavior seems incorrect when using
replicaAssignments
sinceNumPartitions
andReplicationFactor
should be inferred from thereplicaAssignments
field according to the Kafka protocol.References:
Suggested Fix:
The library should allow
NumPartitions
andReplicationFactor
to remain unset or explicitly-1
whenreplicaAssignments
is provided. This would align the behavior with Kafka’s protocol and similar libraries.The text was updated successfully, but these errors were encountered: