summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2013-01-11 00:53:07 +0200
committerMichael Widenius <monty@askmonty.org>2013-01-11 00:53:07 +0200
commit5f68820cd4da742adee9d832603bae717c25b1fa (patch)
tree6e13c4c121e79e2df6bee298115372e4b11da3d2
parenta42e1e3885ce4519bb5db2f02f2448d0a29cd7a7 (diff)
downloadmariadb-git-5f68820cd4da742adee9d832603bae717c25b1fa.tar.gz
Fixed problem with failing mysql_upgrade when proc table was not correct.
Moved out creation of performance schema tables from mysql_system_tables.sql as the performance_tables creation scripts needs a working mysql.proc to work. client/mysql_upgrade.c: Added option -V, --version debian/dist/Debian/mariadb-server-5.5.files: Added mysql_performance_tables.sql debian/dist/Ubuntu/mariadb-server-5.5.files: Added mysql_performance_tables.sql mysql-test/lib/v1/mysql-test-run.pl: Added mysql_performance_tables.sql mysql-test/mysql-test-run.pl: Added mysql_performance_tables.sql scripts/CMakeLists.txt: Moved out creation of performance schema tables from mysql_system_tables.sql as the performance_tables creation scripts needs a working mysql.proc to work scripts/mysql_install_db.sh: Added mysql_performance_tables.sql scripts/mysql_performance_tables.sql: Moved out creation of performance schema tables from mysql_system_tables.sql as the performance_tables creation scripts needs a working mysql.proc to work scripts/mysql_system_tables.sql: Move creation of performance schema tables to mysql_performance_tables.sql Added 'flush tables' to get things to work if someone deletes a table like mysql.proc before run scripts/mysql_system_tables_fix.sql: ove performance table things to mysql_performance_tables.sql storage/perfschema/pfs.cc: Fixed comment
-rw-r--r--client/mysql_upgrade.c9
-rw-r--r--debian/dist/Debian/mariadb-server-5.5.files1
-rw-r--r--debian/dist/Ubuntu/mariadb-server-5.5.files1
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl2
-rwxr-xr-xmysql-test/mysql-test-run.pl5
-rw-r--r--scripts/CMakeLists.txt6
-rw-r--r--scripts/mysql_install_db.sh7
-rw-r--r--scripts/mysql_performance_tables.sql402
-rw-r--r--scripts/mysql_system_tables.sql379
-rw-r--r--scripts/mysql_system_tables_fix.sql23
-rw-r--r--storage/perfschema/pfs.cc2
11 files changed, 429 insertions, 408 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 71bc936cfe6..7aaad96e985 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -22,7 +22,7 @@
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
-#define VER "1.2"
+#define VER "1.3"
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
@@ -148,6 +148,8 @@ static struct my_option my_long_options[]=
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process.",
&opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ {"version", 'V', "Output version information and exit.", 0, 0, 0,
+ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
"All commands including mysqlcheck are binlogged. Enabled by default;"
"use --skip-write-binlog when commands should not be sent to replication slaves.",
@@ -298,6 +300,11 @@ get_one_option(int optid, const struct my_option *opt,
}
add_option= 0;
break;
+ case 'V':
+ printf("%s Ver %s Distrib %s, for %s (%s)\n",
+ my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+ die(0);
+ break;
case OPT_SILENT:
opt_verbose= 0;
add_option= 0;
diff --git a/debian/dist/Debian/mariadb-server-5.5.files b/debian/dist/Debian/mariadb-server-5.5.files
index b236d19a2c5..ad2153fe28b 100644
--- a/debian/dist/Debian/mariadb-server-5.5.files
+++ b/debian/dist/Debian/mariadb-server-5.5.files
@@ -61,4 +61,5 @@ usr/share/mysql/errmsg-utf8.txt
usr/share/mysql/fill_help_tables.sql
usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_system_tables.sql
+usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_test_data_timezone.sql
diff --git a/debian/dist/Ubuntu/mariadb-server-5.5.files b/debian/dist/Ubuntu/mariadb-server-5.5.files
index e88e52689ae..d201577f7cf 100644
--- a/debian/dist/Ubuntu/mariadb-server-5.5.files
+++ b/debian/dist/Ubuntu/mariadb-server-5.5.files
@@ -63,4 +63,5 @@ usr/share/mysql/errmsg-utf8.txt
usr/share/mysql/fill_help_tables.sql
usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_system_tables.sql
+usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_test_data_timezone.sql
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index f20eab80ae9..4e1625db093 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -3229,6 +3229,8 @@ sub install_db ($$) {
# for a production system
mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql",
$bootstrap_sql_file);
+ mtr_appendfile_to_file("$path_sql_dir/mysql_performance_tables.sql",
+ $bootstrap_sql_file);
# Add the mysql system tables initial data
# for a production system
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index d78a0254156..e2331e2e454 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -3522,6 +3522,11 @@ sub mysql_install_db {
mtr_appendfile_to_file("$sql_dir/mysql_system_tables.sql",
$bootstrap_sql_file);
+ # Add the performance tables
+ # for a production system
+ mtr_appendfile_to_file("$sql_dir/mysql_performance_tables.sql",
+ $bootstrap_sql_file);
+
# Add the mysql system tables initial data
# for a production system
mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql",
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 91a47bf3d48..8f306abcb32 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -29,7 +29,7 @@ ENDIF()
IF(CAT_EXECUTABLE)
SET(CAT_COMMAND COMMAND
${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
- ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql >
+ ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql mysql_performance_tables.sql >
${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
)
ELSEIF(WIN32)
@@ -37,7 +37,7 @@ ELSEIF(WIN32)
native_outfile )
SET(CAT_COMMAND
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
- cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql
+ cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql + mysql_performance_tables.sql
${native_outfile} )
ELSE()
MESSAGE(FATAL_ERROR "Cannot concatenate files")
@@ -55,6 +55,7 @@ ADD_CUSTOM_COMMAND(
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_fix.sql
+ ${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql
)
# Add target for the above to be built
@@ -74,6 +75,7 @@ ENDIF()
INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
+ ${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql
${FIX_PRIVILEGES_SQL}
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 91780570194..b28e8a3ba1c 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2000, 2011, Oracle and/or its affiliates.
-# Copyright (c) 2009, 2011, Monty Program Ab
+# Copyright (c) 2009, 2011,2013 Monty Program Ab
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -305,9 +305,10 @@ fi
# Set up paths to SQL scripts required for bootstrap
fill_help_tables="$pkgdatadir/fill_help_tables.sql"
create_system_tables="$pkgdatadir/mysql_system_tables.sql"
+create_system_tables2="$pkgdatadir/mysql_performance_tables.sql"
fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql"
-for f in "$fill_help_tables" "$create_system_tables" "$fill_system_tables"
+for f in "$fill_help_tables" "$create_system_tables" "$create_system_tables2" "$fill_system_tables"
do
if test ! -f "$f"
then
@@ -424,7 +425,7 @@ mysqld_install_cmd_line()
# Create the system and help tables by passing them to "mysqld --bootstrap"
s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..."
-if { echo "use mysql;"; cat "$create_system_tables" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
+if { echo "use mysql;"; cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
then
s_echo "OK"
else
diff --git a/scripts/mysql_performance_tables.sql b/scripts/mysql_performance_tables.sql
new file mode 100644
index 00000000000..193d79bb502
--- /dev/null
+++ b/scripts/mysql_performance_tables.sql
@@ -0,0 +1,402 @@
+--
+-- PERFORMANCE SCHEMA INSTALLATION
+-- Note that this script is also reused by mysql_upgrade,
+-- so we have to be very careful here to not destroy any
+-- existing database named 'performance_schema' if it
+-- can contain user data.
+-- In case of downgrade, it's ok to drop unknown tables
+-- from a future version, as long as they belong to the
+-- performance schema engine.
+--
+
+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);
+
+-- Work around for bug#49542
+SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0');
+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);
+
+-- Work around for bug#49542
+SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema');
+
+SET @broken_events = (select count(*) from mysql.event where db='performance_schema');
+
+SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events);
+
+--
+-- The performance schema database.
+-- Only drop and create the database if this is safe (no broken_pfs).
+-- This database is created, even in --without-perfschema builds,
+-- so that the database name is always reserved by the MySQL implementation.
+-- This script must be executed AFTER we have fixed the proc table, to
+-- avoid errors with old proc tables.
+--
+
+SET @cmd= "DROP DATABASE IF EXISTS performance_schema";
+
+SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @cmd= "CREATE DATABASE performance_schema character set utf8";
+
+SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- From this point, only create the performance schema tables
+-- if the server is build with performance schema
+--
+
+set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO');
+
+--
+-- 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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_global_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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_INSTRUMENTS
+--
+
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE THREADS
+--
+
+SET @l1="CREATE TABLE performance_schema.threads(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="PROCESSLIST_ID INTEGER,";
+SET @l4="NAME VARCHAR(128) not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- Unlike 'performance_schema', the 'mysql' database is reserved already,
+-- so no user procedure is supposed to be there.
+--
+-- NOTE: until upgrade is finished, stored routines are not available,
+-- because system tables (e.g. mysql.proc) might be not usable.
+--
+drop procedure if exists mysql.die;
+create procedure mysql.die() signal sqlstate 'HY000' set message_text='Unexpected content found in the performance_schema database.';
+
+--
+-- For broken upgrades, SIGNAL the error
+--
+
+SET @cmd="call mysql.die()";
+
+SET @str = IF(@broken_pfs > 0, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+drop procedure mysql.die;
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index 2e97d2b8272..288f67dc45a 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -21,6 +21,7 @@
set sql_mode='';
set storage_engine=myisam;
+flush tables;
CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
@@ -100,384 +101,6 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
---
--- PERFORMANCE SCHEMA INSTALLATION
--- Note that this script is also reused by mysql_upgrade,
--- so we have to be very careful here to not destroy any
--- existing database named 'performance_schema' if it
--- can contain user data.
--- In case of downgrade, it's ok to drop unknown tables
--- from a future version, as long as they belong to the
--- performance schema engine.
---
-
-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);
-
--- Work around for bug#49542
-SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0');
-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);
-
--- Work around for bug#49542
-SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
-SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema');
-
-SET @broken_events = (select count(*) from mysql.event where db='performance_schema');
-
-SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events);
-
---
--- The performance schema database.
--- Only drop and create the database if this is safe (no broken_pfs).
--- This database is created, even in --without-perfschema builds,
--- so that the database name is always reserved by the MySQL implementation.
---
-
-SET @cmd= "DROP DATABASE IF EXISTS performance_schema";
-
-SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
-SET @cmd= "CREATE DATABASE performance_schema character set utf8";
-
-SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- From this point, only create the performance schema tables
--- if the server is build with performance schema
---
-
-set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO');
-
---
--- 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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
---
-
-SET @l1="CREATE TABLE performance_schema.events_waits_summary_global_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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE SETUP_INSTRUMENTS
---
-
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-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 @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE THREADS
---
-
-SET @l1="CREATE TABLE performance_schema.threads(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="PROCESSLIST_ID INTEGER,";
-SET @l4="NAME VARCHAR(128) not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
-- Remember for later if proxies_priv table already existed
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index cc697092e6e..c2d63f12399 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -621,29 +621,6 @@ ALTER TABLE user MODIFY Create_tablespace_priv enum('N','Y') COLLATE utf8_genera
UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0;
---
--- Unlike 'performance_schema', the 'mysql' database is reserved already,
--- so no user procedure is supposed to be there.
---
--- NOTE: until upgrade is finished, stored routines are not available,
--- because system tables (e.g. mysql.proc) might be not usable.
---
-drop procedure if exists mysql.die;
-create procedure mysql.die() signal sqlstate 'HY000' set message_text='Unexpected content found in the performance_schema database.';
-
---
--- For broken upgrades, SIGNAL the error
---
-
-SET @cmd="call mysql.die()";
-
-SET @str = IF(@broken_pfs > 0, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
-drop procedure mysql.die;
-
ALTER TABLE user ADD plugin char(64) DEFAULT '', ADD authentication_string TEXT;
ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL;
ALTER TABLE user MODIFY authentication_string TEXT NOT NULL;
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index 9a6ada2f814..104fecb2d1e 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -119,7 +119,7 @@
mode when a server is installed.
The implementation of the database creation script is located in
- @verbatim ./scripts/mysql_system_tables.sql @endverbatim
+ @verbatim ./scripts/mysql_performance_tables.sql @endverbatim
@subsection INT_CONFIG Runtime configuration interface