Skip to content

Commit 2e774cc

Browse files
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]>
1 parent 9a0239a commit 2e774cc

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

metadata/src/main/java/org/apache/kafka/image/TopicDelta.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,7 @@ public LocalReplicaChanges localChanges(int brokerId) {
211211

212212
try {
213213
PartitionRegistration prevPartition = image.partitions().get(entry.getKey());
214-
if (
215-
prevPartition == null ||
216-
prevPartition.directories == null ||
217-
prevPartition.directory(brokerId) != entry.getValue().directory(brokerId)
218-
) {
214+
if (prevPartition == null || prevPartition.directory(brokerId) != entry.getValue().directory(brokerId)) {
219215
directoryIds.put(
220216
new TopicIdPartition(id(), new TopicPartition(name(), entry.getKey())),
221217
entry.getValue().directory(brokerId)

0 commit comments

Comments
 (0)