3182 Sergey Vojtovich 2010-08-27 [merge]
Merge 5.5-merge to trunk-merge.
modified:
client/mysqltest.cc
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/t/disabled.def
sql/sql_select.cc
sql/sql_show.cc
3181 Alexander Nozdrin 2010-08-26 [merge]
Manual merge from mysql-5.5-merge.
Conflicts:
- sql/log.h (the change applied to binlog.h)
added:
mysql-test/include/not_blackhole.inc
mysql-test/r/partition_not_blackhole.result
mysql-test/std_data/parts/t1_blackhole.frm
mysql-test/std_data/parts/t1_blackhole.par
mysql-test/t/partition_not_blackhole-master.opt
mysql-test/t/partition_not_blackhole.test
modified:
mysql-test/r/func_gconcat.result
mysql-test/r/func_misc.result
mysql-test/r/range.result
mysql-test/suite/rpl/t/rpl_drop.test
mysql-test/t/func_gconcat.test
mysql-test/t/func_misc.test
mysql-test/t/range.test
sql/binlog.h
sql/ha_partition.cc
sql/item_func.cc
sql/item_sum.cc
sql/log.cc
sql/mysqld.cc
sql/opt_range.cc
sql/table.h
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2010-08-16 07:22:36 +0000
+++ b/client/mysqltest.cc 2010-08-27 12:17:32 +0000
@@ -6230,8 +6230,10 @@ get_one_option(int optid, const struct m
print_version();
exit(0);
case OPT_MYSQL_PROTOCOL:
+#ifndef EMBEDDED_LIBRARY
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
+#endif
break;
case '?':
usage();
=== modified file 'mysql-test/suite/innodb/r/innodb_mysql.result'
--- a/mysql-test/suite/innodb/r/innodb_mysql.result 2010-08-20 11:22:46 +0000
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result 2010-08-27 11:33:32 +0000
@@ -2546,6 +2546,64 @@ LOCK TABLES t1 READ;
ALTER TABLE t1 COMMENT 'test';
UNLOCK TABLES;
DROP TABLE t1;
+#
+# Bug#55656: mysqldump can be slower after bug #39653 fix
+#
+CREATE TABLE t1 (a INT , b INT, c INT, d INT,
+KEY (b), PRIMARY KEY (a,b)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3);
+EXPLAIN SELECT COUNT(*) FROM t1;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 4
+ref NULL
+rows 3
+Extra Using index
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b);
+EXPLAIN SELECT COUNT(*) FROM t1;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 8
+ref NULL
+rows 3
+Extra Using index
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b,c);
+EXPLAIN SELECT COUNT(*) FROM t1;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 13
+ref NULL
+rows 3
+Extra Using index
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b,c,d);
+EXPLAIN SELECT COUNT(*) FROM t1;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key PRIMARY
+key_len 8
+ref NULL
+rows 3
+Extra Using index
+DROP TABLE t1;
+#
End of 5.1 tests
#
# Test for bug #39932 "create table fails if column for FK is in different
=== modified file 'mysql-test/suite/innodb/t/innodb_mysql.test'
--- a/mysql-test/suite/innodb/t/innodb_mysql.test 2010-08-26 14:29:22 +0000
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test 2010-08-27 12:17:32 +0000
@@ -746,6 +746,30 @@ UNLOCK TABLES;
DROP TABLE t1;
+--echo #
+--echo # Bug#55656: mysqldump can be slower after bug #39653 fix
+--echo #
+
+CREATE TABLE t1 (a INT , b INT, c INT, d INT,
+ KEY (b), PRIMARY KEY (a,b)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3);
+--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
+
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b);
+--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
+
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b,c);
+--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
+
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b,c,d);
+--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
+
+DROP TABLE t1;
+
+--echo #
--echo End of 5.1 tests
=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def 2010-08-13 10:10:01 +0000
+++ b/mysql-test/t/disabled.def 2010-08-27 12:17:32 +0000
@@ -14,8 +14,5 @@ lowercase_table3 : Bug#54845 201
mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst
mysqlhotcopy_archive : bug#54129 2010-06-04 Horst
partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings
-plugin : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5
-plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5
-plugin_not_embedded : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2010-08-18 07:20:58 +0000
+++ b/sql/sql_select.cc 2010-08-27 12:17:32 +0000
@@ -13189,6 +13189,34 @@ ok:
}
+/**
+ Find shortest key suitable for full table scan.
+
+ @param table Table to scan
+ @param usable_keys Allowed keys
+
+ @note
+ As far as
+ 1) clustered primary key entry data set is a set of all record
+ fields (key fields and not key fields) and
+ 2) secondary index entry data is a union of its key fields and
+ primary key fields (at least InnoDB and its derivatives don't
+ duplicate primary key fields there, even if the primary and
+ the secondary keys have a common subset of key fields),
+ then secondary index entry data is always a subset of primary key entry.
+ Unfortunately, key_info[nr].key_length doesn't show the length
+ of key/pointer pair but a sum of key field lengths only, thus
+ we can't estimate index IO volume comparing only this key_length
+ value of secondary keys and clustered PK.
+ So, try secondary keys first, and choose PK only if there are no
+ usable secondary covering keys or found best secondary key include
+ all table fields (i.e. same as PK):
+
+ @return
+ MAX_KEY no suitable key found
+ key index otherwise
+*/
+
uint find_shortest_key(TABLE *table, const key_map *usable_keys)
{
uint best= MAX_KEY;
@@ -13201,23 +13229,6 @@ uint find_shortest_key(TABLE *table, con
uint min_length= (uint) ~0;
for (uint nr=0; nr < table->s->keys ; nr++)
{
- /*
- As far as
- 1) clustered primary key entry data set is a set of all record
- fields (key fields and not key fields) and
- 2) secondary index entry data is a union of its key fields and
- primary key fields (at least InnoDB and its derivatives don't
- duplicate primary key fields there, even if the primary and
- the secondary keys have a common subset of key fields),
- then secondary index entry data is always a subset of primary key
- entry, and the PK is always longer.
- Unfortunately, key_info[nr].key_length doesn't show the length
- of key/pointer pair but a sum of key field lengths only, thus
- we can't estimate index IO volume comparing only this key_length
- value of seconday keys and clustered PK.
- So, try secondary keys first, and choose PK only if there are no
- usable secondary covering keys:
- */
if (nr == usable_clustered_pk)
continue;
if (usable_keys->is_set(nr))
@@ -13230,7 +13241,20 @@ uint find_shortest_key(TABLE *table, con
}
}
}
- return best != MAX_KEY ? best : usable_clustered_pk;
+ if (usable_clustered_pk != MAX_KEY)
+ {
+ /*
+ If the primary key is clustered and found shorter key covers all table
+ fields then primary key scan normally would be faster because amount of
+ data to scan is the same but PK is clustered.
+ It's safe to compare key parts with table fields since duplicate key
+ parts aren't allowed.
+ */
+ if (best == MAX_KEY ||
+ table->key_info[best].key_parts >= table->s->fields)
+ best= usable_clustered_pk;
+ }
+ return best;
}
/**
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2010-08-05 13:10:22 +0000
+++ b/sql/sql_show.cc 2010-08-27 12:17:32 +0000
@@ -7490,13 +7490,16 @@ int finalize_schema_table(st_plugin_int
ST_SCHEMA_TABLE *schema_table= (ST_SCHEMA_TABLE *)plugin->data;
DBUG_ENTER("finalize_schema_table");
- if (schema_table && plugin->plugin->deinit)
+ if (schema_table)
{
- DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
- if (plugin->plugin->deinit(NULL))
+ if (plugin->plugin->deinit)
{
- DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
- plugin->name.str));
+ DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
+ if (plugin->plugin->deinit(NULL))
+ {
+ DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
+ plugin->name.str));
+ }
}
my_free(schema_table);
}
Attachment: [text/bzr-bundle] bzr/svoj@sun.com-20100827121732-3whu1gtmsuzn4zyy.bundle
| Thread |
|---|
| • bzr push into mysql-trunk-merge branch (svoj:3181 to 3182) | Sergey Vojtovich | 27 Aug |