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

Etcd V3 is missing PrevNode feature #5496

Closed
purpleidea opened this issue May 30, 2016 · 7 comments
Closed

Etcd V3 is missing PrevNode feature #5496

purpleidea opened this issue May 30, 2016 · 7 comments

Comments

@purpleidea
Copy link
Contributor

I'm porting some etcd V2 code to V3. In watch events there was the concept of PrevNode:

eg:

response.Node and response.PrevNode

This was useful to track changes easily. Is there an equivalent in V3? If not, are there any recommendations on how to emulate the behaviour?

Thanks!

@gyuho
Copy link
Contributor

gyuho commented May 31, 2016

You can range with revision to get previous value.

@xiang90
Copy link
Contributor

xiang90 commented May 31, 2016

If not, are there any recommendations on how to emulate the behaviour?

Use a txn that gets the key first, then do a delete/put.

Also this is a dup of #4620.

I would suggest you read https://github.com/coreos/etcd/blob/master/Documentation/op-guide/v2-migration.md#migrate-client-library and search the existing issues. It might save you some time. Thanks.

@xiang90 xiang90 closed this as completed May 31, 2016
@purpleidea
Copy link
Contributor Author

Interesting, how would this work? When you get your response, you'd have to
initiate a Get to get that information, right? Or is there a way to do this
without having to execute an additional request per incoming event?

On Mon, May 30, 2016 at 8:33 PM, Xiang Li [email protected] wrote:

Closed #5496 #5496.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#5496 (comment), or mute the
thread
https://github.com/notifications/unsubscribe/AAIPs7BAV2xK2n73Zk51s-egn76FjLAUks5qG4G8gaJpZM4IqFMp
.

@xiang90
Copy link
Contributor

xiang90 commented May 31, 2016

@purpleidea I think I have told you how to do it. Use a txn with one get and one write/delete requests. For example, see https://github.com/kubernetes/kubernetes/blob/master/pkg/storage/etcd3/store.go#L169-L182

@purpleidea
Copy link
Contributor Author

@xiang90 I sent that previous message before getting your initial reply. GH email has a long processing delay for both sending and receiving, sorry.

@purpleidea
Copy link
Contributor Author

@xiang90 I didn't know about this guide till now. Looks like it's brand new in git master. Thanks for the Txn tip, I wrote a patch to fix the ordering issue. Good idea! #5497

@purpleidea
Copy link
Contributor Author

As an aside, while transactions are nice, they don't actually solve this problem for watch events AFAIK. When you receive the events, there's no way to have it also contain the previous revision without adding another call. If i'm mistaken, please let me know.

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