zookeeper icon indicating copy to clipboard operation
zookeeper copied to clipboard

ZOOKEEPER-4966: Decouple `ZKConfig` from `QuorumPeerConfig.ConfigException`

Open kezhuw opened this issue 4 months ago • 1 comments

ZKConfig is client accessible, it should avoid accessing server side QuorumPeerConfig.

Changes:

  1. Introduce org.apache.zookeeper.common.ConfigException for ZKConfig(String configPath).
  2. Make QuorumPeerConfig.ConfigException a subclass of above.
  3. Throw QuorumPeerConfig.ConfigException if possible.

Given above changes, this pr maintain abi compatibility with old releases.

Breaking change: ZKConfig(String configPath) throws org.apache.zookeeper.common.ConfigException now but not QuorumPeerConfig.ConfigException, so developers have to fix it to compile.

This is a small step towards ZOOKEEPER-233.

Refs: ZOOKEEPER-233, ZOOKEEPER-835, and ZOOKEEPER-842.

kezhuw avatar Aug 20 '25 16:08 kezhuw

The breaking change is source code level so it won't break runtime code. We could also make org.apache.zookeeper.common.ConfigException as an unchecked exception, but that could break runtime expectation as it could be catched as RuntimeException. I would prefer to break in source code leve but not runtime.

Give this pr and #2305, I could split zookeeper-client from zookeeper-server by moving classes mostly, though, the package hierarcy does not look good.

kezhuw avatar Aug 20 '25 16:08 kezhuw

@kezhuw Did you see my comments?

anmolnar avatar Dec 13 '25 03:12 anmolnar