diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-12-04 00:50:29 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-12-04 01:01:34 +0000 |
commit | eeb22d5e0fbbdbb51a7e1e77916ec0d27e944ac7 (patch) | |
tree | 64cf43ef7373363dd1e7ad6e82ba54404561fa67 | |
parent | 58facb8c5ea550c6c9abff0d4628a6a471761739 (diff) | |
download | cmogstored-eeb22d5e0fbbdbb51a7e1e77916ec0d27e944ac7.tar.gz |
cmogstored always does graceful shutdown, but this improves compatibility with Perlbal mogstored.
-rw-r--r-- | mgmt_parser.rl | 5 | ||||
-rw-r--r-- | test/graceful_quit.rb | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/mgmt_parser.rl b/mgmt_parser.rl index a14fac7..98e46b9 100644 --- a/mgmt_parser.rl +++ b/mgmt_parser.rl @@ -52,7 +52,10 @@ @ { mog_mgmt_fn_aio_threads(mgmt, buf); fbreak; } ); blank = [ \t]* eor @ { mog_mgmt_fn_blank(mgmt); fbreak; }; - shutdown = ("shutdown" eor @ { cmogstored_quit(); fbreak; }); + shutdown = "shutdown" (" "+"graceful")? eor @ { + cmogstored_quit(); + fbreak; + }; command = (digest|size|watch|aio_threads|shutdown|blank); main := command $! { diff --git a/test/graceful_quit.rb b/test/graceful_quit.rb index 30cf399..9a54ace 100644 --- a/test/graceful_quit.rb +++ b/test/graceful_quit.rb @@ -267,4 +267,13 @@ class TestGracefulQuit < Test::Unit::TestCase _, status = Process.waitpid2(@pid) assert status.success?, status.inspect end + + # for compatibility with mogstored, cmogstored shutdown is always graceful + def test_mgmt_shutdown_graceful + client = get_client(666, @mgmt) + client.write("shutdown graceful\r\n") + assert_nil client.gets + _, status = Process.waitpid2(@pid) + assert status.success?, status.inspect + end end |