Skip to content
Snippets Groups Projects
Commit 2e9cbec3 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Kirill Yukhin
Browse files

Rework graceful shutdown using IPROTO_EVENT

This patch drops IPROTO_SHUTDOWN and IPROTO_FEATURE_GRACEFUL_SHUTDOWN
(the feature hasn't been officially released yet so it's okay). Instead,
the server now generates IPROTO_EVENT{key='box.shutdown', value=true}
before running on_shutdown triggers. The on_shutdown trigger installed
by IPROTO has been greatly simplified - now it just stops listening for
new connections. A new on_shutdown trigger is installed by the session
infrastructure code - the trigger waits for all sessions that subscribed
to 'box.shutdown' event to close. Net.box uses conn:watch to subscribe
internally to the new event. As before, it runs user-defined on_shutdown
triggers and then waits for active requests to finish before closing the
connection.

Notes about the tests:
 1. We don't need graceful_shutdown_errinj test, because
    a. The feature can be disabled in net.box without errinj by adding
       internal _disable_graceful_shutdown connection option.
    b. Since there's no new packet type, we don't need to check that
       IPROTO_ID/AUTH handle it correctly in net.box.
 2. The graceful_shutdown.test_shutdown_aborted_on_reconnect_2 changed:
    since triggers use the watcher infrstructure, the same trigger can't
    run in parallel with itself.

The main benefit of reusing IPROTO_EVENT instead of introducing a new
request type is that connections will have to do less work to support
the feature (to some extent, it'd be supported even if the connector
doesn't do any work and just lets the user subscribe to events).

Suggested-by @unera
Follow-up a33f3cc7
("net.box: support graceful shutdown protocol")
Follow-up 6f29f9d7
("iproto: introduce graceful shutdown protocol")

Follow-up #5924

NO_CHANGELOG=already added
NO_DOC=already added, will be updated manually
parent 2f5099a8
No related branches found
No related tags found
No related merge requests found
Showing
with 158 additions and 349 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment