You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Flavio Junqueira (JIRA)" <ji...@apache.org> on 2014/10/24 18:00:38 UTC

[jira] [Commented] (ZOOKEEPER-2051) Creating ephemeral znodes from within a transaction fail with local sessions

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14182973#comment-14182973 ] 

Flavio Junqueira commented on ZOOKEEPER-2051:
---------------------------------------------

I'm not sure I understand why we can't add logic to spot transactions that add ephemerals and do the same we do already for requests that create an ephemeral directly. It sounds better than the two options you're suggestion given how we deal with local sessions today.

> Creating ephemeral znodes from within a transaction fail with local sessions
> ----------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2051
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2051
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.5.0
>            Reporter: Raul Gutierrez Segales
>            Assignee: Raul Gutierrez Segales
>            Priority: Critical
>             Fix For: 3.5.1
>
>
> With local sessions enabled, the premise is that as soon as you try to create an ephemeral znode your session will be upgraded to global. The problem is that the session upgrade logic doesn't intercept transactions. So creating an ephemeral znode from within a transaction fails with SessionExpired.
> A small example with Kazoo:
> {noformat}
> from kazoo.client import KazooClient
> k = KazooClient("localhost:2181")
> k.start()
> t = k.transaction()
> t.create("/hello_", "", ephemeral=True)
> t.commit()
> [kazoo.exceptions.SessionExpiredError((), {})]
> {noformat}
> A workaround, for now, is to create an ephemeral before your transaction which forces your session to be upgraded.
> Possible solutions could be:
> * extending zookeeper_init() so that you can request global=True
> *  and/or, providing an upgradeSession() API
> Thoughts?
> cc: [~thawan], [~phunt], [~fpj]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)