Skip to content

ZOOKEEPER-3167:add an API and the corresponding CLI to get total count of recursive sub nodes under a specific path#790

Closed
maoling wants to merge 1 commit intoapache:masterfrom
maoling:ZOOKEEPER-3167
Closed

ZOOKEEPER-3167:add an API and the corresponding CLI to get total count of recursive sub nodes under a specific path#790
maoling wants to merge 1 commit intoapache:masterfrom
maoling:ZOOKEEPER-3167

Conversation

@maoling
Copy link
Member

@maoling maoling commented Jan 30, 2019

  • Thanks the original patch from TyqITstudent .

  • the getAllChildrenNumber api supports sync and async, don't support watch.
    since getChildren() can get the number of the first level,to keep the api short and clean,don't use a boolean flag to let this api get the number of the first level child.

  • the implements using the parallelStream() which have the almost 4x speed up than forEach(I test),it will return at once even a millons of keys.

  • getAllChildrenNumber doesn't have a synchronized lock, to avoid holding the nodes for a long time,so when too many concurrent writes, the number will be not very precise.

  • about getAllChildrenNumber CLI:

    [zk: localhost:2181(CONNECTED) 6] getAllChildrenNumber /zookeeper
    2
    [zk: localhost:2181(CONNECTED) 7] getAllChildrenNumber /zookeeper/quota
    0

  • there is no good place to document the new api, I create a seperate jira-ZOOKEEPER-3259.

…t of recursive sub nodes under a specific path
@maoling maoling closed this Jan 30, 2019
@maoling maoling reopened this Jan 30, 2019
@maoling
Copy link
Member Author

maoling commented Jan 31, 2019

retest this please

@maoling maoling closed this Jan 31, 2019
@maoling maoling reopened this Jan 31, 2019
Copy link
Contributor

@anmolnar anmolnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@dineshappavoo
Copy link

@maoling This looks good. Could we add some documentation about the new API? Also may be we should cancel the other PR #720.

@maoling
Copy link
Member Author

maoling commented Feb 5, 2019

@dineshappavoo
Yes,We should doc this new API,just as I said in this PR's gitub description.

  • there is no good place to document the new api, I create a seperate jira-ZOOKEEPER-3259.
  • I am working on creating a new client.md to give a detailed descriptions about all the Apis.
  • After this patch is merged, ZOOKEEPER-3259 will follow behind asap and we will have a good place to document the apis. :D

@asfgit asfgit closed this in bd09fda Feb 7, 2019
@anmolnar
Copy link
Contributor

anmolnar commented Feb 7, 2019

Landed. Thanks @maoling !
I'm looking forward to reviewing the new docs.

@maoling
Copy link
Member Author

maoling commented Feb 7, 2019

@anmolnar
Yes, the doc is coming, the work is almost finished :D

RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Sep 3, 2022
…nt of recursive sub nodes under a specific path

- Thanks the original patch from [TyqITstudent ](https://github.com/TyqITstudent).
- the `getAllChildrenNumber` api supports `sync` and `async`, don't support `watch`.
  since` getChildren()` can get the number of the first level,to keep the api short and clean,don't use a boolean flag to let this api get the number of the first level child.
- the implements using the` parallelStream()` which have the almost `4x` speed up than `forEach`(I test),it will return at once even a millons of keys.
- `getAllChildrenNumber` doesn't have a `synchronized `lock, to avoid holding the `nodes` for a long time,so when too many concurrent writes, the number will be not very precise.
- about `getAllChildrenNumber` CLI:

    > [zk: localhost:2181(CONNECTED) 6] getAllChildrenNumber /zookeeper
    > 	2
    > 	[zk: localhost:2181(CONNECTED) 7] getAllChildrenNumber /zookeeper/quota
    > 	0

- there is no good place to document the new api, I create a seperate jira-[ZOOKEEPER-3259](https://issues.apache.org/jira/projects/ZOOKEEPER/issues/ZOOKEEPER-3259).

Author: maoling <maoling199210191@sina.com>

Reviewers: andor@apache.org

Closes apache#790 from maoling/ZOOKEEPER-3167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants