From 22b2067aa5cce55ea4652cb915f5ba99d9caa4a6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Feb 2004 21:35:20 +0400 Subject: [PATCH 1/2] added checking for bootstrap in select_send::send_data (fixed bug #2526 "--init-file crashes MySQL if contains large select") Such checking usually works in send_ok, send_eof, but in this case large result causes interim flushing. sql/sql_class.cc: added checking for bootstrap in select_send::send_data --- mysql-test/t/init_file-master.opt | 1 + mysql-test/t/init_file.sql | 1 + mysql-test/t/init_file.test | 12 ++++++++++++ sql/sql_class.cc | 2 ++ 4 files changed, 16 insertions(+) create mode 100644 mysql-test/t/init_file-master.opt create mode 100644 mysql-test/t/init_file.sql create mode 100644 mysql-test/t/init_file.test diff --git a/mysql-test/t/init_file-master.opt b/mysql-test/t/init_file-master.opt new file mode 100644 index 00000000000..1542f1f034e --- /dev/null +++ b/mysql-test/t/init_file-master.opt @@ -0,0 +1 @@ +--init-file=$MYSQL_TEST_DIR/t/init_file.sql \ No newline at end of file diff --git a/mysql-test/t/init_file.sql b/mysql-test/t/init_file.sql new file mode 100644 index 00000000000..4236ada1142 --- /dev/null +++ b/mysql-test/t/init_file.sql @@ -0,0 +1 @@ +select * from mysql.user as t1, mysql.user as t2, mysql.user as t3, mysql.user as t4, mysql.user as t5, mysql.user as t6, mysql.user as t7, mysql.user as t8; \ No newline at end of file diff --git a/mysql-test/t/init_file.test b/mysql-test/t/init_file.test new file mode 100644 index 00000000000..8cfb8c490e2 --- /dev/null +++ b/mysql-test/t/init_file.test @@ -0,0 +1,12 @@ +# +# This test is first part of test init_file_part2.test (bug #2526) +# + +#DROP TABLE IF EXISTS t1; + +#CREATE TABLE t1 +#( +# i int(11) default NULL +#) TYPE=MyISAM; + +#INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); \ No newline at end of file diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 3ea61da28fc..fac99be47a8 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -495,6 +495,8 @@ bool select_send::send_data(List &items) } } thd->sent_row_count++; + if (thd->bootstrap) + DBUG_RETURN(0); bool error=my_net_write(&thd->net,(char*) packet->ptr(),packet->length()); DBUG_RETURN(error); } From b911f9b0c0783e07f6bc9f091c9b5855730d88ba Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Feb 2004 17:52:41 +0400 Subject: [PATCH 2/2] code cleanup --- mysql-test/t/init_file.test | 12 ++---------- sql/sql_class.cc | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/mysql-test/t/init_file.test b/mysql-test/t/init_file.test index 8cfb8c490e2..eb4c24871db 100644 --- a/mysql-test/t/init_file.test +++ b/mysql-test/t/init_file.test @@ -1,12 +1,4 @@ # -# This test is first part of test init_file_part2.test (bug #2526) +# This test is for bug #2526 "--init-file crashes MySQL if contains large select" +# Have a look at code in init_file.sql # - -#DROP TABLE IF EXISTS t1; - -#CREATE TABLE t1 -#( -# i int(11) default NULL -#) TYPE=MyISAM; - -#INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); \ No newline at end of file diff --git a/sql/sql_class.cc b/sql/sql_class.cc index fac99be47a8..c45167e82da 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -495,7 +495,7 @@ bool select_send::send_data(List &items) } } thd->sent_row_count++; - if (thd->bootstrap) + if (!thd->net.vio) DBUG_RETURN(0); bool error=my_net_write(&thd->net,(char*) packet->ptr(),packet->length()); DBUG_RETURN(error);