#At file:///home/malff/BZR_TREE/mysql-next-mr-stage2/ based on revid:marc.alff@stripped
3170 Marc Alff 2010-07-26 [merge]
WL#5291 MySQL Install / Upgrade script format
Merge mysql-next-mr-wl5291 into mysql-next-mr-stage
removed:
mysql-test/suite/perfschema/r/pfs_upgrade.result
mysql-test/suite/perfschema/t/pfs_upgrade.test
added:
mysql-test/suite/perfschema/include/pfs_upgrade.inc
mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result
mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result
mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result
mysql-test/suite/perfschema/t/pfs_upgrade_lc0.test
mysql-test/suite/perfschema/t/pfs_upgrade_lc1.test
mysql-test/suite/perfschema/t/pfs_upgrade_lc2.test
sql/sql_bootstrap.cc
sql/sql_bootstrap.h
modified:
.bzr-mysql/default.conf
.bzrignore
client/mysql_upgrade.c
libmysqld/CMakeLists.txt
libmysqld/Makefile.am
mysql-test/mysql-test-run.pl
scripts/Makefile.am
scripts/comp_sql.c
scripts/mysql_system_tables.sql
sql/CMakeLists.txt
sql/Makefile.am
sql/sql_parse.cc
=== modified file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf 2010-07-24 10:24:17 +0000
+++ b/.bzr-mysql/default.conf 2010-07-26 18:12:38 +0000
@@ -1,4 +1,4 @@
[MYSQL]
post_commit_to = "commits@stripped"
post_push_to = "commits@stripped"
-tree_name = "mysql-next-mr"
+tree_name = "mysql-next-mr-wl5291"
=== modified file '.bzrignore'
--- a/.bzrignore 2010-06-23 11:01:12 +0000
+++ b/.bzrignore 2010-06-30 23:15:47 +0000
@@ -3114,3 +3114,4 @@ libmysqld/merge_archives_mysqlserver.cma
libmysqld/mysqlserver_depends.c
libmysqld/examples/mysql_embedded
sql/.empty
+libmysqld/sql_bootstrap.cc
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c 2010-07-15 11:13:30 +0000
+++ b/client/mysql_upgrade.c 2010-07-23 17:20:00 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
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
@@ -10,8 +10,8 @@
GNU General Public License for more details.
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#include "client_priv.h"
#include <sslopt-vars.h>
@@ -753,17 +753,35 @@ static void print_line(char* line)
static int run_sql_fix_privilege_tables(void)
{
int found_real_errors= 0;
+ const char **query_ptr;
+ DYNAMIC_STRING ds_script;
DYNAMIC_STRING ds_result;
DBUG_ENTER("run_sql_fix_privilege_tables");
+ if (init_dynamic_string(&ds_script, "", 65536, 1024))
+ die("Out of memory");
+
if (init_dynamic_string(&ds_result, "", 512, 512))
die("Out of memory");
verbose("Running 'mysql_fix_privilege_tables'...");
- run_query(mysql_fix_privilege_tables,
+
+ /*
+ Individual queries can not be executed independently by invoking
+ a forked mysql client, because the script uses session variables
+ and prepared statements.
+ */
+ for ( query_ptr= &mysql_fix_privilege_tables[0];
+ *query_ptr != NULL;
+ query_ptr++
+ )
+ {
+ dynstr_append(&ds_script, *query_ptr);
+ }
+
+ run_query(ds_script.str,
&ds_result, /* Collect result */
TRUE);
-
{
/*
Scan each line of the result for real errors
@@ -788,6 +806,7 @@ static int run_sql_fix_privilege_tables(
}
dynstr_free(&ds_result);
+ dynstr_free(&ds_script);
return found_real_errors;
}
=== modified file 'libmysqld/CMakeLists.txt'
--- a/libmysqld/CMakeLists.txt 2010-07-18 13:23:58 +0000
+++ b/libmysqld/CMakeLists.txt 2010-07-23 17:20:00 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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
@@ -86,7 +86,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc l
../sql/rpl_utility.cc ../sql/binlog.cc
../sql/sys_vars.cc
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
- ../sql/mdl.cc ../sql/transaction.cc
+ ../sql/mdl.cc ../sql/transaction.cc ../sql/sql_bootstrap.cc
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am 2010-07-16 21:00:50 +0000
+++ b/libmysqld/Makefile.am 2010-07-23 17:20:00 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2006 MySQL AB
+# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -81,6 +81,7 @@ sqlsources = derror.cc field.cc field_co
debug_sync.cc sql_tablespace.cc transaction.cc \
rpl_injector.cc my_user.c partition_info.cc \
sql_servers.cc event_parse_data.cc sql_signal.cc \
+ sql_bootstrap.cc \
binlog.cc rpl_handler.cc mdl.cc keycaches.cc sql_audit.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources)
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2010-07-20 08:10:38 +0000
+++ b/mysql-test/mysql-test-run.pl 2010-07-23 17:20:00 +0000
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# -*- cperl -*-
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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,8 +13,8 @@
# GNU General Public License for more details.
#
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
#
##############################################################################
@@ -2890,7 +2890,7 @@ sub mysql_install_db {
{
my $sql_dir= dirname($path_sql);
# Use the mysql database for system tables
- mtr_tofile($bootstrap_sql_file, "use mysql\n");
+ mtr_tofile($bootstrap_sql_file, "use mysql;\n");
# Add the offical mysql system tables
# for a production system
=== added file 'mysql-test/suite/perfschema/include/pfs_upgrade.inc'
--- a/mysql-test/suite/perfschema/include/pfs_upgrade.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/pfs_upgrade.inc 2010-06-30 14:05:18 +0000
@@ -0,0 +1,134 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
+# database.
+#
+
+--disable_warnings
+drop table if exists test.user_table;
+drop procedure if exists test.user_proc;
+drop function if exists test.user_func;
+drop event if exists test.user_event;
+--enable_warnings
+
+--echo "Testing mysql_upgrade with TABLE performance_schema.user_table"
+
+create table test.user_table(a int);
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+--copy_file $MYSQLD_DATADIR/test/user_table.frm $MYSQLD_DATADIR/performance_schema/user_table.frm
+
+# Make sure the table is visible
+use performance_schema;
+show tables like "user_table";
+
+--error 1
+--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+# Verify that mysql_upgrade complained about the performance_schema
+--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+# Make sure the table is still visible
+show tables like "user_table";
+
+use test;
+
+--remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm
+drop table test.user_table;
+
+--echo "Testing mysql_upgrade with VIEW performance_schema.user_view"
+
+create view test.user_view as select "Not supposed to be here";
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+--copy_file $MYSQLD_DATADIR/test/user_view.frm $MYSQLD_DATADIR/performance_schema/user_view.frm
+
+# Make sure the view is visible
+use performance_schema;
+show tables like "user_view";
+
+--error 1
+--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+# Verify that mysql_upgrade complained about the performance_schema
+--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+# Make sure the view is still visible
+show tables like "user_view";
+
+use test;
+
+--remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm
+drop view test.user_view;
+
+--echo "Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
+
+create procedure test.user_proc()
+ select "Not supposed to be here";
+
+update mysql.proc set db='performance_schema' where name='user_proc';
+
+--error 1
+--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+# Verify that mysql_upgrade complained about the performance_schema
+--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+select name from mysql.proc where db='performance_schema';
+
+update mysql.proc set db='test' where name='user_proc';
+drop procedure test.user_proc;
+
+--echo "Testing mysql_upgrade with FUNCTION performance_schema.user_func"
+
+create function test.user_func() returns integer
+ return 0;
+
+update mysql.proc set db='performance_schema' where name='user_func';
+
+--error 1
+--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+# Verify that mysql_upgrade complained about the performance_schema
+--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+select name from mysql.proc where db='performance_schema';
+
+update mysql.proc set db='test' where name='user_func';
+drop function test.user_func;
+
+--echo "Testing mysql_upgrade with EVENT performance_schema.user_event"
+
+create event test.user_event on schedule every 1 day do
+ select "not supposed to be here";
+
+update mysql.event set db='performance_schema' where name='user_event';
+
+--error 1
+--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+# Verify that mysql_upgrade complained about the performance_schema
+--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
+select name from mysql.event where db='performance_schema';
+
+update mysql.event set db='test' where name='user_event';
+drop event test.user_event;
+
+--remove_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out
+--remove_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
+
=== removed file 'mysql-test/suite/perfschema/r/pfs_upgrade.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result 2010-07-15 21:57:47 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result 1970-01-01 00:00:00 +0000
@@ -1,153 +0,0 @@
-drop table if exists test.user_table;
-drop procedure if exists test.user_proc;
-drop function if exists test.user_func;
-drop event if exists test.user_event;
-"Testing mysql_upgrade with TABLE performance_schema.user_table"
-create table test.user_table(a int);
-use performance_schema;
-show tables like "user_table";
-Tables_in_performance_schema (user_table)
-user_table
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-show tables like "user_table";
-Tables_in_performance_schema (user_table)
-user_table
-use test;
-drop table test.user_table;
-"Testing mysql_upgrade with VIEW performance_schema.user_view"
-create view test.user_view as select "Not supposed to be here";
-use performance_schema;
-show tables like "user_view";
-Tables_in_performance_schema (user_view)
-user_view
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-show tables like "user_view";
-Tables_in_performance_schema (user_view)
-user_view
-use test;
-drop view test.user_view;
-"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
-create procedure test.user_proc()
-select "Not supposed to be here";
-update mysql.proc set db='performance_schema' where name='user_proc';
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.proc where db='performance_schema';
-name
-user_proc
-update mysql.proc set db='test' where name='user_proc';
-drop procedure test.user_proc;
-"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
-create function test.user_func() returns integer
-return 0;
-update mysql.proc set db='performance_schema' where name='user_func';
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.proc where db='performance_schema';
-name
-user_func
-update mysql.proc set db='test' where name='user_func';
-drop function test.user_func;
-"Testing mysql_upgrade with EVENT performance_schema.user_event"
-create event test.user_event on schedule every 1 day do
-select "not supposed to be here";
-update mysql.event set db='performance_schema' where name='user_event';
-ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
-ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
-ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
-ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
-ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
-ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.event where db='performance_schema';
-name
-user_event
-update mysql.event set db='test' where name='user_event';
-drop event test.user_event;
=== added file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result 2010-07-23 17:20:00 +0000
@@ -0,0 +1,153 @@
+drop table if exists test.user_table;
+drop procedure if exists test.user_proc;
+drop function if exists test.user_func;
+drop event if exists test.user_event;
+"Testing mysql_upgrade with TABLE performance_schema.user_table"
+create table test.user_table(a int);
+use performance_schema;
+show tables like "user_table";
+Tables_in_performance_schema (user_table)
+user_table
+ERROR 1050 (42S01) at line 67: Table 'COND_INSTANCES' already exists
+ERROR 1050 (42S01) at line 89: Table 'EVENTS_WAITS_CURRENT' already exists
+ERROR 1050 (42S01) at line 111: Table 'EVENTS_WAITS_HISTORY' already exists
+ERROR 1050 (42S01) at line 133: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
+ERROR 1050 (42S01) at line 145: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 158: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 171: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 180: Table 'FILE_INSTANCES' already exists
+ERROR 1050 (42S01) at line 191: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 203: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
+ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
+ERROR 1050 (42S01) at line 231: Table 'PROCESSLIST' already exists
+ERROR 1050 (42S01) at line 241: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 249: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 261: Table 'SETUP_OBJECTS' already exists
+ERROR 1050 (42S01) at line 270: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 278: Table 'SETUP_TIMERS' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+show tables like "user_table";
+Tables_in_performance_schema (user_table)
+user_table
+use test;
+drop table test.user_table;
+"Testing mysql_upgrade with VIEW performance_schema.user_view"
+create view test.user_view as select "Not supposed to be here";
+use performance_schema;
+show tables like "user_view";
+Tables_in_performance_schema (user_view)
+user_view
+ERROR 1050 (42S01) at line 67: Table 'COND_INSTANCES' already exists
+ERROR 1050 (42S01) at line 89: Table 'EVENTS_WAITS_CURRENT' already exists
+ERROR 1050 (42S01) at line 111: Table 'EVENTS_WAITS_HISTORY' already exists
+ERROR 1050 (42S01) at line 133: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
+ERROR 1050 (42S01) at line 145: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 158: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 171: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 180: Table 'FILE_INSTANCES' already exists
+ERROR 1050 (42S01) at line 191: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 203: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
+ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
+ERROR 1050 (42S01) at line 231: Table 'PROCESSLIST' already exists
+ERROR 1050 (42S01) at line 241: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 249: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 261: Table 'SETUP_OBJECTS' already exists
+ERROR 1050 (42S01) at line 270: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 278: Table 'SETUP_TIMERS' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+show tables like "user_view";
+Tables_in_performance_schema (user_view)
+user_view
+use test;
+drop view test.user_view;
+"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
+create procedure test.user_proc()
+select "Not supposed to be here";
+update mysql.proc set db='performance_schema' where name='user_proc';
+ERROR 1050 (42S01) at line 67: Table 'COND_INSTANCES' already exists
+ERROR 1050 (42S01) at line 89: Table 'EVENTS_WAITS_CURRENT' already exists
+ERROR 1050 (42S01) at line 111: Table 'EVENTS_WAITS_HISTORY' already exists
+ERROR 1050 (42S01) at line 133: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
+ERROR 1050 (42S01) at line 145: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 158: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 171: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 180: Table 'FILE_INSTANCES' already exists
+ERROR 1050 (42S01) at line 191: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 203: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
+ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
+ERROR 1050 (42S01) at line 231: Table 'PROCESSLIST' already exists
+ERROR 1050 (42S01) at line 241: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 249: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 261: Table 'SETUP_OBJECTS' already exists
+ERROR 1050 (42S01) at line 270: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 278: Table 'SETUP_TIMERS' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.proc where db='performance_schema';
+name
+user_proc
+update mysql.proc set db='test' where name='user_proc';
+drop procedure test.user_proc;
+"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
+create function test.user_func() returns integer
+return 0;
+update mysql.proc set db='performance_schema' where name='user_func';
+ERROR 1050 (42S01) at line 67: Table 'COND_INSTANCES' already exists
+ERROR 1050 (42S01) at line 89: Table 'EVENTS_WAITS_CURRENT' already exists
+ERROR 1050 (42S01) at line 111: Table 'EVENTS_WAITS_HISTORY' already exists
+ERROR 1050 (42S01) at line 133: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
+ERROR 1050 (42S01) at line 145: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 158: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 171: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 180: Table 'FILE_INSTANCES' already exists
+ERROR 1050 (42S01) at line 191: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 203: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
+ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
+ERROR 1050 (42S01) at line 231: Table 'PROCESSLIST' already exists
+ERROR 1050 (42S01) at line 241: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 249: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 261: Table 'SETUP_OBJECTS' already exists
+ERROR 1050 (42S01) at line 270: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 278: Table 'SETUP_TIMERS' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.proc where db='performance_schema';
+name
+user_func
+update mysql.proc set db='test' where name='user_func';
+drop function test.user_func;
+"Testing mysql_upgrade with EVENT performance_schema.user_event"
+create event test.user_event on schedule every 1 day do
+select "not supposed to be here";
+update mysql.event set db='performance_schema' where name='user_event';
+ERROR 1050 (42S01) at line 67: Table 'COND_INSTANCES' already exists
+ERROR 1050 (42S01) at line 89: Table 'EVENTS_WAITS_CURRENT' already exists
+ERROR 1050 (42S01) at line 111: Table 'EVENTS_WAITS_HISTORY' already exists
+ERROR 1050 (42S01) at line 133: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
+ERROR 1050 (42S01) at line 145: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 158: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 171: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 180: Table 'FILE_INSTANCES' already exists
+ERROR 1050 (42S01) at line 191: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 203: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
+ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
+ERROR 1050 (42S01) at line 231: Table 'PROCESSLIST' already exists
+ERROR 1050 (42S01) at line 241: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 249: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 261: Table 'SETUP_OBJECTS' already exists
+ERROR 1050 (42S01) at line 270: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 278: Table 'SETUP_TIMERS' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.event where db='performance_schema';
+name
+user_event
+update mysql.event set db='test' where name='user_event';
+drop event test.user_event;
=== added file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result 2010-07-23 17:20:00 +0000
@@ -0,0 +1,153 @@
+drop table if exists test.user_table;
+drop procedure if exists test.user_proc;
+drop function if exists test.user_func;
+drop event if exists test.user_event;
+"Testing mysql_upgrade with TABLE performance_schema.user_table"
+create table test.user_table(a int);
+use performance_schema;
+show tables like "user_table";
+Tables_in_performance_schema (user_table)
+user_table
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+show tables like "user_table";
+Tables_in_performance_schema (user_table)
+user_table
+use test;
+drop table test.user_table;
+"Testing mysql_upgrade with VIEW performance_schema.user_view"
+create view test.user_view as select "Not supposed to be here";
+use performance_schema;
+show tables like "user_view";
+Tables_in_performance_schema (user_view)
+user_view
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+show tables like "user_view";
+Tables_in_performance_schema (user_view)
+user_view
+use test;
+drop view test.user_view;
+"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
+create procedure test.user_proc()
+select "Not supposed to be here";
+update mysql.proc set db='performance_schema' where name='user_proc';
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.proc where db='performance_schema';
+name
+user_proc
+update mysql.proc set db='test' where name='user_proc';
+drop procedure test.user_proc;
+"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
+create function test.user_func() returns integer
+return 0;
+update mysql.proc set db='performance_schema' where name='user_func';
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.proc where db='performance_schema';
+name
+user_func
+update mysql.proc set db='test' where name='user_func';
+drop function test.user_func;
+"Testing mysql_upgrade with EVENT performance_schema.user_event"
+create event test.user_event on schedule every 1 day do
+select "not supposed to be here";
+update mysql.event set db='performance_schema' where name='user_event';
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.event where db='performance_schema';
+name
+user_event
+update mysql.event set db='test' where name='user_event';
+drop event test.user_event;
=== added file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result 2010-07-23 17:20:00 +0000
@@ -0,0 +1,153 @@
+drop table if exists test.user_table;
+drop procedure if exists test.user_proc;
+drop function if exists test.user_func;
+drop event if exists test.user_event;
+"Testing mysql_upgrade with TABLE performance_schema.user_table"
+create table test.user_table(a int);
+use performance_schema;
+show tables like "user_table";
+Tables_in_performance_schema (user_table)
+user_table
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+show tables like "user_table";
+Tables_in_performance_schema (user_table)
+user_table
+use test;
+drop table test.user_table;
+"Testing mysql_upgrade with VIEW performance_schema.user_view"
+create view test.user_view as select "Not supposed to be here";
+use performance_schema;
+show tables like "user_view";
+Tables_in_performance_schema (user_view)
+user_view
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+show tables like "user_view";
+Tables_in_performance_schema (user_view)
+user_view
+use test;
+drop view test.user_view;
+"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
+create procedure test.user_proc()
+select "Not supposed to be here";
+update mysql.proc set db='performance_schema' where name='user_proc';
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.proc where db='performance_schema';
+name
+user_proc
+update mysql.proc set db='test' where name='user_proc';
+drop procedure test.user_proc;
+"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
+create function test.user_func() returns integer
+return 0;
+update mysql.proc set db='performance_schema' where name='user_func';
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.proc where db='performance_schema';
+name
+user_func
+update mysql.proc set db='test' where name='user_func';
+drop function test.user_func;
+"Testing mysql_upgrade with EVENT performance_schema.user_event"
+create event test.user_event on schedule every 1 day do
+select "not supposed to be here";
+update mysql.event set db='performance_schema' where name='user_event';
+ERROR 1050 (42S01) at line 67: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 89: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 111: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 133: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 145: Table 'events_waits_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 158: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 171: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 191: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 203: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 231: Table 'processlist' already exists
+ERROR 1050 (42S01) at line 241: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 249: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 261: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 270: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 278: Table 'setup_timers' already exists
+ERROR 1644 (HY000) at line 694: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.event where db='performance_schema';
+name
+user_event
+update mysql.event set db='test' where name='user_event';
+drop event test.user_event;
=== removed file 'mysql-test/suite/perfschema/t/pfs_upgrade.test'
--- a/mysql-test/suite/perfschema/t/pfs_upgrade.test 2010-06-03 13:30:54 +0000
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade.test 1970-01-01 00:00:00 +0000
@@ -1,138 +0,0 @@
-# Copyright (C) 2010 Oracle and/or its affiliates. All rights reserved.
-#
-# 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
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-
-# Tests for PERFORMANCE_SCHEMA
-# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
-# database.
-#
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
---source include/have_lowercase0.inc
-
---disable_warnings
-drop table if exists test.user_table;
-drop procedure if exists test.user_proc;
-drop function if exists test.user_func;
-drop event if exists test.user_event;
---enable_warnings
-
---echo "Testing mysql_upgrade with TABLE performance_schema.user_table"
-
-create table test.user_table(a int);
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
---copy_file $MYSQLD_DATADIR/test/user_table.frm $MYSQLD_DATADIR/performance_schema/user_table.frm
-
-# Make sure the table is visible
-use performance_schema;
-show tables like "user_table";
-
---error 1
---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-# Verify that mysql_upgrade complained about the performance_schema
---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-# Make sure the table is still visible
-show tables like "user_table";
-
-use test;
-
---remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm
-drop table test.user_table;
-
---echo "Testing mysql_upgrade with VIEW performance_schema.user_view"
-
-create view test.user_view as select "Not supposed to be here";
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
---copy_file $MYSQLD_DATADIR/test/user_view.frm $MYSQLD_DATADIR/performance_schema/user_view.frm
-
-# Make sure the view is visible
-use performance_schema;
-show tables like "user_view";
-
---error 1
---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-# Verify that mysql_upgrade complained about the performance_schema
---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-# Make sure the view is still visible
-show tables like "user_view";
-
-use test;
-
---remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm
-drop view test.user_view;
-
---echo "Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
-
-create procedure test.user_proc()
- select "Not supposed to be here";
-
-update mysql.proc set db='performance_schema' where name='user_proc';
-
---error 1
---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-# Verify that mysql_upgrade complained about the performance_schema
---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-select name from mysql.proc where db='performance_schema';
-
-update mysql.proc set db='test' where name='user_proc';
-drop procedure test.user_proc;
-
---echo "Testing mysql_upgrade with FUNCTION performance_schema.user_func"
-
-create function test.user_func() returns integer
- return 0;
-
-update mysql.proc set db='performance_schema' where name='user_func';
-
---error 1
---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-# Verify that mysql_upgrade complained about the performance_schema
---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-select name from mysql.proc where db='performance_schema';
-
-update mysql.proc set db='test' where name='user_func';
-drop function test.user_func;
-
---echo "Testing mysql_upgrade with EVENT performance_schema.user_event"
-
-create event test.user_event on schedule every 1 day do
- select "not supposed to be here";
-
-update mysql.event set db='performance_schema' where name='user_event';
-
---error 1
---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-# Verify that mysql_upgrade complained about the performance_schema
---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
-select name from mysql.event where db='performance_schema';
-
-update mysql.event set db='test' where name='user_event';
-drop event test.user_event;
-
---remove_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out
---remove_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
-
=== added file 'mysql-test/suite/perfschema/t/pfs_upgrade_lc0.test'
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_lc0.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_lc0.test 2010-06-30 14:05:18 +0000
@@ -0,0 +1,26 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
+# database.
+#
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/have_lowercase0.inc
+--source ../include/pfs_upgrade.inc
+
+
=== added file 'mysql-test/suite/perfschema/t/pfs_upgrade_lc1.test'
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_lc1.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_lc1.test 2010-06-30 14:05:18 +0000
@@ -0,0 +1,26 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
+# database.
+#
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/have_lowercase1.inc
+--source ../include/pfs_upgrade.inc
+
+
=== added file 'mysql-test/suite/perfschema/t/pfs_upgrade_lc2.test'
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_lc2.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_lc2.test 2010-06-30 14:05:18 +0000
@@ -0,0 +1,26 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
+# database.
+#
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/have_lowercase2.inc
+--source ../include/pfs_upgrade.inc
+
+
=== modified file 'scripts/Makefile.am'
--- a/scripts/Makefile.am 2010-05-20 12:41:01 +0000
+++ b/scripts/Makefile.am 2010-06-30 14:05:18 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2000-2006 MySQL AB
+# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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
@@ -10,8 +10,8 @@
# GNU General Public License for more details.
#
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
## Process this file with automake to create Makefile.in
@@ -111,14 +111,15 @@ mysql_fix_privilege_tables.sql: mysql_sy
@echo "Building $@";
@cat mysql_system_tables.sql mysql_system_tables_fix.sql > $@
+comp_sql_SOURCES= comp_sql.c
+
#
# Build mysql_fix_privilege_tables_sql.c from
# mysql_fix_privileges_tables.sql using comp_sql
# The "sleep" ensures the generated file has a younger timestamp than its source
# (which may have been generated in this very same "make" run).
#
-mysql_fix_privilege_tables_sql.c: comp_sql.c mysql_fix_privilege_tables.sql
- $(MAKE) $(AM_MAKEFLAGS) comp_sql$(EXEEXT)
+mysql_fix_privilege_tables_sql.c: comp_sql$(EXEEXT) mysql_fix_privilege_tables.sql
sleep 2
$(top_builddir)/scripts/comp_sql$(EXEEXT) \
mysql_fix_privilege_tables \
=== modified file 'scripts/comp_sql.c'
--- a/scripts/comp_sql.c 2007-04-23 12:01:48 +0000
+++ b/scripts/comp_sql.c 2010-06-30 14:05:18 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 MySQL AB
+/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
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
@@ -10,12 +10,8 @@
GNU General Public License for more details.
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 */
-
-/*
- Written by Magnus Svensson
-*/
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
/*
Converts a SQL file into a C file that can be compiled and linked
@@ -26,7 +22,20 @@
#include <stdlib.h>
#include <stdio.h>
-FILE *in, *out;
+#include "../sql/sql_bootstrap.h"
+
+/*
+ This is an internal tool used during the build process only,
+ - do not make a library just for this,
+ which would make the Makefiles and the server link
+ more complex than necessary,
+ - do not duplicate the code either.
+ so just add the sql_bootstrap.cc code as is.
+*/
+#include "../sql/sql_bootstrap.cc"
+
+FILE *in;
+FILE *out;
static void die(const char *fmt, ...)
{
@@ -54,13 +63,60 @@ static void die(const char *fmt, ...)
exit(1);
}
+char *fgets_fn(char *buffer, size_t size, fgets_input_t input)
+{
+ return fgets(buffer, size, (FILE*) input);
+}
+
+static void print_query(FILE *out, const char *query)
+{
+ const char *ptr= query;
+ int column= 0;
+
+ fprintf(out, "\"");
+ while (*ptr)
+ {
+ if (column >= 120)
+ {
+ /* Wrap to the next line, tabulated. */
+ fprintf(out, "\"\n \"");
+ column= 2;
+ }
+ switch(*ptr)
+ {
+ case '\n':
+ /*
+ Preserve the \n character in the query text,
+ and wrap to the next line, tabulated.
+ */
+ fprintf(out, "\\n\"\n \"");
+ column= 2;
+ break;
+ case '\r':
+ /* Skipped */
+ break;
+ case '\"':
+ fprintf(out, "\\\"");
+ column++;
+ break;
+ default:
+ putc(*ptr, out);
+ column++;
+ break;
+ }
+ ptr++;
+ }
+ fprintf(out, "\\n\",\n");
+}
int main(int argc, char *argv[])
{
- char buff[512];
+ char query[MAX_BOOTSTRAP_QUERY_SIZE];
char* struct_name= argv[1];
char* infile_name= argv[2];
char* outfile_name= argv[3];
+ int rc;
+ int query_length;
if (argc != 4)
die("Usage: comp_sql <struct_name> <sql_filename> <c_filename>");
@@ -71,55 +127,31 @@ int main(int argc, char *argv[])
if (!(out= fopen(outfile_name, "w")))
die("Failed to open output file '%s'", outfile_name);
- fprintf(out, "const char* %s={\n\"", struct_name);
+ fprintf(out, "/*\n");
+ fprintf(out, " Do not edit this file, it is automatically generated from:\n");
+ fprintf(out, " <%s>\n", infile_name);
+ fprintf(out, "*/\n");
+ fprintf(out, "const char* %s[]={\n", struct_name);
- while (fgets(buff, sizeof(buff), in))
+ for ( ; ; )
{
- char *curr= buff;
- while (*curr)
- {
- if (*curr == '\n')
- {
- /*
- Reached end of line, add escaped newline, escaped
- backslash and a newline to outfile
- */
- fprintf(out, "\\n \"\n\"");
- curr++;
- }
- else if (*curr == '\r')
- {
- curr++; /* Skip */
- }
- else
- {
- if (*curr == '"')
- {
- /* Needs escape */
- fputc('\\', out);
- }
-
- fputc(*curr, out);
- curr++;
- }
- }
- if (*(curr-1) != '\n')
- {
- /*
- Some compilers have a max string length,
- insert a newline at every 512th char in long
- strings
- */
- fprintf(out, "\"\n\"");
- }
+ rc= read_bootstrap_query(query, &query_length,
+ (fgets_input_t) in, fgets_fn);
+
+ if (rc == READ_BOOTSTRAP_ERROR)
+ die("Failed to read the bootstrap input file.\n");
+
+ if (rc == READ_BOOTSTRAP_EOF)
+ break;
+
+ print_query(out, query);
}
- fprintf(out, "\\\n\"};\n");
+ fprintf(out, "NULL\n};\n");
fclose(in);
fclose(out);
exit(0);
-
}
=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql 2010-04-14 16:40:04 +0000
+++ b/scripts/mysql_system_tables.sql 2010-06-30 14:05:18 +0000
@@ -1,4 +1,4 @@
--- Copyright (C) 2008, 2010 Oracle and/or its affiliates. All rights reserved.
+-- Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
--
-- 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
@@ -10,8 +10,8 @@
-- GNU General Public License for more details.
--
-- 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-- along with this program; if not, write to the Free Software Foundation,
+-- 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
--
-- The system tables of MySQL Server
@@ -113,9 +113,8 @@ CREATE TABLE IF NOT EXISTS ndb_binlog_in
set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema');
-SET @l1="SET @broken_tables = (select count(*) from information_schema.tables";
-SET @l2=" where engine != \'PERFORMANCE_SCHEMA\' and table_schema=\'performance_schema\')";
-SET @cmd=concat(@l1,@l2);
+SET @cmd="SET @broken_tables = (select count(*) from information_schema.tables"
+ " where engine != \'PERFORMANCE_SCHEMA\' and table_schema=\'performance_schema\')";
-- Work around for bug#49542
SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0');
@@ -123,9 +122,8 @@ PREPARE stmt FROM @str;
EXECUTE stmt;
DROP PREPARE stmt;
-SET @l1="SET @broken_views = (select count(*) from information_schema.views";
-SET @l2=" where table_schema='performance_schema')";
-SET @cmd=concat(@l1,@l2);
+SET @cmd="SET @broken_views = (select count(*) from information_schema.views"
+ " where table_schema='performance_schema')";
-- Work around for bug#49542
SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0');
@@ -171,12 +169,10 @@ set @have_pfs= (select count(engine) fro
-- TABLE COND_INSTANCES
--
-SET @l1="CREATE TABLE performance_schema.COND_INSTANCES(";
-SET @l2="NAME VARCHAR(128) not null,";
-SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null";
-SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4);
+SET @cmd="CREATE TABLE performance_schema.COND_INSTANCES("
+ "NAME VARCHAR(128) not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -187,26 +183,24 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_CURRENT
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_CURRENT(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="EVENT_ID BIGINT unsigned not null,";
-SET @l4="EVENT_NAME VARCHAR(128) not null,";
-SET @l5="SOURCE VARCHAR(64),";
-SET @l6="TIMER_START BIGINT unsigned,";
-SET @l7="TIMER_END BIGINT unsigned,";
-SET @l8="TIMER_WAIT BIGINT unsigned,";
-SET @l9="SPINS INTEGER unsigned,";
-SET @l10="OBJECT_SCHEMA VARCHAR(64),";
-SET @l11="OBJECT_NAME VARCHAR(512),";
-SET @l12="OBJECT_TYPE VARCHAR(64),";
-SET @l13="OBJECT_INSTANCE_BEGIN BIGINT not null,";
-SET @l14="NESTING_EVENT_ID BIGINT unsigned,";
-SET @l15="OPERATION VARCHAR(16) not null,";
-SET @l16="NUMBER_OF_BYTES BIGINT unsigned,";
-SET @l17="FLAGS INTEGER unsigned";
-SET @l18=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+SET @cmd="CREATE TABLE performance_schema.EVENTS_WAITS_CURRENT("
+ "THREAD_ID INTEGER not null,"
+ "EVENT_ID BIGINT unsigned not null,"
+ "EVENT_NAME VARCHAR(128) not null,"
+ "SOURCE VARCHAR(64),"
+ "TIMER_START BIGINT unsigned,"
+ "TIMER_END BIGINT unsigned,"
+ "TIMER_WAIT BIGINT unsigned,"
+ "SPINS INTEGER unsigned,"
+ "OBJECT_SCHEMA VARCHAR(64),"
+ "OBJECT_NAME VARCHAR(512),"
+ "OBJECT_TYPE VARCHAR(64),"
+ "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "NESTING_EVENT_ID BIGINT unsigned,"
+ "OPERATION VARCHAR(16) not null,"
+ "NUMBER_OF_BYTES BIGINT unsigned,"
+ "FLAGS INTEGER unsigned"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -217,10 +211,24 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_HISTORY
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY(";
--- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+SET @cmd="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY("
+ "THREAD_ID INTEGER not null,"
+ "EVENT_ID BIGINT unsigned not null,"
+ "EVENT_NAME VARCHAR(128) not null,"
+ "SOURCE VARCHAR(64),"
+ "TIMER_START BIGINT unsigned,"
+ "TIMER_END BIGINT unsigned,"
+ "TIMER_WAIT BIGINT unsigned,"
+ "SPINS INTEGER unsigned,"
+ "OBJECT_SCHEMA VARCHAR(64),"
+ "OBJECT_NAME VARCHAR(512),"
+ "OBJECT_TYPE VARCHAR(64),"
+ "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "NESTING_EVENT_ID BIGINT unsigned,"
+ "OPERATION VARCHAR(16) not null,"
+ "NUMBER_OF_BYTES BIGINT unsigned,"
+ "FLAGS INTEGER unsigned"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -231,10 +239,24 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_HISTORY_LONG
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG(";
--- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+SET @cmd="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG("
+ "THREAD_ID INTEGER not null,"
+ "EVENT_ID BIGINT unsigned not null,"
+ "EVENT_NAME VARCHAR(128) not null,"
+ "SOURCE VARCHAR(64),"
+ "TIMER_START BIGINT unsigned,"
+ "TIMER_END BIGINT unsigned,"
+ "TIMER_WAIT BIGINT unsigned,"
+ "SPINS INTEGER unsigned,"
+ "OBJECT_SCHEMA VARCHAR(64),"
+ "OBJECT_NAME VARCHAR(512),"
+ "OBJECT_TYPE VARCHAR(64),"
+ "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "NESTING_EVENT_ID BIGINT unsigned,"
+ "OPERATION VARCHAR(16) not null,"
+ "NUMBER_OF_BYTES BIGINT unsigned,"
+ "FLAGS INTEGER unsigned"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -245,16 +267,14 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(";
-SET @l2="EVENT_NAME VARCHAR(128) not null,";
-SET @l3="COUNT_STAR BIGINT unsigned not null,";
-SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
-SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,";
-SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,";
-SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null";
-SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+SET @cmd="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME("
+ "EVENT_NAME VARCHAR(128) not null,"
+ "COUNT_STAR BIGINT unsigned not null,"
+ "SUM_TIMER_WAIT BIGINT unsigned not null,"
+ "MIN_TIMER_WAIT BIGINT unsigned not null,"
+ "AVG_TIMER_WAIT BIGINT unsigned not null,"
+ "MAX_TIMER_WAIT BIGINT unsigned not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -265,17 +285,15 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(";
-SET @l2="EVENT_NAME VARCHAR(128) not null,";
-SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
-SET @l4="COUNT_STAR BIGINT unsigned not null,";
-SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
-SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
-SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
-SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
-SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
+SET @cmd="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE("
+ "EVENT_NAME VARCHAR(128) not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "COUNT_STAR BIGINT unsigned not null,"
+ "SUM_TIMER_WAIT BIGINT unsigned not null,"
+ "MIN_TIMER_WAIT BIGINT unsigned not null,"
+ "AVG_TIMER_WAIT BIGINT unsigned not null,"
+ "MAX_TIMER_WAIT BIGINT unsigned not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -286,17 +304,15 @@ DROP PREPARE stmt;
-- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
--
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="EVENT_NAME VARCHAR(128) not null,";
-SET @l4="COUNT_STAR BIGINT unsigned not null,";
-SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
-SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
-SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
-SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
-SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
+SET @cmd="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME("
+ "THREAD_ID INTEGER not null,"
+ "EVENT_NAME VARCHAR(128) not null,"
+ "COUNT_STAR BIGINT unsigned not null,"
+ "SUM_TIMER_WAIT BIGINT unsigned not null,"
+ "MIN_TIMER_WAIT BIGINT unsigned not null,"
+ "AVG_TIMER_WAIT BIGINT unsigned not null,"
+ "MAX_TIMER_WAIT BIGINT unsigned not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -307,13 +323,11 @@ DROP PREPARE stmt;
-- TABLE FILE_INSTANCES
--
-SET @l1="CREATE TABLE performance_schema.FILE_INSTANCES(";
-SET @l2="FILE_NAME VARCHAR(512) not null,";
-SET @l3="EVENT_NAME VARCHAR(128) not null,";
-SET @l4="OPEN_COUNT INTEGER unsigned not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+SET @cmd="CREATE TABLE performance_schema.FILE_INSTANCES("
+ "FILE_NAME VARCHAR(512) not null,"
+ "EVENT_NAME VARCHAR(128) not null,"
+ "OPEN_COUNT INTEGER unsigned not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -324,15 +338,13 @@ DROP PREPARE stmt;
-- TABLE FILE_SUMMARY_BY_EVENT_NAME
--
-SET @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME(";
-SET @l2="EVENT_NAME VARCHAR(128) not null,";
-SET @l3="COUNT_READ BIGINT unsigned not null,";
-SET @l4="COUNT_WRITE BIGINT unsigned not null,";
-SET @l5="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
-SET @l6="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
-SET @l7=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7);
+SET @cmd="CREATE TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME("
+ "EVENT_NAME VARCHAR(128) not null,"
+ "COUNT_READ BIGINT unsigned not null,"
+ "COUNT_WRITE BIGINT unsigned not null,"
+ "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
+ "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -343,16 +355,14 @@ DROP PREPARE stmt;
-- TABLE FILE_SUMMARY_BY_INSTANCE
--
-SET @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE(";
-SET @l2="FILE_NAME VARCHAR(512) not null,";
-SET @l3="EVENT_NAME VARCHAR(128) not null,";
-SET @l4="COUNT_READ BIGINT unsigned not null,";
-SET @l5="COUNT_WRITE BIGINT unsigned not null,";
-SET @l6="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
-SET @l7="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
-SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+SET @cmd="CREATE TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE("
+ "FILE_NAME VARCHAR(512) not null,"
+ "EVENT_NAME VARCHAR(128) not null,"
+ "COUNT_READ BIGINT unsigned not null,"
+ "COUNT_WRITE BIGINT unsigned not null,"
+ "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
+ "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -363,13 +373,11 @@ DROP PREPARE stmt;
-- TABLE MUTEX_INSTANCES
--
-SET @l1="CREATE TABLE performance_schema.MUTEX_INSTANCES(";
-SET @l2="NAME VARCHAR(128) not null,";
-SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
-SET @l4="LOCKED_BY_THREAD_ID INTEGER";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+SET @cmd="CREATE TABLE performance_schema.MUTEX_INSTANCES("
+ "NAME VARCHAR(128) not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "LOCKED_BY_THREAD_ID INTEGER"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -380,14 +388,12 @@ DROP PREPARE stmt;
-- TABLE PERFORMANCE_TIMERS
--
-SET @l1="CREATE TABLE performance_schema.PERFORMANCE_TIMERS(";
-SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,";
-SET @l3="TIMER_FREQUENCY BIGINT,";
-SET @l4="TIMER_RESOLUTION BIGINT,";
-SET @l5="TIMER_OVERHEAD BIGINT";
-SET @l6=") ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
+SET @cmd="CREATE TABLE performance_schema.PERFORMANCE_TIMERS("
+ "TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,"
+ "TIMER_FREQUENCY BIGINT,"
+ "TIMER_RESOLUTION BIGINT,"
+ "TIMER_OVERHEAD BIGINT"
+ ") ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -398,13 +404,11 @@ DROP PREPARE stmt;
-- TABLE PROCESSLIST
--
-SET @l1="CREATE TABLE performance_schema.PROCESSLIST(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="ID INTEGER not null,";
-SET @l4="NAME VARCHAR(64) not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+SET @cmd="CREATE TABLE performance_schema.PROCESSLIST("
+ "THREAD_ID INTEGER not null,"
+ "ID INTEGER not null,"
+ "NAME VARCHAR(64) not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -415,14 +419,12 @@ DROP PREPARE stmt;
-- TABLE RWLOCK_INSTANCES
--
-SET @l1="CREATE TABLE performance_schema.RWLOCK_INSTANCES(";
-SET @l2="NAME VARCHAR(128) not null,";
-SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
-SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,";
-SET @l5="READ_LOCKED_BY_COUNT INTEGER unsigned not null";
-SET @l6=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
+SET @cmd="CREATE TABLE performance_schema.RWLOCK_INSTANCES("
+ "NAME VARCHAR(128) not null,"
+ "OBJECT_INSTANCE_BEGIN BIGINT not null,"
+ "WRITE_LOCKED_BY_THREAD_ID INTEGER,"
+ "READ_LOCKED_BY_COUNT INTEGER unsigned not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -433,12 +435,10 @@ DROP PREPARE stmt;
-- TABLE SETUP_CONSUMERS
--
-SET @l1="CREATE TABLE performance_schema.SETUP_CONSUMERS(";
-SET @l2="NAME VARCHAR(64) not null,";
-SET @l3="ENABLED ENUM ('YES', 'NO') not null";
-SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4);
+SET @cmd="CREATE TABLE performance_schema.SETUP_CONSUMERS("
+ "NAME VARCHAR(64) not null,"
+ "ENABLED ENUM ('YES', 'NO') not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -446,16 +446,17 @@ EXECUTE stmt;
DROP PREPARE stmt;
--
--- TABLE SETUP_INSTRUMENTS
+-- TABLE SETUP_OBJECTS
--
-SET @l1="CREATE TABLE performance_schema.SETUP_INSTRUMENTS(";
-SET @l2="NAME VARCHAR(128) not null,";
-SET @l3="ENABLED ENUM ('YES', 'NO') not null,";
-SET @l4="TIMED ENUM ('YES', 'NO') not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+SET @cmd="CREATE TABLE performance_schema.SETUP_OBJECTS("
+ "OBJECT_TYPE VARCHAR(64),"
+ "OBJECT_SCHEMA VARCHAR(64),"
+ "OBJECT_NAME VARCHAR(64),"
+ "ENABLED ENUM ('YES', 'NO') not null,"
+ "TIMED ENUM ('YES', 'NO') not null,"
+ "AGGREGATED ENUM ('YES', 'NO') not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -463,19 +464,14 @@ EXECUTE stmt;
DROP PREPARE stmt;
--
--- TABLE SETUP_OBJECTS
+-- TABLE SETUP_INSTRUMENTS
--
-SET @l1="CREATE TABLE performance_schema.SETUP_OBJECTS(";
-SET @l2="OBJECT_TYPE VARCHAR(64),";
-SET @l3="OBJECT_SCHEMA VARCHAR(64),";
-SET @l4="OBJECT_NAME VARCHAR(64),";
-SET @l5="ENABLED ENUM ('YES', 'NO') not null,";
-SET @l6="TIMED ENUM ('YES', 'NO') not null,";
-SET @l7="AGGREGATED ENUM ('YES', 'NO') not null";
-SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+SET @cmd="CREATE TABLE performance_schema.SETUP_INSTRUMENTS("
+ "NAME VARCHAR(128) not null,"
+ "ENABLED ENUM ('YES', 'NO') not null,"
+ "TIMED ENUM ('YES', 'NO') not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -486,12 +482,10 @@ DROP PREPARE stmt;
-- TABLE SETUP_TIMERS
--
-SET @l1="CREATE TABLE performance_schema.SETUP_TIMERS(";
-SET @l2="NAME VARCHAR(64) not null,";
-SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
-SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4);
+SET @cmd="CREATE TABLE performance_schema.SETUP_TIMERS("
+ "NAME VARCHAR(64) not null,"
+ "TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null"
+ ")ENGINE=PERFORMANCE_SCHEMA;";
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt 2010-07-19 16:09:51 +0000
+++ b/sql/CMakeLists.txt 2010-07-23 17:20:00 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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
@@ -10,8 +10,8 @@
# GNU General Public License for more details.
#
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
INCLUDE_DIRECTORIES(
@@ -72,6 +72,7 @@ SET (SQL_SOURCE
sql_servers.cc sql_audit.cc
sql_connect.cc scheduler.cc
sql_profile.cc event_parse_data.cc
+ sql_bootstrap.cc
sql_signal.cc mdl.cc
sql_alloc_error_handler.cc
transaction.cc sys_vars.cc rpl_handler.cc sql_truncate.cc datadict.cc
=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am 2010-07-19 16:09:51 +0000
+++ b/sql/Makefile.am 2010-07-23 17:20:00 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2000-2006 MySQL AB
+# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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
@@ -10,8 +10,8 @@
# GNU General Public License for more details.
#
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
#called from the top level Makefile
@@ -161,7 +161,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
sql_union.cc sql_derived.cc \
- sql_client.cc \
+ sql_client.cc sql_bootstrap.cc \
sql_olap.cc sql_view.cc \
gstream.cc spatial.cc sql_help.cc sql_cursor.cc \
tztime.cc my_decimal.cc\
=== added file 'sql/sql_bootstrap.cc'
--- a/sql/sql_bootstrap.cc 1970-01-01 00:00:00 +0000
+++ b/sql/sql_bootstrap.cc 2010-06-30 14:05:18 +0000
@@ -0,0 +1,99 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+
+#include <ctype.h>
+#include <string.h>
+#include "sql_bootstrap.h"
+
+int read_bootstrap_query(char *query, int *query_length,
+ fgets_input_t input, fgets_fn_t fgets_fn)
+{
+ char line_buffer[MAX_BOOTSTRAP_LINE_SIZE];
+ const char *line;
+ int len;
+ int query_len= 0;
+
+ for ( ; ; )
+ {
+ line= (*fgets_fn)(line_buffer, sizeof(line_buffer), input);
+
+ if (line == NULL)
+ return (query_len ? READ_BOOTSTRAP_ERROR : READ_BOOTSTRAP_EOF);
+
+ len= strlen(line);
+
+ /*
+ Remove trailing whitespace characters.
+ This assumes:
+ - no multibyte encoded character can be found at the very end of a line,
+ - whitespace characters from the "C" locale only.
+ which is sufficient for the kind of queries found
+ in the bootstrap scripts.
+ */
+ while (len && (isspace(line[len - 1])))
+ len--;
+ /*
+ Cleanly end the string, so we don't have to test len > x
+ all the time before reading line[x], in the code below.
+ */
+ line_buffer[len]= '\0';
+
+ /* Skip blank lines */
+ if (len == 0)
+ continue;
+
+ /* Skip # comments */
+ if (line[0] == '#')
+ continue;
+
+ /* Skip -- comments */
+ if ((line[0] == '-') && (line[1] == '-'))
+ continue;
+
+ /* Skip delimiter, ignored. */
+ if (strncmp(line, "delimiter", 9) == 0)
+ continue;
+
+ /* Append the current line to a multi line query. */
+
+ if (query_len + len + 1 >= MAX_BOOTSTRAP_QUERY_SIZE)
+ return READ_BOOTSTRAP_ERROR;
+
+ if (query_len != 0)
+ {
+ /*
+ Append a \n to the current line, if any,
+ to preserve the intended presentation.
+ */
+ query[query_len]= '\n';
+ query_len++;
+ }
+ memcpy(query + query_len, line, len);
+ query_len+= len;
+
+ if (line[len - 1] == ';')
+ {
+ /*
+ The last line is terminated by ';'.
+ Return the query found.
+ */
+ query[query_len]= '\0';
+ *query_length= query_len;
+ return 0;
+ }
+ }
+}
+
=== added file 'sql/sql_bootstrap.h'
--- a/sql/sql_bootstrap.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_bootstrap.h 2010-06-30 14:05:18 +0000
@@ -0,0 +1,44 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+
+#ifndef SQL_BOOTSTRAP_H
+#define SQL_BOOTSTRAP_H
+
+/**
+ The maximum size of a bootstrap query.
+ Increase this size if parsing a longer query during bootstrap is necessary.
+ The longest query in use currently is:
+ INSERT INTO time_zone_transition ..., 8059 characters
+*/
+#define MAX_BOOTSTRAP_QUERY_SIZE 10000
+/**
+ The maximum size of a bootstrap query, expressed in a single line.
+ Do not increase this size, use the multiline syntax with 'GO' instead.
+*/
+#define MAX_BOOTSTRAP_LINE_SIZE 10000
+
+#define READ_BOOTSTRAP_EOF 1
+#define READ_BOOTSTRAP_ERROR 2
+
+typedef void *fgets_input_t;
+typedef char * (*fgets_fn_t)(char *, size_t, fgets_input_t);
+
+int read_bootstrap_query(char *query, int *query_length,
+ fgets_input_t input, fgets_fn_t fgets_fn);
+
+#endif
+
+
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2010-07-19 16:09:51 +0000
+++ b/sql/sql_parse.cc 2010-07-23 17:20:00 +0000
@@ -96,6 +96,7 @@
#include "debug_sync.h"
#include "probes_mysql.h"
#include "set_var.h"
+#include "sql_bootstrap.h"
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
@@ -483,11 +484,20 @@ void execute_init_command(THD *thd, LEX_
#endif
}
+static char *fgets_fn(char *buffer, size_t size, fgets_input_t input)
+{
+ MYSQL_FILE *in= static_cast<MYSQL_FILE*> (input);
+ return mysql_file_fgets(buffer, size, in);
+}
static void handle_bootstrap_impl(THD *thd)
{
MYSQL_FILE *file= bootstrap_file;
- char *buff;
+ char buffer[MAX_BOOTSTRAP_QUERY_SIZE];
+ char *query;
+ int length;
+ int rc;
+ const char* found_semicolon= NULL;
DBUG_ENTER("handle_bootstrap");
@@ -507,44 +517,26 @@ static void handle_bootstrap_impl(THD *t
*/
thd->client_capabilities|= CLIENT_MULTI_RESULTS;
- buff= (char*) thd->net.buff;
thd->init_for_queries();
- while (mysql_file_fgets(buff, thd->net.max_packet, file))
+
+ for ( ; ; )
{
- char *query;
- /* strlen() can't be deleted because mysql_file_fgets() doesn't return length */
- ulong length= (ulong) strlen(buff);
- while (buff[length-1] != '\n' && !mysql_file_feof(file))
+ rc= read_bootstrap_query(buffer, &length, file, fgets_fn);
+
+ if (rc == READ_BOOTSTRAP_ERROR)
{
- /*
- We got only a part of the current string. Will try to increase
- net buffer then read the rest of the current string.
- */
- /* purecov: begin tested */
- if (net_realloc(&(thd->net), 2 * thd->net.max_packet))
- {
- thd->protocol->end_statement();
- bootstrap_error= 1;
- break;
- }
- buff= (char*) thd->net.buff;
- mysql_file_fgets(buff + length, thd->net.max_packet - length, file);
- length+= (ulong) strlen(buff + length);
- /* purecov: end */
+ thd->raise_error(ER_SYNTAX_ERROR);
+ thd->protocol->end_statement();
+ bootstrap_error= 1;
+ break;
}
- if (bootstrap_error)
- break; /* purecov: inspected */
- while (length && (my_isspace(thd->charset(), buff[length-1]) ||
- buff[length-1] == ';'))
- length--;
- buff[length]=0;
-
- /* Skip lines starting with delimiter */
- if (strncmp(buff, STRING_WITH_LEN("delimiter")) == 0)
- continue;
+ if (rc == READ_BOOTSTRAP_EOF)
+ break;
+
+ DBUG_ASSERT(rc == 0);
- query= (char *) thd->memdup_w_gap(buff, length + 1,
+ query= (char *) thd->memdup_w_gap(buffer, length + 1,
thd->db_length + 1 +
QUERY_CACHE_FLAGS_SIZE);
thd->set_query_and_id(query, length, next_query_id());
Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100726181238-dukf1yvhut50tm18.bundle
| Thread |
|---|
| • bzr commit into mysql-next-mr-wl5291 branch (marc.alff:3170) WL#5291 | Marc Alff | 26 Jul |