~jan-kneschke/mysql-proxy/packet-tracking-assertions

« back to all changes in this revision

Viewing changes to tests/suite/base/t/failover-mock.lua

  • Committer: jan at mysql
  • Date: 2010-09-03 10:38:30 UTC
  • Revision ID: jan@mysql.com-20100903103830-b7cxzn1i49ma9y3o
stabilize the failover test

  * use kill(..., SIGKILL) to kill the backend right away instead of using _set_shutdown()
  * renamed COMMIT SUICIDE to KILL BACKEND
  * let the KILL BACKEND fail with 'connection went away ...' as the synchronization point 

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
-- test if failover works
22
22
--
23
23
-- * this script is started twice to simulate two backends
 
24
-- * one is shutdown in the test with KILL BACKEND
24
25
--
25
26
 
26
27
require("chassis") -- 
 
28
require("posix") -- 
27
29
local proto = require("mysql.proto")
28
30
 
29
31
function connect_server()
77
78
                                rows = { { proxy.global.backend_id } }
78
79
                        }
79
80
                }
80
 
        elseif query == 'COMMIT SUICIDE' then
 
81
        elseif query == 'KILL BACKEND' then
81
82
                -- stop the proxy if we are asked to
82
 
                chassis.set_shutdown()
 
83
                posix.kill(posix.getpid(), 9) -- send SIGKILL to ourself
 
84
 
 
85
                -- this won't be sent as we are already dead ... let's hope
83
86
                proxy.response = {
84
87
                        type = proxy.MYSQLD_PACKET_OK,
85
88
                        affected_rows = 0,