Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to create nodes with TTL #496

Open
dlanza1 opened this issue Mar 5, 2018 · 9 comments
Open

Possibility to create nodes with TTL #496

dlanza1 opened this issue Mar 5, 2018 · 9 comments

Comments

@dlanza1
Copy link

dlanza1 commented Mar 5, 2018

Hi,

Current versions of Zookeeper allow to specify a TTL for node removal. What about making this library compatible with that?

Thanks in advance,
Daniel

@jeffwidman
Copy link
Member

Pull requests are welcome. Currently I (and AFAIK the other maintainers) don't have much bandwidth to add new features, but I do try to review PRs.

@nakulpathak3
Copy link
Contributor

nakulpathak3 commented Dec 7, 2018

What work would this entail? If someone could describe this better and if it's not a crazy amount of work, I could pick it up.

@nakulpathak3
Copy link
Contributor

From quick first review, it seems like we'd be adding support for https://zookeeper.apache.org/doc/r3.5.4-beta/zookeeperProgrammers.html#TTL+Nodes.

The code would go somewhere here https://github.com/python-zk/kazoo/blob/master/kazoo/client.py#L812-L963 (along with changes to test). I can't find the API call to make in the API/Java Client https://zookeeper.apache.org/doc/r3.4.6/api/org/apache/zookeeper/ZooKeeper.html#create(java.lang.String,%20byte[],%20java.util.List,%20org.apache.zookeeper.CreateMode). Any tips on what the API call would look like will be helpful!

Other info:
Seems like it's only supported for PERSISTENT and PERSISTENT_SEQUENTIAL type nodes. And that it's not enabled by default in zookeeper right now (mentioned in the TTL Node description link above)

@StephenSorriaux
Copy link
Member

@nakulpathak3 I think you are right, a new parameter ttl could be added to the create() and create_async() methods with, I guess, default to None.

I think you didn't find the ttl parameter in the Java client because this feature was added for the 3.5.3 version and you were looking at the 3.4.6 version. I found the method here: https://zookeeper.apache.org/doc/r3.5.4-beta/api/org/apache/zookeeper/ZooKeeper.html#create-java.lang.String-byte:A-java.util.List-org.apache.zookeeper.CreateMode-org.apache.zookeeper.data.Stat-long-

As far as I can see in the code (https://github.com/apache/zookeeper/blob/release-3.5.4/src/java/main/org/apache/zookeeper/ZooKeeper.java#L1634), it requires the CreateTTL request that we currently don't have in the client. You will need to add it the kazoo.protocol.serialization module with type=21 (https://github.com/apache/zookeeper/blob/cb9f303bda9137d1aebe8eff3eab85c8a59f3cdd/zookeeper-server/src/main/java/org/apache/zookeeper/ZooDefs.java#L75 & https://github.com/apache/zookeeper/blob/release-3.5.4/src/zookeeper.jute#L130).

Since you need a specific zookeeper configuration for the test, I suggest you to use what I developed when I added the SASL support (https://github.com/python-zk/kazoo/blob/master/kazoo/testing/harness.py#L42-L51)

@nakulpathak3
Copy link
Contributor

I won't have time to tackle this for the next few weeks unfortunately so if someone else sees this and wants to until then, go ahead. If not, I'll come back around mid February.

@shoundhariya
Copy link

I will take this up.

ceache added a commit to ceache/kazoo that referenced this issue Jun 16, 2020
ceache added a commit to ceache/kazoo that referenced this issue Jun 16, 2020
ceache added a commit to ceache/kazoo that referenced this issue Jun 16, 2020
ceache added a commit to ceache/kazoo that referenced this issue Jun 16, 2020
ceache added a commit to ceache/kazoo that referenced this issue Jun 16, 2020
ceache added a commit to ceache/kazoo that referenced this issue Jun 2, 2022
ceache added a commit to ceache/kazoo that referenced this issue Jun 2, 2022
ceache added a commit to ceache/kazoo that referenced this issue Jun 2, 2022
ceache added a commit to ceache/kazoo that referenced this issue Jun 2, 2022
ceache added a commit to ceache/kazoo that referenced this issue Jun 2, 2022
ceache added a commit to ceache/kazoo that referenced this issue Jun 2, 2022
ceache added a commit to ceache/kazoo that referenced this issue Jun 2, 2022
ceache added a commit to ceache/kazoo that referenced this issue Jun 2, 2022
ceache added a commit to ceache/kazoo that referenced this issue Feb 12, 2023
ceache added a commit to ceache/kazoo that referenced this issue Feb 12, 2023
ceache added a commit to ceache/kazoo that referenced this issue Feb 12, 2023
@rei-ber
Copy link

rei-ber commented Aug 7, 2023

I am also interested in this feature. What is the current state?

@ceache
Copy link
Contributor

ceache commented Aug 7, 2023 via email

@rei-ber
Copy link

rei-ber commented Sep 20, 2023

When do you plan to merge it? And when do you plan a new kazoo release?

ceache added a commit to ceache/kazoo that referenced this issue Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants