Re: Create node with ancestors?

2010-10-07 Thread David Rosenstrauch

On 10/05/2010 06:20 PM, David Rosenstrauch wrote:

The ZK create method explicitly states in the documentation If the
parent node does not exist in the ZooKeeper, a KeeperException with
error code KeeperException.NoNode will be thrown. (
(http://hadoop.apache.org/zookeeper/docs/current/api/org/apache/zookeeper/ZooKeeper.html#create%28java.lang.String,%20byte[],%20java.util.List,%20org.apache.zookeeper.CreateMode%29))
As a result, there doesn't appear to be any one single method call that
can create a node, along with any missing parent nodes. This would be an
incredibly useful API call, though, akin to HDFS' mkdirs method call.
(http://hadoop.apache.org/common/docs/r0.20.1/api/org/apache/hadoop/fs/FileSystem.html#mkdirs%28org.apache.hadoop.fs.Path%29)


Anybody know if there's a call like this available somewhere in the ZK API?

Thanks,

DR


I guess that's a no.  :-(

DR


Re: Create node with ancestors?

2010-10-07 Thread Jared Cantwell
We just wrote a very simple helper method that splits the path up and
creates each parent in the path.  Its a total of 5 lines of code.
This isn't as efficient as it can be though if you're doing it
frequently (which we don't do), but it works for us.

~Jared

On Thu, Oct 7, 2010 at 11:35 AM, David Rosenstrauch dar...@darose.net wrote:
 On 10/05/2010 06:20 PM, David Rosenstrauch wrote:

 The ZK create method explicitly states in the documentation If the
 parent node does not exist in the ZooKeeper, a KeeperException with
 error code KeeperException.NoNode will be thrown. (

 (http://hadoop.apache.org/zookeeper/docs/current/api/org/apache/zookeeper/ZooKeeper.html#create%28java.lang.String,%20byte[],%20java.util.List,%20org.apache.zookeeper.CreateMode%29))
 As a result, there doesn't appear to be any one single method call that
 can create a node, along with any missing parent nodes. This would be an
 incredibly useful API call, though, akin to HDFS' mkdirs method call.

 (http://hadoop.apache.org/common/docs/r0.20.1/api/org/apache/hadoop/fs/FileSystem.html#mkdirs%28org.apache.hadoop.fs.Path%29)


 Anybody know if there's a call like this available somewhere in the ZK
 API?

 Thanks,

 DR

 I guess that's a no.  :-(

 DR



Re: Create node with ancestors?

2010-10-07 Thread David Rosenstrauch

Yeah, I guess I'll have to whip up something similar.

Thanks,

DR

On 10/07/2010 11:43 AM, Jared Cantwell wrote:

We just wrote a very simple helper method that splits the path up and
creates each parent in the path.  Its a total of 5 lines of code.
This isn't as efficient as it can be though if you're doing it
frequently (which we don't do), but it works for us.

~Jared

On Thu, Oct 7, 2010 at 11:35 AM, David Rosenstrauchdar...@darose.net  wrote:

On 10/05/2010 06:20 PM, David Rosenstrauch wrote:


The ZK create method explicitly states in the documentation If the
parent node does not exist in the ZooKeeper, a KeeperException with
error code KeeperException.NoNode will be thrown. (

(http://hadoop.apache.org/zookeeper/docs/current/api/org/apache/zookeeper/ZooKeeper.html#create%28java.lang.String,%20byte[],%20java.util.List,%20org.apache.zookeeper.CreateMode%29))
As a result, there doesn't appear to be any one single method call that
can create a node, along with any missing parent nodes. This would be an
incredibly useful API call, though, akin to HDFS' mkdirs method call.

(http://hadoop.apache.org/common/docs/r0.20.1/api/org/apache/hadoop/fs/FileSystem.html#mkdirs%28org.apache.hadoop.fs.Path%29)


Anybody know if there's a call like this available somewhere in the ZK
API?

Thanks,

DR


I guess that's a no.  :-(

DR