diff options
author | Michael Widenius <monty@askmonty.org> | 2011-11-24 18:48:58 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-11-24 18:48:58 +0200 |
commit | 69204571425ed3221e94c7eb1e030c00089bca26 (patch) | |
tree | 3d9cfbc44a057883c7db6bce267c8ebfd5fa9313 /tests/mysql_client_test.c | |
parent | e3e60a4102d6918e4231e402bef89b1a6b2a20cb (diff) | |
parent | d26aefb0775048128495eaab151ee4118f8f7afd (diff) | |
download | mariadb-git-69204571425ed3221e94c7eb1e030c00089bca26.tar.gz |
Merge with MariaDB 5.1
Diffstat (limited to 'tests/mysql_client_test.c')
-rw-r--r-- | tests/mysql_client_test.c | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index c6efdca60f6..6c1b638ce81 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. +/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. + Copyright (c) 2008-2011 Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18558,6 +18559,85 @@ static void test_bug56976() DBUG_VOID_RETURN; } +/* + Bug#13001491: MYSQL_REFRESH CRASHES WHEN STORED ROUTINES ARE RUN CONCURRENTLY. +*/ +static void test_bug13001491() +{ + int rc; + char query[MAX_TEST_QUERY_LENGTH]; + MYSQL *c; + + myheader("test_bug13001491"); + + my_snprintf(query, MAX_TEST_QUERY_LENGTH, + "GRANT ALL PRIVILEGES ON *.* TO mysqltest_u1@%s", + opt_host ? opt_host : "'localhost'"); + + rc= mysql_query(mysql, query); + myquery(rc); + + my_snprintf(query, MAX_TEST_QUERY_LENGTH, + "GRANT RELOAD ON *.* TO mysqltest_u1@%s", + opt_host ? opt_host : "'localhost'"); + + rc= mysql_query(mysql, query); + myquery(rc); + + c= mysql_client_init(NULL); + + DIE_UNLESS(mysql_real_connect(c, opt_host, "mysqltest_u1", NULL, + current_db, opt_port, opt_unix_socket, + CLIENT_MULTI_STATEMENTS | + CLIENT_MULTI_RESULTS)); + + rc= mysql_query(c, "DROP PROCEDURE IF EXISTS p1"); + myquery(rc); + + rc= mysql_query(c, + "CREATE PROCEDURE p1() " + "BEGIN " + " DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; " + " SELECT COUNT(*) " + " FROM INFORMATION_SCHEMA.PROCESSLIST " + " GROUP BY user " + " ORDER BY NULL " + " INTO @a; " + "END"); + myquery(rc); + + rc= mysql_query(c, "CALL p1()"); + myquery(rc); + + mysql_free_result(mysql_store_result(c)); + + /* Check that mysql_refresh() succeeds without REFRESH_LOG. */ + rc= mysql_refresh(c, REFRESH_GRANT | + REFRESH_TABLES | REFRESH_HOSTS | + REFRESH_STATUS | REFRESH_THREADS); + myquery(rc); + + /* + Check that mysql_refresh(REFRESH_LOG) does not crash the server even if it + fails. mysql_refresh(REFRESH_LOG) fails when error log points to unavailable + location. + */ + mysql_refresh(c, REFRESH_LOG); + + rc= mysql_query(c, "DROP PROCEDURE p1"); + myquery(rc); + + mysql_close(c); + c= NULL; + + my_snprintf(query, MAX_TEST_QUERY_LENGTH, + "DROP USER mysqltest_u1@%s", + opt_host ? opt_host : "'localhost'"); + + rc= mysql_query(mysql, query); + myquery(rc); +} + /* Read and parse arguments and MySQL options from my.cnf @@ -18886,6 +18966,7 @@ static struct my_tests_st my_tests[]= { { "test_bug47485", test_bug47485 }, { "test_bug58036", test_bug58036 }, { "test_bug56976", test_bug56976 }, + { "test_bug13001491", test_bug13001491 }, { 0, 0 } }; |