-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
WatchResponse.Canceled is not triggered to true #8231
Comments
I think the comment is wrong? User should rely on error instead? Or we switch to always set canceled to true when there is an error? |
And also the question is, can there be some errors, which don't lead to channel close? If can - the Canceled flag is usefull. |
There aren't any errors that won't also close the watch, but it might be nice to have them in the future. The server doesn't set It seems like the server should set both |
BTW, Anthony, I've got another concern. You say it's server who closes the channel on compact. When does it do this? We just hit this issue several days ago, we had some long-lasting watches for service discovery and etcd compaction once per 24 hours. And suddenly services received watch channel close - though I played around and could not reproduce this case. If you watch starting from some revision, then make compact to the server - the watch channel is still alive and receives the events! I couldn't make it closed by compact. And what's the purpose to close the channel on compact? I don't care if the revision I start watching from is compacted or not - I just need the kv updates to start from particular revision. So could you please describe the mechanics behind watch + compact in details? |
@heyitsanthony ping :) |
if closes the connection if the watcher wants to watch (or watching on) compacted revisions. |
Yes, it's OK to close the connection with error if you try to start the watch on compacted revision. And it does so.
That's why I'm asking, if such situation with compaction error during some active watch could possibly occur. Is it intended behaviour or kind of a bug? It's double strange, that we use this code for several months, and we hit such behaviour only now. |
Because it's strange for me to close a watch just because the revision you start watching from is compacted. What's the point? |
can you reproduce this? if yes, then it is a bug.
it can happen if your watcher is slow and lagging. and you compact at the current head. if you believe this is not the case, either reproduce it or look into the code to fix it? |
Yeap, I agree, it should be reproducible to be considered a bug. If I find a way to reproduce - I'll tell you. It was important for me only to ensure that you don't consider it as expected behaviour either :)
But there is no other out-of-box way to compact, only at current head with |
this is what etcd does not. it compacts 24 hours from now. keep 24 hours history basically. |
Oh, great then. I thought it's just a time period for starting head compaction. Current documentation doesn't explain it well enough :) |
@mwf maybe help us improve the documentation? thanks :P |
Easily :) |
I received this error today I believe -- I got an error:
on a watch that had been active for several hours. Here is the prior compaction in the etcd logs. I would have started the watch on revision 9.
Is this then not expected? The server is running v3.1.9, the client API is the latest code. |
@newhook is there an easy way to reproduce this? I think what happened was the watch was waiting for an event with rev >= 9, the kv store was compacted to rev=51, the watch disconnected, then reconnected into a compacted error. Using |
That makes sense, is that expected to occur? This is occurring in a GCE private network so I doubt there are underlying network issues. I can reproduce pretty easily I think. If I don't use What this code is doing is:
So its implemented like so:
The revision here ensures that I don't miss any changes after (1) and before (3). A couple of ideas to fix the problem:
|
This is how it's usually done. It also covers the case where the client is partitioned and there is a compaction, which isn't helped by WithProgressNotify. |
Hi team!
You have some inconsistency between clientv3 Watch documentation and real behavior!
Docs says:
But you receive response with
Canceled = false
in case of revision compaction! And then the channel is unexpectedly closed!Try this (consider
1
as some compacted revision):The result will be:
According to documentation I expect
Canceled
to be set totrue
every time the response channel is going to be closed.The problem exists both for etcd 3.1.x and 3.2.x clients.
What do you think about it?
The text was updated successfully, but these errors were encountered: