You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by Jordan Zimmerman <jo...@jordanzimmerman.com> on 2012/06/16 01:36:39 UTC

getTopNChildren

I have a need for a version of getChildren() that only returns the first N items. This is useful for nodes that may have thousands of children. There is some work that has been done and a patch here: https://issues.apache.org/jira/browse/ZOOKEEPER-423

Does anyone know if that patch will be accepted? If so, when. If not, I can write a getTopNChildren() from scratch.

-JZ

Re: getTopNChildren

Posted by Henry Robinson <he...@cloudera.com>.
Hi Jordan -

Good question. We've gone back and forth on some variant of
getFirstNChildren several times and have never achieved consensus.

That said, this is one of the most commonly requested features for ZK, so
I'm of the opinion that we should find the least worst design and just go
with it.

I think the patch I wrote has the right idea in that it's agnostic wrt to
sort key, leaving the door open for a better way to tell ZK whether to sort
on zxid, name or some other property. Seems like what's missing is
getFirstNChildren rather than just getFirst.

If I cleaned that patch up and changed the API to be first-N, would that be
sufficient for your needs?

Henry



On 15 June 2012 16:36, Jordan Zimmerman <jo...@jordanzimmerman.com> wrote:

> I have a need for a version of getChildren() that only returns the first N
> items. This is useful for nodes that may have thousands of children. There
> is some work that has been done and a patch here:
> https://issues.apache.org/jira/browse/ZOOKEEPER-423
>
> Does anyone know if that patch will be accepted? If so, when. If not, I
> can write a getTopNChildren() from scratch.
>
> -JZ




-- 
Henry Robinson
Software Engineer
Cloudera
415-994-6679