Esempio n. 1
0
def bug1258464killer(default_file):
    """
    bug1258464killer checks status of a local Galera node
    and if a) There are stuck COMMIT queries and b) There is an ALTER TABLE
    it will kill the node. This command workarounds a known bug
    https://bugs.launchpad.net/percona-xtradb-cluster/+bug/1258464
    """
    if default_file:
        if os.path.isfile(default_file):
            bug1258464(default_file)
        else:
            LOG.error('File not found : %s', default_file)
    else:
        bug1258464('/root/.my.cnf')
Esempio n. 2
0
def test__bug1258464_when_raise_OperationalError(mocker):
    mock_pymysql = mocker.patch('proxysql_tools.util.bug1258464.pymysql')
    mock_cursor = mock.MagicMock()
    mock_cursor.fetchone.return_value = [100]
    mock_pymysql.connect.return_value.cursor.return_value.__enter__.return_value = mock_cursor
    mock_pymysql.connect.side_effect = OperationalError
    assert not bug1258464('some path')
Esempio n. 3
0
def test__bug1258464_when_raise_NotImplementedError(mocker):
    mock_pymysql = mocker.patch('proxysql_tools.util.bug1258464.pymysql')
    mock_cursor = mock.MagicMock()
    mock_cursor.fetchone.return_value = [100]
    mock_pymysql.connect.return_value.cursor.return_value.__enter__.return_value = mock_cursor
    mock_get_my_cnf = mocker.patch('proxysql_tools.util.bug1258464.get_my_cnf')
    mock_get_my_cnf.return_value = 'some path'
    mock_get_my_cnf.side_effect = NotImplementedError
    assert not bug1258464('some path')
Esempio n. 4
0
def test__bug1258464_when_condition_for_kill_is_false(mocker):
    mock_pymysql = mocker.patch('proxysql_tools.util.bug1258464.pymysql')
    mock_cursor = mock.MagicMock()
    mock_cursor.fetchone.return_value = [100]
    mock_pymysql.connect.return_value.cursor.return_value.__enter__.return_value = mock_cursor
    mock_get_my_cnf = mocker.patch('proxysql_tools.util.bug1258464.get_my_cnf')
    mock_get_my_cnf.return_value = 'some path'
    mock_get_pid = mocker.patch('proxysql_tools.util.bug1258464.get_pid')
    mock_get_pid.return_value = 300
    mock_kill_process = mocker.patch(
        'proxysql_tools.util.bug1258464.kill_process')
    assert not bug1258464('some path')