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
Showing
- src/box/iproto.cc 1 addition, 60 deletionssrc/box/iproto.cc
- src/box/iproto_constants.h 0 additions, 11 deletionssrc/box/iproto_constants.h
- src/box/iproto_features.c 0 additions, 2 deletionssrc/box/iproto_features.c
- src/box/iproto_features.h 1 addition, 10 deletionssrc/box/iproto_features.h
- src/box/lua/net_box.c 2 additions, 31 deletionssrc/box/lua/net_box.c
- src/box/lua/net_box.lua 12 additions, 7 deletionssrc/box/lua/net_box.lua
- src/box/session.cc 58 additions, 0 deletionssrc/box/session.cc
- src/box/session.h 2 additions, 0 deletionssrc/box/session.h
- src/box/watcher.c 19 additions, 0 deletionssrc/box/watcher.c
- src/box/watcher.h 8 additions, 0 deletionssrc/box/watcher.h
- src/box/xrow.c 0 additions, 31 deletionssrc/box/xrow.c
- src/box/xrow.h 0 additions, 7 deletionssrc/box/xrow.h
- src/lib/core/errinj.h 0 additions, 2 deletionssrc/lib/core/errinj.h
- src/main.cc 2 additions, 0 deletionssrc/main.cc
- test/box-luatest/graceful_shutdown_errinj_test.lua 0 additions, 156 deletionstest/box-luatest/graceful_shutdown_errinj_test.lua
- test/box-luatest/graceful_shutdown_test.lua 47 additions, 19 deletionstest/box-luatest/graceful_shutdown_test.lua
- test/box-luatest/suite.ini 1 addition, 1 deletiontest/box-luatest/suite.ini
- test/box-py/iproto.result 2 additions, 2 deletionstest/box-py/iproto.result
- test/box/errinj.result 0 additions, 2 deletionstest/box/errinj.result
- test/box/net.box_iproto_id.result 3 additions, 8 deletionstest/box/net.box_iproto_id.result
Loading
Please register or sign in to comment