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

Stu Hood commented on ZOOKEEPER-44:
-----------------------------------

I'd be fine with the sort being removed from getChildren, but fixing the 
natural sorting problem is still important. It causes undue pain for the client 
to have to perform an integer-aware sort to get the proper ordering for locks.

My workaround was to pad the sequence value before appending it to the path in 
create:
{code:java}
if ((createRequest.getFlags() & CreateFlags.SEQUENCE) != 0) {
    path = path + String.format("%1$010d", parentCVersion);
}
{code} 

> DataTree does not use natural sort for getChildren
> --------------------------------------------------
>
>                 Key: ZOOKEEPER-44
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-44
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.0.0
>            Reporter: Stu Hood
>            Priority: Minor
>
> DataTree.getChildren() performs Collection.sort() on the list of children 
> before returning it, but Java's default comparator for Strings will sort 
> 'lock-20' before 'lock-3' for instance. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to