You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ch...@apache.org on 2024/06/22 12:09:39 UTC

(kafka) branch trunk updated: MINOR: Remove unused method 'createDirectoriesFrom' in DirectoryId (#16419)

This is an automated email from the ASF dual-hosted git repository.

chia7712 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 96171026d5e MINOR: Remove unused method 'createDirectoriesFrom' in DirectoryId (#16419)
96171026d5e is described below

commit 96171026d5edf139c36caf54ed86c437e9cb9fe4
Author: Dmitry Werner <gr...@gmail.com>
AuthorDate: Sat Jun 22 17:09:33 2024 +0500

    MINOR: Remove unused method 'createDirectoriesFrom' in DirectoryId (#16419)
    
    Reviewers: Igor Soarez <so...@apple.com>, Gaurav Narula <ga...@apple.com>, Chia-Ping Tsai <ch...@gmail.com>
---
 .../java/org/apache/kafka/common/DirectoryId.java  | 26 +---------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/server-common/src/main/java/org/apache/kafka/common/DirectoryId.java b/server-common/src/main/java/org/apache/kafka/common/DirectoryId.java
index defcdec17cf..425a652ba2a 100644
--- a/server-common/src/main/java/org/apache/kafka/common/DirectoryId.java
+++ b/server-common/src/main/java/org/apache/kafka/common/DirectoryId.java
@@ -16,7 +16,6 @@
  */
 package org.apache.kafka.common;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -71,29 +70,6 @@ public class DirectoryId {
             uuid.getLeastSignificantBits() < 100;
     }
 
-    /**
-     * Calculate the new directory information based on an existing replica assignment.
-     * Replicas for which there already is a directory ID keep the same directory.
-     * All other replicas get {@link #UNASSIGNED}.
-     * @param currentReplicas               The current replicas, represented by the broker IDs
-     * @param currentDirectories            The current directory information
-     * @param newReplicas                   The new replica list
-     * @return                              The new directory list
-     * @throws IllegalArgumentException     If currentReplicas and currentDirectories have different lengths,
-     *                                      or if there are duplicate broker IDs in the replica lists
-     */
-    public static List<Uuid> createDirectoriesFrom(int[] currentReplicas, Uuid[] currentDirectories, List<Integer> newReplicas) {
-        if (currentReplicas == null) currentReplicas = new int[0];
-        if (currentDirectories == null) currentDirectories = new Uuid[0];
-        Map<Integer, Uuid> assignments = createAssignmentMap(currentReplicas, currentDirectories);
-        List<Uuid> consolidated = new ArrayList<>(newReplicas.size());
-        for (int newReplica : newReplicas) {
-            Uuid newDirectory = assignments.getOrDefault(newReplica, UNASSIGNED);
-            consolidated.add(newDirectory);
-        }
-        return consolidated;
-    }
-
     /**
      * Build a mapping from replica to directory based on two lists of the same size and order.
      * @param replicas                      The replicas, represented by the broker IDs
@@ -156,7 +132,7 @@ public class DirectoryId {
 
         // The only time we should have a size be 0 is if we were at a MV prior to 3.7-IV2
         // and the system was upgraded. In this case the original list of directories was purged
-        // during broker registration so we don't know if the directory is online. We assume
+        // during broker registration, so we don't know if the directory is online. We assume
         // that a broker will halt if all its log directories are down. Eventually the broker
         // will send another registration request with information about all log directories.
         // Refer KAFKA-16162 for more information