Commit 983cda8d authored by unknown's avatar unknown

Merge olga.mysql.com:/home/igor/mysql-5.0

into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-merge


sql/mysqld.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
parents a150ca33 71c3c0cf
...@@ -3995,4 +3995,14 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -3995,4 +3995,14 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE f1 index inx inx 10 NULL 7 Using where; Using index 1 SIMPLE f1 index inx inx 10 NULL 7 Using where; Using index
1 SIMPLE f2 ref inx inx 5 test.f1.b 1 Using where; Using index 1 SIMPLE f2 ref inx inx 5 test.f1.b 1 Using where; Using index
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (c1 INT, c2 INT);
INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2)))))))))))))))))))))))))))))))) > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
32 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) > 0;
ERROR HY000: Too high level of nesting for select
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
...@@ -14,6 +14,22 @@ connection slave; ...@@ -14,6 +14,22 @@ connection slave;
reset slave; reset slave;
start slave io_thread; start slave io_thread;
# Give the I/O thread time to block. # Give the I/O thread time to block.
let $run= 1;
let $counter= 300;
while ($run)
{
let $io_state= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1);
if (`SELECT '$io_state' = 'Waiting for the slave SQL thread to free enough relay log space'`){
let $run= 0;
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave IO thread block"
SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
sleep 2; sleep 2;
# A bug caused the I/O thread to refuse stopping. # A bug caused the I/O thread to refuse stopping.
stop slave io_thread; stop slave io_thread;
......
...@@ -3370,4 +3370,34 @@ EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2 ...@@ -3370,4 +3370,34 @@ EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2
WHERE 1 AND f1.b NOT IN (100,2232,3343,51111); WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
DROP TABLE t1; DROP TABLE t1;
#
# Bug #27352: Incorrect result of nested selects instead of error reporting
#
CREATE TABLE t1 (c1 INT, c2 INT);
INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
let $n= 31;
let $q= COUNT(c2);
while ($n)
{
let $q= (SELECT $q);
dec $n;
}
--disable_warnings
eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;
--enable_warnings
let $n= 64;
let $q= COUNT(c2);
while ($n)
{
let $q= (SELECT $q);
dec $n;
}
--error ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;
DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -4828,7 +4828,8 @@ enum options_mysqld ...@@ -4828,7 +4828,8 @@ enum options_mysqld
OPT_PORT_OPEN_TIMEOUT, OPT_PORT_OPEN_TIMEOUT,
OPT_MERGE, OPT_MERGE,
OPT_INNODB_ROLLBACK_ON_TIMEOUT, OPT_INNODB_ROLLBACK_ON_TIMEOUT,
OPT_SECURE_FILE_PRIV OPT_SECURE_FILE_PRIV,
OPT_KEEP_FILES_ON_CREATE
}; };
...@@ -5830,6 +5831,11 @@ log and this option does nothing anymore.", ...@@ -5830,6 +5831,11 @@ log and this option does nothing anymore.",
(gptr*) &max_system_variables.join_buff_size, 0, GET_ULONG, (gptr*) &max_system_variables.join_buff_size, 0, GET_ULONG,
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD,
IO_SIZE, 0}, IO_SIZE, 0},
{"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE,
"Don't overwrite stale .MYD and .MYI even if no directory is specified.",
(gptr*) &global_system_variables.keep_files_on_create,
(gptr*) &max_system_variables.keep_files_on_create,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"key_buffer_size", OPT_KEY_BUFFER_SIZE, {"key_buffer_size", OPT_KEY_BUFFER_SIZE,
"The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.", "The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
(gptr*) &dflt_key_cache_var.param_buff_size, (gptr*) &dflt_key_cache_var.param_buff_size,
......
...@@ -5635,3 +5635,5 @@ ER_NON_INSERTABLE_TABLE ...@@ -5635,3 +5635,5 @@ ER_NON_INSERTABLE_TABLE
eng "The target table %-.100s of the %s is not insertable-into" eng "The target table %-.100s of the %s is not insertable-into"
ER_ADMIN_WRONG_MRG_TABLE ER_ADMIN_WRONG_MRG_TABLE
eng "Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist" eng "Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist"
ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
eng "Too high level of nesting for select"
...@@ -5892,6 +5892,11 @@ mysql_new_select(LEX *lex, bool move_down) ...@@ -5892,6 +5892,11 @@ mysql_new_select(LEX *lex, bool move_down)
select_lex->init_query(); select_lex->init_query();
select_lex->init_select(); select_lex->init_select();
lex->nest_level++; lex->nest_level++;
if (lex->nest_level > (int) MAX_SELECT_NESTING)
{
my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT,MYF(0),MAX_SELECT_NESTING);
DBUG_RETURN(1);
}
select_lex->nest_level= lex->nest_level; select_lex->nest_level= lex->nest_level;
/* /*
Don't evaluate this subquery during statement prepare even if Don't evaluate this subquery during statement prepare even if
......
...@@ -256,8 +256,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, ...@@ -256,8 +256,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
drop_locked_tables(thd, db, table->table_name); drop_locked_tables(thd, db, table->table_name);
if (thd->killed) if (thd->killed)
{ {
thd->no_warnings_for_error= 0; error=-1;
DBUG_RETURN(-1); goto err_with_placeholders;
} }
alias= (lower_case_table_names == 2) ? table->alias : table->table_name; alias= (lower_case_table_names == 2) ? table->alias : table->table_name;
/* remove form file and isam files */ /* remove form file and isam files */
...@@ -338,6 +338,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, ...@@ -338,6 +338,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
} }
} }
err_with_placeholders:
if (!drop_temporary) if (!drop_temporary)
unlock_table_names(thd, tables, (TABLE_LIST*) 0); unlock_table_names(thd, tables, (TABLE_LIST*) 0);
thd->no_warnings_for_error= 0; thd->no_warnings_for_error= 0;
......
...@@ -81,6 +81,8 @@ ...@@ -81,6 +81,8 @@
RAND_TABLE_BIT) RAND_TABLE_BIT)
#define MAX_FIELDS 4096 /* Limit in the .frm file */ #define MAX_FIELDS 4096 /* Limit in the .frm file */
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD) #define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD) #define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment