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

etcdctl watch returned before real value change #2114

Closed
linfan opened this issue Jan 16, 2015 · 2 comments
Closed

etcdctl watch returned before real value change #2114

linfan opened this issue Jan 16, 2015 · 2 comments

Comments

@linfan
Copy link

linfan commented Jan 16, 2015

Hi,

I wrote below script watching path "/demo", it suppose to append a prefix "Hello" when the content in that path changed. Then I triggered a change on another node. But as a result, the "etcdctl get" command always got the old value of path "/demo", not the changed one.

while true; do 
    etcdctl watch ${KEY}
    etcdctl update ${KEY} "Hello $(etcdctl get ${KEY})"    
done

However, after I put a bit delay before getting the value of path, it begin to work as expected.

while true; do 
    etcdctl watch ${KEY}
    sleep 1s      # <-- wait 1s here
    etcdctl update ${KEY} "Hello $(etcdctl get ${KEY})"    
done

So from appearance, the reason is when "etcdctl watch" command returned, etcd is still under synchronisation process and not ready to provide the new value.

Is this a designed behaviour or unexpected issue?

@xiang90
Copy link
Contributor

xiang90 commented Jan 24, 2015

@linfan Can you try to reproduce this on current master? Thanks.

@linfan
Copy link
Author

linfan commented Feb 26, 2015

I tried again against the master build, this issue already gone. Thanks!

The etcd version tagged as 2.0.3

root@7db926a0818c:/etcd/bin# ./etcd --version
etcd version 2.0.3

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