Commit 6ae42b75 authored by Michael Widenius's avatar Michael Widenius

Fixed lock sorting and lock check issues with thr_lock that caused warnings...

Fixed lock sorting and lock check issues with thr_lock that caused warnings when running test suite.
Safety check that could cause core dump when doing create table with virtual column.

mysql-test/mysql-test-run.pl:
  Show also warnings from thr_lock (which starts with just Warning, not Warning:)
mysql-test/r/lock.result:
  Added test that showed not relevant warning when using table locks.
mysql-test/t/lock.test:
  Added test that showed not relevant warning when using table locks.
mysys/thr_lock.c:
  Fixed sorting of locks.
  (Old sort code didn't handle case where TL_WRITE_CONCURRENT_INSERT must be sorted before TL_WRITE)
  Added more information to check_locks warning output.
  Fixed wrong testing of multiple different write locks for same table.
sql/item_cmpfunc.cc:
  Safety check that could cause core dump when doing create table with virtual column.
parent 00752ba4
...@@ -4383,7 +4383,7 @@ sub extract_warning_lines ($) { ...@@ -4383,7 +4383,7 @@ sub extract_warning_lines ($) {
my @patterns = my @patterns =
( (
qr/^Warning:|mysqld: Warning|\[Warning\]/, qr/^Warning|mysqld: Warning|\[Warning\]/,
qr/^Error:|\[ERROR\]/, qr/^Error:|\[ERROR\]/,
qr/^==\d+==\s+\S/, # valgrind errors qr/^==\d+==\s+\S/, # valgrind errors
qr/InnoDB: Warning|InnoDB: Error/, qr/InnoDB: Warning|InnoDB: Error/,
......
...@@ -194,3 +194,13 @@ ERROR HY000: Table 't2' was locked with a READ lock and can't be updated ...@@ -194,3 +194,13 @@ ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1,t2; DROP TABLE t1,t2;
End of 5.1 tests. End of 5.1 tests.
create table t1 (a int) engine=myisam;
lock tables t1 write concurrent, t1 as t2 read;
lock tables t1 read local;
unlock tables;
unlock tables;
lock tables t1 read local;
lock tables t1 write concurrent, t1 as t2 read;
unlock tables;
unlock tables;
drop table t1;
...@@ -245,3 +245,28 @@ UNLOCK TABLES; ...@@ -245,3 +245,28 @@ UNLOCK TABLES;
DROP TABLE t1,t2; DROP TABLE t1,t2;
--echo End of 5.1 tests. --echo End of 5.1 tests.
#
# Test concurrent lock and read locks
# This gave a warning:
# Warning at 'read lock with old write lock' for lock: 5:
# Found lock of type 8 that is write and read locked. Read_no_write_count: 1
#
create table t1 (a int) engine=myisam;
lock tables t1 write concurrent, t1 as t2 read;
connect (con1,localhost,root,,);
connection con1;
lock tables t1 read local;
unlock tables;
connection default;
unlock tables;
connection con1;
lock tables t1 read local;
connection default;
lock tables t1 write concurrent, t1 as t2 read;
unlock tables;
connection con1;
unlock tables;
disconnect con1;
connection default;
drop table t1;
This diff is collapsed.
...@@ -412,7 +412,8 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, ...@@ -412,7 +412,8 @@ static bool convert_constant_item(THD *thd, Item_field *field_item,
LINT_INIT(old_maps[0]); LINT_INIT(old_maps[0]);
LINT_INIT(old_maps[1]); LINT_INIT(old_maps[1]);
if (table) /* table->read_set may not be set if we come here from a CREATE TABLE */
if (table && table->read_set)
dbug_tmp_use_all_columns(table, old_maps, dbug_tmp_use_all_columns(table, old_maps,
table->read_set, table->write_set); table->read_set, table->write_set);
/* For comparison purposes allow invalid dates like 2000-01-32 */ /* For comparison purposes allow invalid dates like 2000-01-32 */
...@@ -448,7 +449,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, ...@@ -448,7 +449,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item,
} }
thd->variables.sql_mode= orig_sql_mode; thd->variables.sql_mode= orig_sql_mode;
thd->count_cuted_fields= orig_count_cuted_fields; thd->count_cuted_fields= orig_count_cuted_fields;
if (table) if (table && table->read_set)
dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_maps); dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_maps);
} }
return result; return result;
......
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