List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:October 17 2012 10:57pm
Subject:bzr push into mysql-5.6 branch (chris.powers:4498 to 4499) Bug#14728422
View as plain text  
 4499 Christopher Powers	2012-10-17
      Bug#14728422 CRASH WHEN TRUNCATING PERFORMANCE_SCHEMA TABLES AND P_S IS DISABLED
      
      If the Performance Schema is not initialized, then disable SELECT, INSERT, UPDATE,
      DELETE and TRUNCATE for all Performance Schema tables.
      
      Return an error for INSERT. Otherwise, no error is returned because target row(s)
      will not be found.

    modified:
      mysql-test/suite/perfschema/r/start_server_off.result
      mysql-test/suite/perfschema/t/start_server_off.test
      storage/perfschema/ha_perfschema.cc
 4498 Tor Didriksen	2012-10-17
      Bug#14689561 - SERVER CRASH ON CONNECTING CLIENT 
      
      Post-push fix: We must call hash_filo::clear() to initialize
      the mutex, before calling resize(0).

    modified:
      unittest/gunit/segfault-t.cc
=== modified file 'mysql-test/suite/perfschema/r/start_server_off.result'
--- a/mysql-test/suite/perfschema/r/start_server_off.result	2012-09-11 17:35:40 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_off.result	2012-10-17 22:41:08 +0000
@@ -7,16 +7,16 @@ performance_schema
 test
 select count(*) from performance_schema.performance_timers;
 count(*)
-5
+0
 select count(*) from performance_schema.setup_consumers;
 count(*)
-12
+0
 select count(*) > 3 from performance_schema.setup_instruments;
 count(*) > 3
 0
 select count(*) from performance_schema.setup_timers;
 count(*)
-4
+0
 select * from performance_schema.accounts;
 select * from performance_schema.cond_instances;
 select * from performance_schema.events_stages_current;
@@ -131,18 +131,6 @@ Performance_schema_thread_instances_lost
 Performance_schema_users_lost	0
 select * from performance_schema.setup_consumers;
 NAME	ENABLED
-events_stages_current	NO
-events_stages_history	NO
-events_stages_history_long	NO
-events_statements_current	NO
-events_statements_history	NO
-events_statements_history_long	NO
-events_waits_current	NO
-events_waits_history	NO
-events_waits_history_long	NO
-global_instrumentation	NO
-thread_instrumentation	NO
-statements_digest	YES
 select * from performance_schema.setup_instruments;
 NAME	ENABLED	TIMED
 select * from performance_schema.setup_actors;
@@ -151,7 +139,20 @@ select * from performance_schema.setup_o
 OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	ENABLED	TIMED
 select * from performance_schema.setup_timers;
 NAME	TIMER_NAME
-idle	MICROSECOND
-wait	CYCLE
-stage	NANOSECOND
-statement	NANOSECOND
+insert into performance_schema.setup_objects values ('TABLE', 'myschema', 'myobject', 'YES', 'YES');
+ERROR HY000: Invalid performance_schema usage.
+insert into performance_schema.setup_actors values ('myhost', 'mysuser', 'myrole');
+ERROR HY000: Invalid performance_schema usage.
+select * from performance_schema.setup_objects;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	ENABLED	TIMED
+update performance_schema.setup_objects set OBJECT_NAME = 'myobject';
+delete from performance_schema.setup_objects;
+select * from performance_schema.setup_actors;
+HOST	USER	ROLE
+update performance_schema.setup_actors set HOST = 'myhost';
+delete from performance_schema.setup_actors;
+truncate performance_schema.events_stages_history_long;
+truncate performance_schema.events_statements_history_long;
+truncate performance_schema.events_waits_history_long;
+truncate performance_schema.setup_objects;
+truncate performance_schema.setup_actors;

=== modified file 'mysql-test/suite/perfschema/t/start_server_off.test'
--- a/mysql-test/suite/perfschema/t/start_server_off.test	2011-11-18 16:49:29 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_off.test	2012-10-17 22:41:08 +0000
@@ -19,3 +19,30 @@ select * from performance_schema.setup_i
 select * from performance_schema.setup_actors;
 select * from performance_schema.setup_objects;
 select * from performance_schema.setup_timers;
+
+# Expect INSERT to fail with an error
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+insert into performance_schema.setup_objects values ('TABLE', 'myschema', 'myobject', 'YES', 'YES');
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+insert into performance_schema.setup_actors values ('myhost', 'mysuser', 'myrole');
+
+# Expect SELECT, UPDATE, DELETE and TRUNCATE to affect 0 rows, but with
+# no error because the target row(s) will not be found
+
+select * from performance_schema.setup_objects;
+update performance_schema.setup_objects set OBJECT_NAME = 'myobject';
+delete from performance_schema.setup_objects;
+
+select * from performance_schema.setup_actors;
+update performance_schema.setup_actors set HOST = 'myhost';
+delete from performance_schema.setup_actors;
+
+truncate performance_schema.events_stages_history_long;
+truncate performance_schema.events_statements_history_long;
+truncate performance_schema.events_waits_history_long;
+truncate performance_schema.setup_objects;
+truncate performance_schema.setup_actors;
+
+

=== modified file 'storage/perfschema/ha_perfschema.cc'
--- a/storage/perfschema/ha_perfschema.cc	2012-05-31 15:15:33 +0000
+++ b/storage/perfschema/ha_perfschema.cc	2012-10-17 22:41:08 +0000
@@ -240,12 +240,12 @@ int ha_perfschema::write_row(uchar *buf)
   int result;
 
   DBUG_ENTER("ha_perfschema::write_row");
+  if (!pfs_initialized)
+    DBUG_RETURN(HA_ERR_WRONG_COMMAND);
 
-  ha_statistic_increment(&SSV::ha_write_count);
   DBUG_ASSERT(m_table_share);
-
+  ha_statistic_increment(&SSV::ha_write_count);
   result= m_table_share->write_row(table, buf, table->field);
-
   DBUG_RETURN(result);
 }
 
@@ -263,7 +263,9 @@ void ha_perfschema::use_hidden_primary_k
 int ha_perfschema::update_row(const uchar *old_data, uchar *new_data)
 {
   DBUG_ENTER("ha_perfschema::update_row");
-
+  if (!pfs_initialized)
+    DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+  
   DBUG_ASSERT(m_table);
   ha_statistic_increment(&SSV::ha_update_count);
   int result= m_table->update_row(table, old_data, new_data, table->field);
@@ -273,6 +275,8 @@ int ha_perfschema::update_row(const ucha
 int ha_perfschema::delete_row(const uchar *buf)
 {
   DBUG_ENTER("ha_perfschema::delete_row");
+  if (!pfs_initialized)
+    DBUG_RETURN(HA_ERR_WRONG_COMMAND);
 
   DBUG_ASSERT(m_table);
   ha_statistic_increment(&SSV::ha_delete_count);
@@ -313,6 +317,8 @@ int ha_perfschema::rnd_end(void)
 int ha_perfschema::rnd_next(uchar *buf)
 {
   DBUG_ENTER("ha_perfschema::rnd_next");
+  if (!pfs_initialized)
+    DBUG_RETURN(HA_ERR_END_OF_FILE);
 
   DBUG_ASSERT(m_table);
   ha_statistic_increment(&SSV::ha_read_rnd_next_count);
@@ -339,6 +345,8 @@ void ha_perfschema::position(const uchar
 int ha_perfschema::rnd_pos(uchar *buf, uchar *pos)
 {
   DBUG_ENTER("ha_perfschema::rnd_pos");
+  if (!pfs_initialized)
+    DBUG_RETURN(HA_ERR_END_OF_FILE);
 
   DBUG_ASSERT(m_table);
   ha_statistic_increment(&SSV::ha_read_rnd_count);
@@ -364,6 +372,8 @@ int ha_perfschema::delete_all_rows(void)
   int result;
 
   DBUG_ENTER("ha_perfschema::delete_all_rows");
+  if (!pfs_initialized)
+    DBUG_RETURN(0);
 
   DBUG_ASSERT(m_table_share);
   if (m_table_share->m_delete_all_rows)

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.6 branch (chris.powers:4498 to 4499) Bug#14728422Christopher Powers18 Oct