This is an automated email from the ASF dual-hosted git repository.
frankvicky pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 2e774cca4fb MINOR: Remove unnecessary checks in `TopicDelta` (#20337)
2e774cca4fb is described below
commit 2e774cca4fb7bd89383a435cdd5bc014e2936ddf
Author: Xuan-Zhang Gong <[email protected]>
AuthorDate: Tue Aug 12 12:37:18 2025 +0800
MINOR: Remove unnecessary checks in `TopicDelta` (#20337)
field `directories` has already been validated in the constructor,so
there’s no need to check for null.
https://github.com/apache/kafka/blob/7d2ad185206cd4c7089fceb07f9a3f2c016f38d6/metadata/src/main/java/org/apache/kafka/metadata/PartitionRegistration.java#L221
Reviewers: Chia-Ping Tsai <[email protected]>, TengYao Chi
<[email protected]>, Yung <[email protected]>, Ken Huang
<[email protected]>
---
metadata/src/main/java/org/apache/kafka/image/TopicDelta.java | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/metadata/src/main/java/org/apache/kafka/image/TopicDelta.java
b/metadata/src/main/java/org/apache/kafka/image/TopicDelta.java
index b5ae7068988..553fc54c07b 100644
--- a/metadata/src/main/java/org/apache/kafka/image/TopicDelta.java
+++ b/metadata/src/main/java/org/apache/kafka/image/TopicDelta.java
@@ -211,11 +211,7 @@ public final class TopicDelta {
try {
PartitionRegistration prevPartition =
image.partitions().get(entry.getKey());
- if (
- prevPartition == null ||
- prevPartition.directories == null ||
- prevPartition.directory(brokerId) !=
entry.getValue().directory(brokerId)
- ) {
+ if (prevPartition == null || prevPartition.directory(brokerId)
!= entry.getValue().directory(brokerId)) {
directoryIds.put(
new TopicIdPartition(id(), new TopicPartition(name(),
entry.getKey())),
entry.getValue().directory(brokerId)