From 44135d4725dd3ad6d331c60b0bab1618472b8ae4 Mon Sep 17 00:00:00 2001 From: Kent Boortz Date: Thu, 30 Jun 2011 17:31:31 +0200 Subject: Updated/added copyright headers --- tests/bug25714.c | 5 +++-- tests/grant.pl | 5 +++-- tests/mysql_client_test.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/bug25714.c b/tests/bug25714.c index b9c0708f352..e65cf3b807f 100644 --- a/tests/bug25714.c +++ b/tests/bug25714.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2007 MySQL AB +/* Copyright (c) 2007 MySQL AB, 2009 Sun Microsystems, Inc. + Use is subject to license terms. 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 @@ -11,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include diff --git a/tests/grant.pl b/tests/grant.pl index 368ce0b3254..23a7d2110fb 100755 --- a/tests/grant.pl +++ b/tests/grant.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl -# Copyright (C) 2000, 2005 MySQL AB, 2009 Sun Microsystems, Inc. +# Copyright (c) 2000, 2005 MySQL AB, 2009 Sun Microsystems, Inc. +# Use is subject to license terms. # # 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 @@ -13,7 +14,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Testing of grants. diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 82199781d74..218cb5a8f41 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /*************************************************************************** This is a test sample to test the new features in MySQL client-server -- cgit v1.2.1 From 1922d65fd8881836b57ac925596dac4cb753e29b Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Thu, 22 Sep 2011 18:31:16 +0400 Subject: Fix for Bug#13001491: MYSQL_REFRESH CRASHES WHEN STORED ROUTINES ARE RUN CONCURRENTLY. The main problem was that lex_start() was forgotten to be called before processing COM_REFRESH. Another problem discovered was that if failures to flush the error log were not properly handled, which resulted in the server crash. The user-visible effect of these problems were: - if COM_REFRESH command was sent after SQL-queries of some sort, the server would crash. - if COM_REFRESH was requested with REFRESH_LOG only, and the error log failed to flush, the server would crash. The error log fails to flush when it points to unavailable file (for example, due to restricted permissions). The fixes are: - call lex_start() in the beginning of COM_REFRESH; - handle failures to flush the error log properly, i.e. raise ER_UNKNOWN_ERROR. sql/sql_parse.cc: Fix for Bug#13001491: MYSQL_REFRESH CRASHES WHEN STORED ROUTINES ARE RUN CONCURRENTLY. tests/mysql_client_test.c: A test case for Bug#13001491: MYSQL_REFRESH CRASHES WHEN STORED ROUTINES ARE RUN CONCURRENTLY. --- tests/mysql_client_test.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'tests') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 5880e734d32..2472a0b6df6 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -18513,6 +18513,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"); + + 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); + + 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; + + 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 @@ -18842,6 +18921,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 } }; -- cgit v1.2.1 From ca881510f21b9b0787079ec478d563cf52d38264 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Thu, 20 Oct 2011 18:06:41 +0400 Subject: Fix Windows-build failure: use my_snprintf() instead of snprintf(). --- tests/mysql_client_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 2472a0b6df6..f553eb530ae 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -18524,14 +18524,14 @@ static void test_bug13001491() myheader("test_bug13001491"); - snprintf(query, MAX_TEST_QUERY_LENGTH, + 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); - snprintf(query, MAX_TEST_QUERY_LENGTH, + my_snprintf(query, MAX_TEST_QUERY_LENGTH, "GRANT RELOAD ON *.* TO mysqltest_u1@%s", opt_host ? opt_host : "'localhost'"); @@ -18584,7 +18584,7 @@ static void test_bug13001491() mysql_close(c); c= NULL; - snprintf(query, MAX_TEST_QUERY_LENGTH, + my_snprintf(query, MAX_TEST_QUERY_LENGTH, "DROP USER mysqltest_u1@%s", opt_host ? opt_host : "'localhost'"); -- cgit v1.2.1