I've been exploring the dynamic reconfig facitlity as we want to start
using for cluster management. To this end I've been writing a small
controller. I have some code which works but seems insane:
```
final def addServer(
currentConfigVersion: Long,
zkAdmin: ZooKeeperAdmin,
server: ZkServerLine,
): IO[Array[Byte]] = {
IO.async_[Array[Byte]] { cb =>
zkAdmin.reconfigure(
server.toServerLineString,
null,
null,
if (currentConfigVersion == 100000000) -1 else currentConfigVersion,
IODataCallBack,
cb,
)
}
}
```
If we ignore the scala async silliness for a second (zkAdmin _is_ just an
instance of ZooKeeperAdmin), and just focus on the current config
conditional. If I remove this, and just use the version of the config
presented when calling getConfig, all calls to reconfigure fail with bad
version exceptions. If I do this, I can reconfigure as much as I want,
which makes me think I _am_ seeing the correct version of the node.
Am I crazy? Is this the right way to do this? There is nothing in the docs
to suggest that this should be necessary.
Ben