Skip to content

Commit

Permalink
MINOR: Adjust logging with ZK log format (apache#13281)
Browse files Browse the repository at this point in the history
This PR adjust Kafka log format with ZK by printing ZK session id in hex format like ZK do.

Reviewers: Luke Chen <showuon@gmail.com>
  • Loading branch information
nizhikov committed Feb 23, 2023
1 parent 3fe2f8c commit ea08d0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/scala/kafka/zk/KafkaZkClient.scala
Expand Up @@ -43,6 +43,7 @@ import org.apache.zookeeper.common.ZKConfig
import org.apache.zookeeper.data.{ACL, Stat}
import org.apache.zookeeper.{CreateMode, KeeperException, OpResult, ZooKeeper}

import java.lang.{Long => JLong}
import scala.collection.{Map, Seq, mutable}

sealed trait KRaftRegistrationResult
Expand Down Expand Up @@ -2176,12 +2177,12 @@ class KafkaZkClient private[zk] (zooKeeperClient: ZooKeeperClient, isSecure: Boo
// be deleted.
case Code.OK if shouldReCreateEphemeralZNode(ephemeralOwnerId) =>
info(s"Was not possible to create the ephemeral at $path, node already exists and owner " +
s"'$ephemeralOwnerId' does not match current session '${zooKeeperClient.sessionId}'" +
s"'0x${JLong.toHexString(ephemeralOwnerId)}' does not match current session '0x${JLong.toHexString(zooKeeperClient.sessionId)}'" +
s", trying to delete and re-create it with the newest Zookeeper session")
reCreate()
case Code.OK if ephemeralOwnerId != zooKeeperClient.sessionId =>
error(s"Error while creating ephemeral at $path, node already exists and owner " +
s"'$ephemeralOwnerId' does not match current session '${zooKeeperClient.sessionId}'")
s"'0x${JLong.toHexString(ephemeralOwnerId)}' does not match current session '0x${JLong.toHexString(zooKeeperClient.sessionId)}'")
throw KeeperException.create(Code.NODEEXISTS)
case Code.OK =>
getDataResponse.stat
Expand Down

0 comments on commit ea08d0d

Please sign in to comment.