-
Notifications
You must be signed in to change notification settings - Fork 60
Graceful shutdown #249
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
Graceful shutdown #249
Conversation
26b47e2
to
5d2a7f0
Compare
cdf2abe
to
7665568
Compare
78d67b5
to
cca3f97
Compare
cca3f97
to
637be3b
Compare
637be3b
to
d8b8196
Compare
68719cb
to
47f524a
Compare
10e7657
to
ebc323c
Compare
For now I've got an issue that not all requests started with |
Well, it seems that it is still not working: I've got TestGracefulShutdownRespectsClose dead stuck once and pool tests are stuck too. |
Seems like the issue was again an concurrent Unregister in connectionClose and shutdown. Started to Unregister in separate goroutine, this should solve the issue. |
ebc323c
to
c43e268
Compare
86037de
to
e4e7a4f
Compare
Added simple notify channel to track shutdown callback events if one wish to do so. |
There still seems to be some rare concurrency issues (with shutdown notify channel) |
7946786
to
8e8846a
Compare
I've re-checked one more time and we definitely cannot replace |
The last known bug related to
was caused by |
1d71195
to
aac4200
Compare
So it seems that everything we wanted to solve is solved now. |
55e2e30
to
fe07889
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but there are a couple of comments that need to be resolved.
fe07889
to
2f2d4a9
Compare
After this patch, "make test" behaves similar to "make test-*". Part of #214
Before this patch, calling StopTarantool wasn't idempotent because it accepts a struct copy and doesn't actually set Cmd to nil. Setting Cmd.Process to nil is effective since it's a pointer. Reworking helpers to use pointer would be better, but it would break existing API.
If connected to Tarantool 2.10 or newer, after this patch a connection supports server graceful shutdown [1]. In this case, server will wait until all client requests will be finished and client disconnects before going down (server also may go down by timeout). Client reconnect will happen if connection options enable reconnect. Beware that graceful shutdown event initialization is asynchronous. 1. https://www.tarantool.io/en/doc/latest/dev_guide/internals/iproto/graceful_shutdown/ Closes #214
2f2d4a9
to
4eb8ac8
Compare
I rebased the branch because I want to merge the pull request today. I also removed the code from connection.go: // future here does not belong to any shard yet,
// so cancelFuture don't call markDone.
conn.decrementRequestCnt() because a future actually belongs to a shard after successful |
If connected to Tarantool 2.10 or newer, after this patch a connection supports server graceful shutdown [1]. In this case, server will wait until all client requests will be finished and client disconnects before going down (server also may go down by timeout). Client reconnect will happen if connection options enable reconnect.
I didn't forget about (remove if it is not applicable):
Closes #214