You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Николай Ижиков <ni...@apache.org> on 2023/02/20 20:43:40 UTC

[REVIEW REQUEST] Adjust Kafka log format with ZK

Hello.

I investigate some production failure lately and found that current log format for WA ZOOKEEPER-2985 [1] not aligned with ZK internal log format.
Kafka print ZK session id as decimal while Zookeeper outputs using hex format.

For example:
```
[2023-02-01 00:42:17,590] INFO Session establishment complete on server some.server.name/[some_server_ip]:[server_port], sessionid = 0x4002429158c0005, negotiated timeout = 6000 (org.apache.zookeeper.ClientCnxn)
[2023-02-01 00:42:17,650] ERROR Error while creating ephemeral at /brokers/ids/2, node already exists and owner '144155473589174273' does not match current session '288270135025467397' (kafka.zk.KafkaZkClient$CheckedEphemeral)
[2023-02-01 00:42:22,823] WARN Client session timed out, have not heard from server in 4743ms for sessionid 0x100241c44620009 (org.apache.zookeeper.ClientCnxn)
```

Please, note that 
```
scala> java.lang.Long.toHexString(288270135025467397L)
val res1: String = 4002429158c0005

scala> java.lang.Long.toHexString(144155473589174273L)
val res0: String = 20024a3b3b60001
```

So «288270135025467397» from CheckedEphemeral log actually points to newly created ZK session from previous line «0x4002429158c0005» 
It seems more convenient to print session id in hex format.

I prepared PR [2] to fix this.
Please, review.

[1] https://issues.apache.org/jira/browse/ZOOKEEPER-2985
[2] https://github.com/apache/kafka/pull/13281


Re: [REVIEW REQUEST] Adjust Kafka log format with ZK

Posted by Николай Ижиков <ni...@apache.org>.
Please, take a look at PR.
I’m sure it’s a valuable change.

Should I file a ticket?

> 20 февр. 2023 г., в 23:43, Николай Ижиков <NI...@gmail.com> написал(а):
> 
> Hello.
> 
> I investigate some production failure lately and found that current log format for WA ZOOKEEPER-2985 [1] not aligned with ZK internal log format.
> Kafka print ZK session id as decimal while Zookeeper outputs using hex format.
> 
> For example:
> ```
> [2023-02-01 00:42:17,590] INFO Session establishment complete on server some.server.name/[some_server_ip]:[server_port], sessionid = 0x4002429158c0005, negotiated timeout = 6000 (org.apache.zookeeper.ClientCnxn)
> [2023-02-01 00:42:17,650] ERROR Error while creating ephemeral at /brokers/ids/2, node already exists and owner '144155473589174273' does not match current session '288270135025467397' (kafka.zk.KafkaZkClient$CheckedEphemeral)
> [2023-02-01 00:42:22,823] WARN Client session timed out, have not heard from server in 4743ms for sessionid 0x100241c44620009 (org.apache.zookeeper.ClientCnxn)
> ```
> 
> Please, note that 
> ```
> scala> java.lang.Long.toHexString(288270135025467397L)
> val res1: String = 4002429158c0005
> 
> scala> java.lang.Long.toHexString(144155473589174273L)
> val res0: String = 20024a3b3b60001
> ```
> 
> So «288270135025467397» from CheckedEphemeral log actually points to newly created ZK session from previous line «0x4002429158c0005» 
> It seems more convenient to print session id in hex format.
> 
> I prepared PR [2] to fix this.
> Please, review.
> 
> [1] https://issues.apache.org/jira/browse/ZOOKEEPER-2985
> [2] https://github.com/apache/kafka/pull/13281
>