mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-24 18:40:38 +00:00
Today, test/*/run always kills Scylla at the end of the test with SIGKILL (kill -9), so the Scylla shutdown code doesn't run. It was believed that a clean shutdown would take a long time, but in fact, it turns out that 99% of the shutdown time was a silly sleep in the gossip code, which this patch disables with the "--shutdown-announce-in-ms" option. After enabling this option, clean shutdown takes (in a dev build on my laptop) just 0.02 seconds. It's worth noting that this shutdown has no real work to do - no tables to flush, and so on, because the pytest framework removes all the tables in its own fixture cleanup phase. So in this patch, to kill Scylla we use SIGTERM (15) instead of SIGKILL. We then wait until a timeout of 10 seconds (much much more than 0.02 seconds!) for Scylla to exit. If for some reason it didn't exit (e.g., it hung during the shutdown), it is killed again with SIGKILL, which is guaranteed to succed. This change gives us two advantages 1. Every test run with test/*/run exercises the shutdown path. It is perhaps excessive, but since the shutdown is so quick, there is no big downside. 2. In a test-coverage run, a clean shutdown allows flushing the counter files, which wasn't possible when Scylla was killed with KILL -9. Fixes #8543 Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #14825