Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

etcdctlv3: get range sorted by create not working as expected #6671

Closed
jlamillan opened this issue Oct 18, 2016 · 5 comments
Closed

etcdctlv3: get range sorted by create not working as expected #6671

jlamillan opened this issue Oct 18, 2016 · 5 comments

Comments

@jlamillan
Copy link
Contributor

jlamillan commented Oct 18, 2016

etcd v3.0.12 single local node cluster.

I am trying to use etcdctl get to get a range sorted by the creation time. However, I am seeing the range seems to be always sorted in lexical order.

For example, if I create keys foo3, foo1, and foo2 in that order:

$ etcdctl put foo3 foo3val OK
$ etcdctl put foo1 foo1val OK
$ etcdctl put foo2 foo2val OK

Then try and get them, sorting by CREATE, I expect foo3, foo1, and foo2, but instead I get foo1, foo2, and foo3:

$ etcdctl get --sort-by=CREATE foo foo4
foo1 foo1val foo2 foo2val foo3 foo3val

@gyuho
Copy link
Contributor

gyuho commented Oct 18, 2016

Try

ETCDCTL_API=3 etcdctl get --sort-by=CREATE --order=ASCEND foo foo4

?

Works for me.

@gyuho
Copy link
Contributor

gyuho commented Oct 18, 2016

Probably we need better documentation around this.

gyuho added a commit to gyuho/etcd that referenced this issue Oct 18, 2016
gyuho added a commit to gyuho/etcd that referenced this issue Oct 18, 2016
@xiang90
Copy link
Contributor

xiang90 commented Oct 18, 2016

@gyuho why we should provide an order here? if i tell etcdctl to sort keys by created revision, it should either sort them ascend or descend. right?

gyuho added a commit to gyuho/etcd that referenced this issue Oct 18, 2016
gyuho added a commit to gyuho/etcd that referenced this issue Oct 18, 2016
@gyuho
Copy link
Contributor

gyuho commented Oct 18, 2016

Closing via #6672.

@gyuho gyuho closed this as completed Oct 18, 2016
@jlamillan
Copy link
Contributor Author

Thanks guys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants