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

mvcc: tighten up watcher cancelation and revision handling #5464

Merged
merged 2 commits into from
May 31, 2016

Conversation

heyitsanthony
Copy link
Contributor

Makes w.cur into w.minrev, the minimum revision for the next update, and
retries cancelation if the watcher isn't found (because it's being processed
by moveVictims).

Fixes: #5459

break
}
break
}
Copy link
Contributor

@gyuho gyuho May 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break here, instead of two breaks?

Copy link
Contributor

@gyuho gyuho May 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm. thought it was else

@gyuho
Copy link
Contributor

gyuho commented May 27, 2016

test failure is related to this change?

@heyitsanthony
Copy link
Contributor Author

@gyuho not sure; the test that's failing (TestGRPCStreamRequireLeader) is already broken in master but the failure mode is "etcdserver: not capable" and not a timeout.

@gyuho
Copy link
Contributor

gyuho commented May 27, 2016

Oh you already created an issue. Got it.

@@ -307,7 +318,7 @@ func (s *watchableStore) moveVictims() (moved int) {
// try to send responses again
for w, eb := range wb {
select {
case w.ch <- WatchResponse{WatchID: w.id, Events: eb.evs, Revision: w.cur}:
case w.ch <- WatchResponse{WatchID: w.id, Events: eb.evs, Revision: w.minRev - 1}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have some comments on why -1?

@xiang90
Copy link
Contributor

xiang90 commented May 27, 2016

lgtm

@heyitsanthony
Copy link
Contributor Author

still broken following the api capability fixes, will investigate

@heyitsanthony
Copy link
Contributor Author

It was deadlocking waiting for the recvLoop to finish since the stream recv doesn't close until the handler exits; now it only waits on the send loop. The watcher wg patch is still necessary since the watchStream close needs to be synchronous to avoid spurious goroutine leak errors and must run concurrently with the recvloop goroutine to avoid deadlock

Makes w.cur into w.minrev, the minimum revision for the next update, and
retries cancelation if the watcher isn't found (because it's being processed
by moveVictims).

Fixes: etcd-io#5459
@heyitsanthony heyitsanthony merged commit 9c767cb into etcd-io:master May 31, 2016
@heyitsanthony heyitsanthony deleted the fix-victim-watchers branch May 31, 2016 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants