List:Commits« Previous MessageNext Message »
From:vasil.dimov Date:March 18 2011 12:56pm
Subject:bzr commit into mysql-trunk-innodb branch (vasil.dimov:3545)
View as plain text  
#At file:///usr/local/devel/bzrroot/server/mysql-trunk-innodb/ based on revid:vasil.dimov@stripped

 3545 Vasil Dimov	2011-03-18
      Adjust stats column type when fetching from persistent stats
      
      When charset of the table is set to UTF8 then VARCHAR(N) columns do not
      come to InnoDB as DATA_VARCHAR, but as DATA_VARMYSQL.
      
      Also extend the testcase to cover this code path.
      This is a followup to vasil.dimov@stripped
      
      Reported by:	Michael

    modified:
      mysql-test/suite/innodb/include/innodb_stats.inc
      mysql-test/suite/innodb/r/innodb_stats.result
      storage/innobase/dict/dict0stats.c
=== modified file 'mysql-test/suite/innodb/include/innodb_stats.inc'
--- a/mysql-test/suite/innodb/include/innodb_stats.inc	revid:vasil.dimov@stripped
+++ b/mysql-test/suite/innodb/include/innodb_stats.inc	revid:vasil.dimov@stripped
@@ -16,3 +16,11 @@ table_name = 'test_innodb_stats' AND
 index_name = 'a_key' AND
 stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size')
 ORDER BY stat_name;
+
+# provoke reading from persistent storage from
+# row_update_statistics_if_needed()
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+
+# see what has been read
+query_vertical SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';

=== modified file 'mysql-test/suite/innodb/r/innodb_stats.result'
--- a/mysql-test/suite/innodb/r/innodb_stats.result	revid:vasil.dimov@stripped
+++ b/mysql-test/suite/innodb/r/innodb_stats.result	revid:vasil.dimov@stripped
@@ -33,6 +33,25 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	0
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	
 DELETE FROM test_innodb_stats;
 INSERT INTO test_innodb_stats (a) VALUES (1);
 ANALYZE TABLE test_innodb_stats;
@@ -66,6 +85,25 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	1
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	
 DELETE FROM test_innodb_stats;
 INSERT INTO test_innodb_stats (a) VALUES (1), (1);
 ANALYZE TABLE test_innodb_stats;
@@ -99,6 +137,25 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	2
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	
 DELETE FROM test_innodb_stats;
 INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1);
 ANALYZE TABLE test_innodb_stats;
@@ -132,6 +189,25 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	3
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	
 DELETE FROM test_innodb_stats;
 INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1), (1), (1), (1), (1), (1), (1), (1);
 ANALYZE TABLE test_innodb_stats;
@@ -165,6 +241,25 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	2
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	
 DELETE FROM test_innodb_stats;
 INSERT INTO test_innodb_stats (a) VALUES (1), (2);
 ANALYZE TABLE test_innodb_stats;
@@ -198,6 +293,25 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	2
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	
 DELETE FROM test_innodb_stats;
 INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2);
 ANALYZE TABLE test_innodb_stats;
@@ -231,6 +345,25 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	3
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	
 DELETE FROM test_innodb_stats;
 INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3);
 ANALYZE TABLE test_innodb_stats;
@@ -264,6 +397,25 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	3
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	
 DELETE FROM test_innodb_stats;
 INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2), (3), (3);
 ANALYZE TABLE test_innodb_stats;
@@ -297,6 +449,25 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	5
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	
 DELETE FROM test_innodb_stats;
 INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3), (4), (5), (1), (2), (3), (4), (5);
 ANALYZE TABLE test_innodb_stats;
@@ -330,3 +501,22 @@ stat_name	size
 stat_value	1
 sample_size	NULL
 stat_description	Number of pages in the index
+INSERT INTO test_innodb_stats SELECT * FROM test_innodb_stats;
+SELECT * FROM information_schema.statistics
+WHERE table_name = 'test_innodb_stats';
+TABLE_CATALOG	def
+TABLE_SCHEMA	test
+TABLE_NAME	test_innodb_stats
+NON_UNIQUE	1
+INDEX_SCHEMA	test
+INDEX_NAME	a_key
+SEQ_IN_INDEX	1
+COLUMN_NAME	a
+COLLATION	A
+CARDINALITY	10
+SUB_PART	NULL
+PACKED	NULL
+NULLABLE	YES
+INDEX_TYPE	BTREE
+COMMENT	
+INDEX_COMMENT	

=== modified file 'storage/innobase/dict/dict0stats.c'
--- a/storage/innobase/dict/dict0stats.c	revid:vasil.dimov@stripped
+++ b/storage/innobase/dict/dict0stats.c	revid:vasil.dimov@stripped
@@ -1798,7 +1798,7 @@ dict_stats_fetch_index_stats_step(
 		switch (i) {
 		case 0: /* innodb.index_stats.index_name */
 
-			ut_a(dtype_get_mtype(type) == DATA_VARCHAR);
+			ut_a(dtype_get_mtype(type) == DATA_VARMYSQL);
 
 			/* search for index in table's indexes whose name
 			matches data; the fetched index name is in data,
@@ -1829,7 +1829,7 @@ dict_stats_fetch_index_stats_step(
 
 		case 1: /* innodb.index_stats.stat_name */
 
-			ut_a(dtype_get_mtype(type) == DATA_VARCHAR);
+			ut_a(dtype_get_mtype(type) == DATA_VARMYSQL);
 
 			ut_a(index != NULL);
 


Attachment: [text/bzr-bundle] bzr/vasil.dimov@oracle.com-20110318124938-91ga4s7snxxl03fo.bundle
Thread
bzr commit into mysql-trunk-innodb branch (vasil.dimov:3545) vasil.dimov18 Mar