List:Commits« Previous MessageNext Message »
From:vasil.dimov Date:June 29 2010 7:21am
Subject:bzr commit into mysql-next-mr-persistent-stats branch (vasil.dimov:3240)
View as plain text  
#At file:///usr/local/devel/bzrroot/server/mysql-next-mr-persistent-stats/ based on revid:vasil.dimov@stripped

 3240 Vasil Dimov	2010-06-29
      Add a new mysql-test to test DROPping locked stats
      
      DROP TABLE and ALTER TABLE DROP INDEX are supposed to remove rows
      from the user-visible stats tables. If those corresponding rows
      are locked by the user, then the behavior should be to emit an
      explanatory warning and skip the removal of those rows.

    added:
      mysql-test/suite/innodb/r/innodb_stats_drop_locked.result
      mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
=== added file 'mysql-test/suite/innodb/r/innodb_stats_drop_locked.result'
--- a/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result	revid:vasil.dimov@stripped
@@ -0,0 +1,47 @@
+Table	Op	Msg_type	Msg_text
+test.innodb_stats_drop_locked	analyze	status	OK
+SET autocommit=0;
+SELECT table_name FROM innodb.table_stats
+WHERE table_name='innodb_stats_drop_locked'
+FOR UPDATE;
+table_name
+innodb_stats_drop_locked
+SELECT table_name FROM innodb.index_stats
+WHERE table_name='innodb_stats_drop_locked'
+FOR UPDATE;
+table_name
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+ALTER TABLE innodb_stats_drop_locked DROP INDEX c_key;
+Warnings:
+Warning	1205	Unable to instantly delete statistics for index c_key from innodb.index_stats because the rows are locked. They can be deleted later using DELETE FROM innodb.index_stats WHERE database_name = 'test' AND table_name = 'innodb_stats_drop_locked' AND index_name = 'c_key';
+SHOW CREATE TABLE innodb_stats_drop_locked;
+Table	Create Table
+innodb_stats_drop_locked	CREATE TABLE `innodb_stats_drop_locked` (
+  `c` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE innodb_stats_drop_locked;
+Warnings:
+Warning	1205	Unable to instantly delete statistics for table test.innodb_stats_drop_locked from innodb.table_stats or innodb.index_stats because the rows are locked. They can be deleted later using DELETE FROM innodb.index_stats WHERE database_name = 'test' AND table_name = 'innodb_stats_drop_locked'; DELETE FROM innodb.table_stats WHERE database_name = 'test' AND table_name = 'innodb_stats_drop_locked';
+SHOW TABLES;
+Tables_in_test
+COMMIT;
+SELECT table_name FROM innodb.table_stats 
+WHERE table_name='innodb_stats_drop_locked';
+table_name
+innodb_stats_drop_locked
+SELECT table_name FROM innodb.index_stats
+WHERE table_name='innodb_stats_drop_locked';
+table_name
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked
+innodb_stats_drop_locked

=== added file 'mysql-test/suite/innodb/t/innodb_stats_drop_locked.test'
--- a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test	revid:vasil.dimov@stripped
@@ -0,0 +1,62 @@
+#
+# Test the persistent stats feature when DROPping a table or an
+# index when the corresponding rows in the stats tables are locked
+#
+
+-- source include/have_innodb.inc
+-- source suite/innodb/include/innodb_stats_bootstrap.inc
+
+-- disable_warnings
+-- disable_query_log
+
+SET SESSION innodb_analyze_is_persistent=1;
+
+DROP TABLE IF EXISTS innodb_stats_drop_locked;
+
+CREATE TABLE innodb_stats_drop_locked (c INT, KEY c_key (c)) ENGINE=INNODB;
+
+ANALYZE TABLE innodb_stats_drop_locked;
+
+-- enable_warnings
+-- enable_query_log
+
+SET autocommit=0;
+
+SELECT table_name FROM innodb.table_stats
+WHERE table_name='innodb_stats_drop_locked'
+FOR UPDATE;
+
+SELECT table_name FROM innodb.index_stats
+WHERE table_name='innodb_stats_drop_locked'
+FOR UPDATE;
+
+-- connect (con1,localhost,root,,)
+
+-- connection con1
+
+ALTER TABLE innodb_stats_drop_locked DROP INDEX c_key;
+
+# the index should be gone
+SHOW CREATE TABLE innodb_stats_drop_locked;
+
+DROP TABLE innodb_stats_drop_locked;
+
+# the table should be gone
+SHOW TABLES;
+
+-- connection default
+
+-- disconnect con1
+
+COMMIT;
+
+# the stats should be there
+
+SELECT table_name FROM innodb.table_stats 
+WHERE table_name='innodb_stats_drop_locked';
+
+SELECT table_name FROM innodb.index_stats
+WHERE table_name='innodb_stats_drop_locked';
+
+-- disable_query_log
+DROP DATABASE innodb;


Attachment: [text/bzr-bundle] bzr/vasil.dimov@oracle.com-20100629071153-prx127v406c1c5e0.bundle
Thread
bzr commit into mysql-next-mr-persistent-stats branch (vasil.dimov:3240) vasil.dimov29 Jun