You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by cm...@apache.org on 2024/03/26 00:04:15 UTC

(kafka) 01/02: Rename 'mangling' to 'sanitization' to be more consistent

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

cmccabe pushed a commit to branch KAFKA-16411
in repository https://gitbox.apache.org/repos/asf/kafka.git

commit cbe5ada027c1882b74ea55e998325f62be2f611b
Author: Colin P. McCabe <cm...@apache.org>
AuthorDate: Mon Mar 25 12:23:08 2024 -0700

    Rename 'mangling' to 'sanitization' to be more consistent
---
 .../kafka/zk/migration/ZkConfigMigrationClient.scala   | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/core/src/main/scala/kafka/zk/migration/ZkConfigMigrationClient.scala b/core/src/main/scala/kafka/zk/migration/ZkConfigMigrationClient.scala
index 04a58894ae7..fda6e93c249 100644
--- a/core/src/main/scala/kafka/zk/migration/ZkConfigMigrationClient.scala
+++ b/core/src/main/scala/kafka/zk/migration/ZkConfigMigrationClient.scala
@@ -21,7 +21,7 @@ import kafka.server.{DynamicBrokerConfig, DynamicConfig, ZkAdminManager}
 import kafka.utils.Logging
 import kafka.zk.ZkMigrationClient.{logAndRethrow, wrapZkException}
 import kafka.zk._
-import kafka.zk.migration.ZkConfigMigrationClient.getMangledClientQuotaZNodeName
+import kafka.zk.migration.ZkConfigMigrationClient.getSanitizedClientQuotaZNodeName
 import kafka.zookeeper.{CreateRequest, DeleteRequest, SetDataRequest}
 import org.apache.kafka.clients.admin.ScramMechanism
 import org.apache.kafka.common.config.types.Password
@@ -81,8 +81,8 @@ class ZkConfigMigrationClient(
       // which have their names set to the empty string instead.
       result.setEntityName(null)
     } else {
-      // ZNode names are mangled before being stored in ZooKeeper.
-      // For example, @ is turned into %40. Undo the mangling here.
+      // ZNode names are sanitized before being stored in ZooKeeper.
+      // For example, @ is turned into %40. Undo the sanitization here.
       result.setEntityName(Sanitizer.desanitize(znodeName))
     }
     result
@@ -261,9 +261,9 @@ class ZkConfigMigrationClient(
     scram: util.Map[String, String],
     state: ZkMigrationLeadershipState
   ): ZkMigrationLeadershipState = wrapZkException {
-    val user: Option[String] = getMangledClientQuotaZNodeName(entity, ClientQuotaEntity.USER)
-    val client: Option[String] = getMangledClientQuotaZNodeName(entity, ClientQuotaEntity.CLIENT_ID)
-    val ip: Option[String] = getMangledClientQuotaZNodeName(entity, ClientQuotaEntity.IP)
+    val user: Option[String] = getSanitizedClientQuotaZNodeName(entity, ClientQuotaEntity.USER)
+    val client: Option[String] = getSanitizedClientQuotaZNodeName(entity, ClientQuotaEntity.CLIENT_ID)
+    val ip: Option[String] = getSanitizedClientQuotaZNodeName(entity, ClientQuotaEntity.IP)
     val props = new Properties()
 
     val (configType, path, configKeys) = if (user.isDefined && client.isEmpty) {
@@ -369,7 +369,7 @@ object ZkConfigMigrationClient {
    * @param component   The component that we want a znode name for.
    * @return            Some(znodeName) if there is a znode path; None otherwise.
    */
-  def getMangledClientQuotaZNodeName(
+  def getSanitizedClientQuotaZNodeName(
     entity: util.Map[String, String],
     component: String
   ): Option[String] = {
@@ -385,10 +385,10 @@ object ZkConfigMigrationClient {
         // "not present." This is an unfortunate API that should be revisited at some point.
         Some(ZooKeeperInternals.DEFAULT_STRING)
       } else {
-        // We found a non-null value, and now we need to mangle it. For example, "c@@ldude" will
+        // We found a non-null value, and now we need to sanitize it. For example, "c@@ldude" will
         // turn into c%40%40ldude, so that we can use it as a znode name in ZooKeeper.
         Some(Sanitizer.sanitize(rawValue))
       }
     }
   }
-}
\ No newline at end of file
+}