3462 Marc Alff 2012-01-06
Code cleanup
modified:
storage/perfschema/pfs_instr.h
3461 Marc Alff 2012-01-06 [merge]
Merge mysql-trunk --> mysql-trunk-pfs-tuning
modified:
include/mysql/psi/psi.h
include/mysql/psi/psi_abi_v1.h.pp
mysql-test/include/show_slave_status.inc
mysql-test/suite/perfschema/r/dml_handler.result
mysql-test/suite/perfschema/r/innodb_table_io.result
mysql-test/suite/perfschema/r/misc.result
mysql-test/suite/perfschema/r/temp_table_io.result
mysql-test/suite/perfschema/t/dml_handler.test
mysql-test/suite/perfschema/t/misc.test
mysql-test/suite/rpl/r/rpl_log_pos.result
mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
mysql-test/suite/rpl/t/rpl_log_pos.test
mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
mysys/psi_noop.c
sql/handler.cc
sql/sql_table.cc
storage/perfschema/pfs.cc
storage/perfschema/unittest/pfs_benchmark-t.cc
3460 Marc Alff 2012-01-06
Windows build break
modified:
storage/perfschema/unittest/pfs_benchmark_helper.cc
=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h 2011-11-10 02:03:57 +0000
+++ b/include/mysql/psi/psi.h 2012-01-06 08:33:36 +0000
@@ -1161,13 +1161,14 @@ typedef void (*release_table_share_v1_t)
/**
Drop a table share.
+ @param temporary True for temporary tables
@param schema_name the table schema name
@param schema_name_length the table schema name length
@param table_name the table name
@param table_name_length the table name length
*/
typedef void (*drop_table_share_v1_t)
- (const char *schema_name, int schema_name_length,
+ (my_bool temporary, const char *schema_name, int schema_name_length,
const char *table_name, int table_name_length);
/**
=== modified file 'include/mysql/psi/psi_abi_v1.h.pp'
--- a/include/mysql/psi/psi_abi_v1.h.pp 2011-11-10 02:03:57 +0000
+++ b/include/mysql/psi/psi_abi_v1.h.pp 2012-01-06 08:33:36 +0000
@@ -307,7 +307,7 @@ typedef struct PSI_table_share* (*get_ta
(my_bool temporary, struct TABLE_SHARE *share);
typedef void (*release_table_share_v1_t)(struct PSI_table_share *share);
typedef void (*drop_table_share_v1_t)
- (const char *schema_name, int schema_name_length,
+ (my_bool temporary, const char *schema_name, int schema_name_length,
const char *table_name, int table_name_length);
typedef struct PSI_table* (*open_table_v1_t)
(struct PSI_table_share *share, const void *identity);
=== modified file 'mysql-test/include/show_slave_status.inc'
--- a/mysql-test/include/show_slave_status.inc 2010-12-20 14:57:35 +0000
+++ b/mysql-test/include/show_slave_status.inc 2012-01-04 15:48:00 +0000
@@ -55,6 +55,11 @@
# comma-separated list. Example:
#
# --let $status_items= Master_Log_File, Relay_Master_Log_File
+#
+# $slave_io_error_replace
+# If set, one or more regex patterns for replacing variable
+# text in the error message. Syntax as --replace-regex
+#
--let $_show_slave_status_items= $status_items
@@ -70,6 +75,7 @@ while ($_show_slave_status_items)
--let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))`
--let $_show_slave_status_value= query_get_value(SHOW SLAVE STATUS, $_show_slave_status_name, 1)
+ --replace_regex $slave_io_error_replace
--let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
--echo $_show_slave_status_name = '$_show_slave_status_value'
}
=== modified file 'mysql-test/suite/perfschema/r/dml_handler.result'
--- a/mysql-test/suite/perfschema/r/dml_handler.result 2011-08-11 03:11:58 +0000
+++ b/mysql-test/suite/perfschema/r/dml_handler.result 2012-01-04 18:29:43 +0000
@@ -153,3 +153,4 @@ ERROR HY000: Table storage engine for 'c
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=1;
HANDLER performance_schema.accounts OPEN;
ERROR HY000: Table storage engine for 'accounts' doesn't have this option
+DROP TEMPORARY TABLE table_list;
=== modified file 'mysql-test/suite/perfschema/r/innodb_table_io.result'
--- a/mysql-test/suite/perfschema/r/innodb_table_io.result 2011-08-11 03:11:58 +0000
+++ b/mysql-test/suite/perfschema/r/innodb_table_io.result 2012-01-04 18:29:43 +0000
@@ -107,9 +107,7 @@ wait/io/table/sql/handler handler.cc: TA
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test #sql-XXXX insert NULL
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test #sql-XXXX insert NULL
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
=== modified file 'mysql-test/suite/perfschema/r/misc.result'
--- a/mysql-test/suite/perfschema/r/misc.result 2011-04-20 17:56:53 +0000
+++ b/mysql-test/suite/perfschema/r/misc.result 2012-01-04 18:29:43 +0000
@@ -1,3 +1,24 @@
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+WHERE object_schema='test';
+object_schema object_name
+CREATE TABLE test.t_before(a INT);
+INSERT INTO test.t_before VALUES (1);
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+WHERE object_schema='test';
+object_schema object_name
+test t_before
+RENAME TABLE test.t_before TO test.t_after;
+SELECT COUNT(*) FROM test.t_after;
+COUNT(*)
+1
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+WHERE object_schema='test';
+object_schema object_name
+test t_after
+DROP TABLE test.t_after;
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+WHERE object_schema='test';
+object_schema object_name
SELECT EVENT_ID FROM performance_schema.events_waits_current
WHERE THREAD_ID IN
(SELECT THREAD_ID FROM performance_schema.threads)
@@ -7,10 +28,19 @@ WHERE NAME LIKE "wait/synch/%")
LIMIT 1;
create table test.t1(a int) engine=performance_schema;
ERROR HY000: Can't create table 'test.t1' (errno: 131)
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+WHERE object_schema='test';
+object_schema object_name
create table test.t1 like performance_schema.events_waits_current;
ERROR HY000: Can't create table 'test.t1' (errno: 131)
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+WHERE object_schema='test';
+object_schema object_name
create table performance_schema.t1(a int);
ERROR 42000: CREATE command denied to user 'root'@'localhost' for table 't1'
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+WHERE object_schema='test';
+object_schema object_name
drop table if exists test.ghost;
create table test.ghost (a int, b int);
alter table test.ghost add index index_a(a);
=== modified file 'mysql-test/suite/perfschema/r/temp_table_io.result'
--- a/mysql-test/suite/perfschema/r/temp_table_io.result 2011-08-11 03:11:58 +0000
+++ b/mysql-test/suite/perfschema/r/temp_table_io.result 2012-01-04 18:29:43 +0000
@@ -73,42 +73,15 @@ event_name short_source object_type obje
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab update NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab update NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab update NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab delete NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
-wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test no_index_tab fetch NULL
+wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
+wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
+wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
+wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
+wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
+wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
show status like 'performance_schema_%';
=== modified file 'mysql-test/suite/perfschema/t/dml_handler.test'
--- a/mysql-test/suite/perfschema/t/dml_handler.test 2011-10-19 21:49:22 +0000
+++ b/mysql-test/suite/perfschema/t/dml_handler.test 2012-01-04 18:29:43 +0000
@@ -15,7 +15,7 @@
--echo
--echo # Create a temporary table of performance schema table names
--echo
-
+
CREATE TEMPORARY TABLE table_list (id INT AUTO_INCREMENT, PRIMARY KEY (id)) AS
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='performance_schema';
@@ -38,3 +38,5 @@ while ($count > 0)
dec $count;
}
+DROP TEMPORARY TABLE table_list;
+
=== modified file 'mysql-test/suite/perfschema/t/misc.test'
--- a/mysql-test/suite/perfschema/t/misc.test 2011-10-19 21:49:22 +0000
+++ b/mysql-test/suite/perfschema/t/misc.test 2012-01-04 18:29:43 +0000
@@ -5,6 +5,40 @@
--source include/have_perfschema.inc
#
+# Bug#12790483 OBJECTS_SUMMARY_GLOBAL_BY_TYPE AND RENAME TABLE
+#
+# Rename table leaves old tables names behind in
+# performance_schema.objects_summary_global_by_type
+#
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+CREATE TABLE test.t_before(a INT);
+INSERT INTO test.t_before VALUES (1);
+
+# The new table should appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+RENAME TABLE test.t_before TO test.t_after;
+
+# The renamed table should appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE, but only
+# after it is accessed.
+
+SELECT COUNT(*) FROM test.t_after;
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+DROP TABLE test.t_after;
+
+# The renamed table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
+#
# Bug#45496 Performance schema: assertion fails in
# ha_perfschema::rnd_init:223
#
@@ -26,6 +60,11 @@ LIMIT 1;
--error ER_CANT_CREATE_TABLE
create table test.t1(a int) engine=performance_schema;
+# The table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
#
# Bug#44897 Performance Schema: can create a ghost table in another database
#
@@ -33,6 +72,11 @@ create table test.t1(a int) engine=perfo
--error ER_CANT_CREATE_TABLE
create table test.t1 like performance_schema.events_waits_current;
+# The table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
#
# Bug#44898 PerformanceSchema: can create a table in db performance_schema, cannot insert
#
@@ -40,6 +84,11 @@ create table test.t1 like performance_sc
--error ER_TABLEACCESS_DENIED_ERROR
create table performance_schema.t1(a int);
+# The table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+
+SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
+ WHERE object_schema='test';
+
#
# Bug#51447 performance schema evil twin files
#
=== modified file 'mysql-test/suite/rpl/r/rpl_log_pos.result'
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result 2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result 2012-01-04 15:48:00 +0000
@@ -12,6 +12,7 @@ change master to master_log_pos=MASTER_L
Read_Master_Log_Pos = '75'
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
include/stop_slave_sql.inc
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
=== modified file 'mysql-test/suite/rpl/r/rpl_manual_change_index_file.result'
--- a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result 2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result 2012-01-04 15:48:00 +0000
@@ -8,6 +8,7 @@ CREATE TABLE t1(c1 INT);
FLUSH LOGS;
call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
include/wait_for_slave_io_error.inc [errno=1236]
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the last event was read from 'master-bin.000002' at XXX, the last byte read was read from 'master-bin.000002' at XXX.''
CREATE TABLE t2(c1 INT);
FLUSH LOGS;
CREATE TABLE t3(c1 INT);
=== modified file 'mysql-test/suite/rpl/t/rpl_log_pos.test'
--- a/mysql-test/suite/rpl/t/rpl_log_pos.test 2011-10-28 21:22:19 +0000
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test 2012-01-04 15:48:00 +0000
@@ -22,12 +22,9 @@ let $status_items= Read_Master_Log_Pos;
source include/show_slave_status.inc;
start slave;
let $slave_io_errno= 1236;
-#
-# Win and Unix path is printed differently: BUG#13055685. So
-# show_slave_io_error is made 0 until the bug fixes provide necessary
-# facilities
-#
-let $show_slave_io_error= 0;
+--let $show_slave_io_error= 1
+# Mask line numbers, and whether master-bin is preceded by "./" or "."
+--let $slave_io_error_replace= / at [0-9]*/ at XXX/ /\.\/*master-bin/master-bin/
source include/wait_for_slave_io_error.inc;
source include/stop_slave_sql.inc;
=== modified file 'mysql-test/suite/rpl/t/rpl_manual_change_index_file.test'
--- a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test 2011-10-28 21:22:19 +0000
+++ b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test 2012-01-04 15:48:00 +0000
@@ -61,12 +61,9 @@ call mtr.add_suppression('Got fatal erro
connection slave;
# 1236 = ER_MASTER_FATAL_ERROR_READING_BINLOG
--let $slave_io_errno= 1236
-#
-# Win and Unix path is printed differently: BUG#13055685. So
-# show_slave_io_error is made 0 until the bug fixes provide necessary
-# facilities
-#
---let $show_slave_io_error= 0
+--let $show_slave_io_error= 1
+# Mask line numbers, and whether master-bin is preceded by "./" or "."
+--let $slave_io_error_replace= / at [0-9]*/ at XXX/ /\.\/*master-bin/master-bin/
--source include/wait_for_slave_io_error.inc
connection master;
=== modified file 'mysys/psi_noop.c'
--- a/mysys/psi_noop.c 2011-11-10 02:03:57 +0000
+++ b/mysys/psi_noop.c 2012-01-06 08:33:36 +0000
@@ -141,8 +141,9 @@ static void release_table_share_noop(PSI
}
static void
-drop_table_share_noop(const char *schema_name NNN, int schema_name_length NNN,
- const char *table_name NNN, int table_name_length NNN)
+drop_table_share_noop(my_bool temporary NNN, const char *schema_name NNN,
+ int schema_name_length NNN, const char *table_name NNN,
+ int table_name_length NNN)
{
return;
}
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2012-01-05 15:45:51 +0000
+++ b/sql/handler.cc 2012-01-06 08:33:36 +0000
@@ -2119,7 +2119,11 @@ int ha_delete_table(THD *thd, handlerton
#ifdef HAVE_PSI_TABLE_INTERFACE
if (likely(error == 0))
- PSI_CALL(drop_table_share)(db, strlen(db), alias, strlen(alias));
+ {
+ my_bool temp_table= (my_bool)is_prefix(alias, tmp_file_prefix);
+ PSI_CALL(drop_table_share)(temp_table, db, strlen(db),
+ alias, strlen(alias));
+ }
#endif
DBUG_RETURN(error);
@@ -3927,7 +3931,7 @@ void handler::get_dynamic_partition_info
int ha_create_table(THD *thd, const char *path,
const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
- bool update_create_info)
+ bool update_create_info)
{
int error= 1;
TABLE table;
@@ -3935,16 +3939,17 @@ int ha_create_table(THD *thd, const char
const char *name;
TABLE_SHARE share;
DBUG_ENTER("ha_create_table");
+#ifdef HAVE_PSI_TABLE_INTERFACE
+ my_bool temp_table= (my_bool)is_prefix(table_name, tmp_file_prefix) ||
+ (create_info->options & HA_LEX_CREATE_TMP_TABLE ? TRUE : FALSE);
+#endif
init_tmp_table_share(thd, &share, db, 0, table_name, path);
if (open_table_def(thd, &share, 0))
goto err;
#ifdef HAVE_PSI_TABLE_INTERFACE
- {
- my_bool temp= (create_info->options & HA_LEX_CREATE_TMP_TABLE ? TRUE : FALSE);
- share.m_psi= PSI_CALL(get_table_share)(temp, &share);
- }
+ share.m_psi= PSI_CALL(get_table_share)(temp_table, &share);
#endif
if (open_table_from_share(thd, &share, "", 0, (uint) READ_ALL, 0, &table,
@@ -3962,6 +3967,10 @@ int ha_create_table(THD *thd, const char
{
strxmov(name_buff, db, ".", table_name, NullS);
my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error);
+#ifdef HAVE_PSI_TABLE_INTERFACE
+ PSI_CALL(drop_table_share)(temp_table, db, strlen(db), table_name,
+ strlen(table_name));
+#endif
}
err:
free_table_share(&share);
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2012-01-05 12:12:18 +0000
+++ b/sql/sql_table.cc 2012-01-05 17:57:53 +0000
@@ -54,6 +54,7 @@
#include "transaction.h"
#include "datadict.h" // dd_frm_type()
#include "sql_resolver.h" // setup_order, fix_inner_refs
+#include <mysql/psi/mysql_table.h>
#ifdef __WIN__
#include <io.h>
@@ -2395,9 +2396,9 @@ int mysql_rm_table_no_locks(THD *thd, TA
tbl_name.append('.');
tbl_name.append(String(table->table_name,system_charset_info));
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
- tbl_name.c_ptr());
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
+ tbl_name.c_ptr());
}
else
{
@@ -2423,21 +2424,21 @@ int mysql_rm_table_no_locks(THD *thd, TA
/* No error if non existent table and 'IF EXIST' clause or view */
if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) &&
- (if_exists || table_type == NULL))
+ (if_exists || table_type == NULL))
{
- error= 0;
+ error= 0;
thd->clear_error();
}
if (error == HA_ERR_ROW_IS_REFERENCED)
{
- /* the table is referenced by a foreign key constraint */
- foreign_key_error= 1;
+ /* the table is referenced by a foreign key constraint */
+ foreign_key_error= 1;
}
if (!error || error == ENOENT || error == HA_ERR_NO_SUCH_TABLE)
{
int new_error;
- /* Delete the table definition file */
- strmov(end,reg_ext);
+ /* Delete the table definition file */
+ strmov(end,reg_ext);
if (!(new_error= mysql_file_delete(key_file_frm, path, MYF(MY_WME))))
{
non_tmp_table_deleted= TRUE;
@@ -2451,7 +2452,7 @@ int mysql_rm_table_no_locks(THD *thd, TA
if (error)
{
if (wrong_tables.length())
- wrong_tables.append(',');
+ wrong_tables.append(',');
wrong_tables.append(String(db,system_charset_info));
wrong_tables.append('.');
@@ -2464,6 +2465,11 @@ int mysql_rm_table_no_locks(THD *thd, TA
my_printf_error(ER_BAD_TABLE_ERROR,
ER(ER_BAD_TABLE_ERROR), MYF(0),
table->table_name););
+#ifdef HAVE_PSI_TABLE_INTERFACE
+ if (drop_temporary && likely(error == 0))
+ PSI_CALL(drop_table_share)(true, table->db, table->db_length,
+ table->table_name, table->table_name_length);
+#endif
}
DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog");
thd->thread_specific_used|= (trans_tmp_table_deleted ||
@@ -4725,6 +4731,21 @@ mysql_rename_table(handlerton *base, con
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to,
error, my_strerror(errbuf, sizeof(errbuf), error));
}
+
+#ifdef HAVE_PSI_TABLE_INTERFACE
+ /*
+ Remove the old table share from the pfs table share array. The new table
+ share will be created when the renamed table is first accessed.
+ */
+ if (likely(error == 0))
+ {
+ my_bool temp_table= (my_bool)is_prefix(old_name, tmp_file_prefix);
+ PSI_CALL(drop_table_share)(temp_table, old_db, strlen(old_db),
+ old_name, strlen(old_name));
+ }
+#endif
+
+
DBUG_RETURN(error != 0);
}
=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc 2011-12-19 08:58:41 +0000
+++ b/storage/perfschema/pfs.cc 2012-01-06 08:33:36 +0000
@@ -1479,6 +1479,9 @@ static void destroy_cond_v1(PSI_cond* co
static PSI_table_share*
get_table_share_v1(my_bool temporary, TABLE_SHARE *share)
{
+ /* Ignore temporary tables. */
+ if (temporary)
+ return NULL;
/* An instrumented thread is required, for LF_PINS. */
PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
if (unlikely(pfs_thread == NULL))
@@ -1507,14 +1510,18 @@ static void release_table_share_v1(PSI_t
@sa PSI_v1::drop_table_share.
*/
static void
-drop_table_share_v1(const char *schema_name, int schema_name_length,
+drop_table_share_v1(my_bool temporary,
+ const char *schema_name, int schema_name_length,
const char *table_name, int table_name_length)
{
+ /* Ignore temporary tables. */
+ if (temporary)
+ return;
PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
if (unlikely(pfs_thread == NULL))
return;
/* TODO: temporary tables */
- drop_table_share(pfs_thread, false, schema_name, schema_name_length,
+ drop_table_share(pfs_thread, temporary, schema_name, schema_name_length,
table_name, table_name_length);
}
=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h 2011-11-08 22:45:59 +0000
+++ b/storage/perfschema/pfs_instr.h 2012-01-06 08:39:30 +0000
@@ -377,10 +377,7 @@ struct PFS_thread : PFS_connection_slice
/** Thread instrumentation flag. */
bool m_enabled;
-#ifdef NEVER
- /** Size of @c m_events_waits_stack. */
- uint m_events_waits_count;
-#endif
+ /** Current wait event in the event stack. */
PFS_events_waits *m_events_waits_current;
/** Event ID counter */
ulonglong m_event_id;
=== modified file 'storage/perfschema/unittest/pfs_benchmark-t.cc'
--- a/storage/perfschema/unittest/pfs_benchmark-t.cc 2011-11-16 09:12:07 +0000
+++ b/storage/perfschema/unittest/pfs_benchmark-t.cc 2012-01-06 08:33:36 +0000
@@ -435,7 +435,8 @@ void benchmark_create_table_share(uint c
{
that= PSI_CALL(get_table_share)(false, &table_share);
do_some_work();
- PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+ PSI_CALL(drop_table_share)(false,
+ table_share.db.str, table_share.db.length,
table_share.table_name.str, table_share.table_name.length);
}
@@ -477,7 +478,8 @@ void benchmark_find_table_share(uint cou
do_some_work();
PSI_CALL(release_table_share)(that_2);
}
- PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+ PSI_CALL(drop_table_share)(false,
+ table_share.db.str, table_share.db.length,
table_share.table_name.str, table_share.table_name.length);
timer_end= my_timer_cycles();
@@ -522,7 +524,8 @@ void benchmark_open_table(uint count, co
timer_end= my_timer_cycles();
timer_cycles= timer_end-timer_start;
- PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+ PSI_CALL(drop_table_share)(false,
+ table_share.db.str, table_share.db.length,
table_share.table_name.str, table_share.table_name.length);
// ok(get_work_done() == count, "work done");
@@ -576,7 +579,8 @@ void benchmark_table_io(uint count, cons
// ok(get_work_done() == count, "work done");
PSI_CALL(close_table)(that);
- PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+ PSI_CALL(drop_table_share)(false,
+ table_share.db.str, table_share.db.length,
table_share.table_name.str, table_share.table_name.length);
diag("TABLE_IO benchmark: %s, object %s, %d calls, %13llu cycles, %13llu avg",
@@ -628,7 +632,8 @@ void benchmark_table_lock(uint count, co
// ok(get_work_done() == count, "work done");
PSI_CALL(close_table)(that);
- PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+ PSI_CALL(drop_table_share)(false,
+ table_share.db.str, table_share.db.length,
table_share.table_name.str, table_share.table_name.length);
diag("TABLE_LOCK benchmark: %s, object %s, %d calls, %13llu cycles, %13llu avg",
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3460 to 3462) | Marc Alff | 9 Jan |