[jira] [Created] (KAFKA-15771) ProduceRequest#partitionSizes() is not an atomic operation

2023-11-01 Thread Xiaobing Fang (Jira)
Xiaobing Fang created KAFKA-15771:
-

 Summary:  ProduceRequest#partitionSizes() is not an atomic 
operation
 Key: KAFKA-15771
 URL: https://issues.apache.org/jira/browse/KAFKA-15771
 Project: Kafka
  Issue Type: Bug
  Components: producer 
Reporter: Xiaobing Fang


Encountered a concurrency issue in method ProduceRequest#partitionSizes() while 
developing with Kafka. When both Thread 1 and Thread 2 concurrently call method 
ProduceRequest#partitionSizes(), Thread 2 may receive an incomplete or empty 
result if Thread 1 is still in the process of initializing partitionSizes. This 
is an incorrect state. the code to ensure that Thread 2 obtains the final state 
rather than an intermediate one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (KAFKA-15136) The inspection of field allowAutoTopicCreation field in MetadataRequest is unreasonable

2023-06-30 Thread Xiaobing Fang (Jira)
Xiaobing Fang created KAFKA-15136:
-

 Summary: The inspection of field allowAutoTopicCreation field in 
MetadataRequest is unreasonable
 Key: KAFKA-15136
 URL: https://issues.apache.org/jira/browse/KAFKA-15136
 Project: Kafka
  Issue Type: Improvement
  Components: clients
Reporter: Xiaobing Fang


```java

if (!data.allowAutoTopicCreation() && version < 4)
throw new UnsupportedVersionException("MetadataRequest versions older than 4 
don't support the " +
"allowAutoTopicCreation field");

```

Background:
Based on my understanding, the code in MetadataRequest is intended to ignore 
the allowAutoTopicCreation field when version≤4. However, if kafka server is 
configured with "auto.create.topics.enable"=false and the client sets 
allowAutoTopicCreation=false, UnsupportedVersionExceptionwill be thrown, which 
is not expected.

Issues:
 # `KafkaAdminClient#handleDescribeTopicsByNames()` throws an exception when 
sending MetadataRequest to a lower version server, making it unusable.
 # MetadataRequestTest avoids this issue by setting 
`allowAutoTopicCreation=true` in tests for version≤4, but this is not 
reasonable. And the comments in 
[testAutoTopicCreation|https://github.com/apache/kafka/blob/1f4cbc5d53259031123b6e9e6bb9a5bbe1e084e8/core/src/test/scala/unit/kafka/server/MetadataRequestTest.scala#L146]
 may also be problematic.

Solution:  
 # Remove the checking code in MetadataRequest.
 # Add a field `hasSetAllowAutoTopicCreation` in MetadataRequest. Only throw an 
exception when `version≤4` and `hasSetAllowAutoTopicCreation=true`, without 
considering the value of allowAutoTopicCreation field.

 

If there is indeed an issue, I can work on fixing it. Looking forward to your 
reply.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (KAFKA-13752) Using `equals` instead of `==` when Uuid compare in Java

2022-03-17 Thread Xiaobing Fang (Jira)
Xiaobing Fang created KAFKA-13752:
-

 Summary: Using `equals` instead of `==` when Uuid compare in Java
 Key: KAFKA-13752
 URL: https://issues.apache.org/jira/browse/KAFKA-13752
 Project: Kafka
  Issue Type: Improvement
  Components: clients
Reporter: Xiaobing Fang


`Uuid.ZERO_UUID == new Uuid(0L, 0L)` is true in scala, but in java is false.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Created] (KAFKA-13424) Redundant cleanup operations in TopicChangeHandler or TopicDeletionManager

2021-10-31 Thread Xiaobing Fang (Jira)
Xiaobing Fang created KAFKA-13424:
-

 Summary: Redundant cleanup operations in TopicChangeHandler or 
TopicDeletionManager
 Key: KAFKA-13424
 URL: https://issues.apache.org/jira/browse/KAFKA-13424
 Project: Kafka
  Issue Type: Improvement
  Components: controller
Affects Versions: 2.8.0
Reporter: Xiaobing Fang


In `TopicDeletionManager.completeDeleteTopic()`, 
`controllerContext.removeTopic(topic)` will be done after deleting topic znode 
in `client.deleteTopic(topic, controllerContext.epochZkVersion)`. This will 
trigger `TopicChangeHandler`, and process `controllerContext.removeTopic` 
aggine in `processTopicChange`. 

It is equivalent to deleting Topic once and executing 
`controllerContext.removeTopic` twice. Is this the expected situation?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)