go-zookeeper / zk

Native ZooKeeper client for Go
BSD 3-Clause "New" or "Revised" License
504 stars 130 forks source link

Create TTL Node shows invalid arguments #119

Closed Mengyantong closed 2 months ago

Mengyantong commented 8 months ago

I am facing an issue while attempting to create a TTL node. During the execution of the corresponding function, I consistently encounter an "invalid arguments" error. My parameters align with the function definition, yet the error persists. Could it be that I am using the function incorrectly? My code like: res, err := conn.CreateTTL("/testpath", []byte("ttl node"), zk.FlagTTL, zk.WorldACL(zk.PermAll), time.Second)

alandiegosantos commented 5 months ago

The FlagTTL in go-zookeeper/zk is wrong. The CreateMode flag of PERSISTENT_WITH_TTL is 5 in zookeeper code while in the go-zookeeper/zk is 4. In this case, the Create is trying to create a Container instead of a persistent node with TTL.

I will push a PR to fix this.