1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

10.0-base merge

This commit is contained in:
Sergei Golubchik
2014-03-05 23:20:10 +01:00
10 changed files with 161 additions and 9 deletions

View File

@@ -4005,6 +4005,12 @@ static int dump_tablespaces(char* ts_where)
char *endsemi; char *endsemi;
DBUG_ENTER("dump_tablespaces"); DBUG_ENTER("dump_tablespaces");
/*
Try to turn off semi-join optimization (if that fails, this is a
pre-optimizer_switch server, and the old query plan is ok for us.
*/
mysql_query(mysql, "set optimizer_switch='semijoin=off'");
init_dynamic_string_checked(&sqlbuf, init_dynamic_string_checked(&sqlbuf,
"SELECT LOGFILE_GROUP_NAME," "SELECT LOGFILE_GROUP_NAME,"
" FILE_NAME," " FILE_NAME,"
@@ -4164,6 +4170,8 @@ static int dump_tablespaces(char* ts_where)
mysql_free_result(tableres); mysql_free_result(tableres);
dynstr_free(&sqlbuf); dynstr_free(&sqlbuf);
mysql_query(mysql, "set optimizer_switch=default");
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@@ -1985,3 +1985,45 @@ drop database mysqltest;
# #
# End of 5.5 tests # End of 5.5 tests
# #
#
# MDEV-5723: mysqldump -uroot unusable for multi-database operations, checks all databases
#
drop database if exists db1;
create database db1;
use db1;
create table t1 (a int);
create table t2 (a int);
create table t3 (a int);
create database mysqltest;
use mysqltest;
create table t1 (a int);
create table t2 (a int);
create table t3 (a int);
flush tables;
flush status;
SELECT
LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA
FROM
INFORMATION_SCHEMA.FILES
WHERE
FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND
LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME
FROM INFORMATION_SCHEMA.FILES
WHERE
FILE_TYPE = 'DATAFILE' AND
TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME
FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_SCHEMA IN ('db1')
)
)
GROUP BY
LOGFILE_GROUP_NAME, FILE_NAME, ENGINE
ORDER BY
LOGFILE_GROUP_NAME;
LOGFILE_GROUP_NAME FILE_NAME TOTAL_EXTENTS INITIAL_SIZE ENGINE EXTRA
# This must have Opened_tables=3, not 6.
show status like 'Opened_tables';
Variable_name Value
Opened_tables 3
drop database mysqltest;
drop database db1;

View File

@@ -327,7 +327,7 @@ from lineitem use index (i_l_shipdate, i_l_receiptdate)
where l_shipdate='1992-07-01' and l_orderkey=130 where l_shipdate='1992-07-01' and l_orderkey=130
or l_receiptdate='1992-07-01' and l_orderkey=5603; or l_receiptdate='1992-07-01' and l_orderkey=5603;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where 1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using union(i_l_shipdate,i_l_receiptdate); Using where
flush status; flush status;
select l_orderkey, l_linenumber select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate) from lineitem use index (i_l_shipdate, i_l_receiptdate)

View File

@@ -1538,3 +1538,14 @@ a
3 3
4 4
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# MDEV-5635: join of a const table with non-const tables
#
CREATE TABLE t1 (a varchar(3) NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('foo');
CREATE TABLE t2 (b varchar(3), c varchar(3), INDEX(b)) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('bar', 'bar'),( 'qux', 'qux');
SELECT STRAIGHT_JOIN * FROM t1, t2 AS t2_1, t2 AS t2_2
WHERE t2_2.c = t2_1.c AND t2_2.b = t2_1.b AND ( a IS NULL OR t2_1.c = a );
a b c b c
DROP TABLE t1,t2;

View File

@@ -1816,5 +1816,61 @@ drop database mysqltest;
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
--echo #
--echo # MDEV-5723: mysqldump -uroot unusable for multi-database operations, checks all databases
--echo #
--disable_warnings
drop database if exists db1;
--enable_warnings
connect (con1,localhost,root,,);
connection con1;
create database db1;
use db1;
create table t1 (a int);
create table t2 (a int);
create table t3 (a int);
create database mysqltest;
use mysqltest;
create table t1 (a int);
create table t2 (a int);
create table t3 (a int);
flush tables;
flush status;
SELECT
LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA
FROM
INFORMATION_SCHEMA.FILES
WHERE
FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND
LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME
FROM INFORMATION_SCHEMA.FILES
WHERE
FILE_TYPE = 'DATAFILE' AND
TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME
FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_SCHEMA IN ('db1')
)
)
GROUP BY
LOGFILE_GROUP_NAME, FILE_NAME, ENGINE
ORDER BY
LOGFILE_GROUP_NAME;
--echo # This must have Opened_tables=3, not 6.
show status like 'Opened_tables';
drop database mysqltest;
drop database db1;
connection default;
disconnect con1;
# Wait till all disconnects are completed # Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc

View File

@@ -1185,3 +1185,18 @@ SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;
SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a; SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;
DROP TABLE t1,t2; DROP TABLE t1,t2;
--echo #
--echo # MDEV-5635: join of a const table with non-const tables
--echo #
CREATE TABLE t1 (a varchar(3) NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('foo');
CREATE TABLE t2 (b varchar(3), c varchar(3), INDEX(b)) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('bar', 'bar'),( 'qux', 'qux');
SELECT STRAIGHT_JOIN * FROM t1, t2 AS t2_1, t2 AS t2_2
WHERE t2_2.c = t2_1.c AND t2_2.b = t2_1.b AND ( a IS NULL OR t2_1.c = a );
DROP TABLE t1,t2;

View File

@@ -7967,6 +7967,7 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond)
value= cond_func->arg_count > 1 ? cond_func->arguments()[1] : NULL; value= cond_func->arg_count > 1 ? cond_func->arguments()[1] : NULL;
if (value && value->is_expensive()) if (value && value->is_expensive())
DBUG_RETURN(0); DBUG_RETURN(0);
if (!cond_func->arguments()[0]->real_item()->const_item())
ftree= get_full_func_mm_tree(param, cond_func, field_item, value, inv); ftree= get_full_func_mm_tree(param, cond_func, field_item, value, inv);
} }
/* /*
@@ -7992,6 +7993,7 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond)
value= cond_func->arguments()[0]; value= cond_func->arguments()[0];
if (value && value->is_expensive()) if (value && value->is_expensive())
DBUG_RETURN(0); DBUG_RETURN(0);
if (!cond_func->arguments()[1]->real_item()->const_item())
ftree= get_full_func_mm_tree(param, cond_func, field_item, value, inv); ftree= get_full_func_mm_tree(param, cond_func, field_item, value, inv);
} }
} }
@@ -10630,7 +10632,12 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts)
return FALSE; return FALSE;
} }
if (key_part == key_part_end) /*
If there are equalities for all key parts, it is a ROR scan. If there are
equalities all keyparts and even some of key parts from "Extended Key"
index suffix, it is a ROR-scan, too.
*/
if (key_part >= key_part_end)
return TRUE; return TRUE;
key_part= table_key->key_part + nparts; key_part= table_key->key_part + nparts;

View File

@@ -1343,6 +1343,7 @@ bool is_network_error(uint errorno)
errorno == ER_CON_COUNT_ERROR || errorno == ER_CON_COUNT_ERROR ||
errorno == ER_CONNECTION_KILLED || errorno == ER_CONNECTION_KILLED ||
errorno == ER_NEW_ABORTING_CONNECTION || errorno == ER_NEW_ABORTING_CONNECTION ||
errorno == ER_NET_READ_INTERRUPTED ||
errorno == ER_SERVER_SHUTDOWN) errorno == ER_SERVER_SHUTDOWN)
return TRUE; return TRUE;

View File

@@ -19476,7 +19476,7 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
for (; const_key_parts & 1 ; const_key_parts>>= 1) for (; const_key_parts & 1 ; const_key_parts>>= 1)
key_part++; key_part++;
if (key_part == key_part_end) if (key_part >= key_part_end)
{ {
/* /*
We are at the end of the key. Check if the engine has the primary We are at the end of the key. Check if the engine has the primary

View File

@@ -8062,8 +8062,20 @@ static bool do_fill_table(THD *thd,
da->push_warning_info(&wi_tmp); da->push_warning_info(&wi_tmp);
bool res= table_list->schema_table->fill_table( Item *item= join_table->select_cond;
thd, table_list, join_table->select_cond); if (join_table->cache_select &&
join_table->cache_select->cond)
{
/*
If join buffering is used, we should use the condition that is attached
to the join cache. Cache condition has a part of WHERE that can be
checked when we're populating this table.
join_tab->select_cond is of no interest, because it only has conditions
that depend on both this table and previous tables in the join order.
*/
item= join_table->cache_select->cond;
}
bool res= table_list->schema_table->fill_table(thd, table_list, item);
da->pop_warning_info(); da->pop_warning_info();