mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-02 04:56:58 +00:00
We register engine().at_exit() callbacks when we initialize the services. We do not really call the callbacks at the moment due to #293. It is pretty hard to see the whole picture in which order the services are shutdown. Instead of for each services to register a at_exit() callbacks, I proposal to have a single at_exit() callback which do the shutdown for all the services. In cassandra, the shutdown work is done in storage_service::drain_on_shutdown callbacks. In this patch, the drain_on_shutdown is executed during shutdown. As a result, the proper gossip shutdown is executed and fixes #790. With this patch, when Ctrl-C on a node, it looks like: INFO [shard 0] storage_service - Drain on shutdown: starts INFO [shard 0] gossip - Announcing shutdown INFO [shard 0] storage_service - Node 127.0.0.1 state jump to normal INFO [shard 0] storage_service - Drain on shutdown: stop_gossiping done INFO [shard 0] storage_service - CQL server stopped INFO [shard 0] storage_service - Drain on shutdown: shutdown rpc and cql server done INFO [shard 0] storage_service - Drain on shutdown: shutdown messaging_service done INFO [shard 0] storage_service - Drain on shutdown: flush column_families done INFO [shard 0] storage_service - Drain on shutdown: shutdown commitlog done INFO [shard 0] storage_service - Drain on shutdown: done