mariadb/sql
unknown c0887e5461 Bug#18544 - LOCK TABLES timeout causes MyISAM table corruption
After a locking error the open table(s) were not fully
cleaned up for reuse. But they were put into the open table
cache even before the lock was tried. The next statement
reused the table(s) with a wrong lock type set up. This
tricked MyISAM into believing that it don't need to update
the table statistics. Hence CHECK TABLE reported a mismatch
of record count and table size.

Fortunately nothing worse has been detected yet. The effect
of the test case was that the insert worked on a read locked
table. (!)

I added a new function that clears the lock type from all
tables that were prepared for a lock. I call this function
when a lock failes.

No test case. One test would add 50 seconds to the
test suite. Another test requires file mode modifications.
I added a test script to the bug report. It contains three
cases for failing locks. All could reproduce a table
corruption. All are fixed by this patch.

This bug was not lock timeout specific.


sql/lock.cc:
  Bug#18544 - LOCK TABLES timeout causes MyISAM table corruption
  Resetting the lock type in the open table(s) lock data
  after a locking error.
2006-04-19 22:54:25 +05:00
..
examples Fix Bug#14672 Bug in deletion 2005-11-06 02:11:12 +03:00
share Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1 2006-04-03 17:11:54 +05:00
.cvsignore
add_errmsg
client_settings.h
custom_conf.h
derror.cc
des_key_file.cc Many files: 2005-09-30 14:03:55 +02:00
discover.cc
field.cc Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1 2006-03-28 18:32:58 +05:00
field.h A fix and a test case for Bug#13134 "Length of VARCHAR() utf8 2006-02-21 19:52:20 +03:00
field_conv.cc a fix (bug #7589: Decimal types are ignored when updating data from another column). 2005-09-21 14:32:19 +05:00
filesort.cc Review fixes since last pull 2005-09-12 18:48:17 +03:00
frm_crypt.cc
gen_lex_hash.cc
gstream.cc
gstream.h
ha_berkeley.cc BUG#6554 Problem Building MySql on Fedora Core 3 2006-01-16 12:17:30 +01:00
ha_berkeley.h
ha_blackhole.cc ha_blackhole.cc: 2005-08-30 02:46:03 +02:00
ha_blackhole.h ha_blackhole changes, same patch as http://lists.mysql.com/internals/27878, per brian 2005-08-26 02:09:56 +02:00
ha_heap.cc Cleanup during review of new pushed code 2006-03-30 03:11:37 +03:00
ha_heap.h Bug #12796: Record lost in HEAP table 2005-11-08 00:26:37 -05:00
ha_innodb.cc BUG#18283 When InnoDB returns error 'lock table full', MySQL can write 2006-03-17 10:25:29 +01:00
ha_innodb.h
ha_isam.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
ha_isam.h
ha_isammrg.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
ha_isammrg.h
ha_myisam.cc BUG#9622, stage 2, work together with fix for BUG#12232: 2005-10-21 06:29:17 +04:00
ha_myisam.h
ha_myisammrg.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
ha_myisammrg.h
ha_ndbcluster.cc Bug #17249 ndb, delete statement with join where clause fails when table do not have pk 2006-02-10 17:40:22 +01:00
ha_ndbcluster.h Bug #17249 ndb, delete statement with join where clause fails when table do not have pk 2006-02-10 17:40:22 +01:00
handler.cc Bug #14514 Creating table with packed key fails silently 2005-11-21 12:27:58 +01:00
handler.h BUG#12232: Add a server option to treat NULL values as equal when calculating MyISAM index 2005-09-21 02:18:29 +04:00
hash_filo.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
hash_filo.h
hostname.cc Fix for bug #15756: incorrect ip address matching in ACL due to use of latin1 collation. 2006-01-24 13:58:28 +04:00
init.cc
item.cc Bug#15949 union + illegal mix of collations (IMPLICIT + COERCIBLE) 2006-03-01 17:58:01 +04:00
item.h Merge mysql.com:/home/jimw/my/mysql-4.1-13344 2005-10-12 13:27:49 -07:00
item_buff.cc group_by.result, group_by.test: 2005-06-21 04:24:21 -07:00
item_cmpfunc.cc A fix and a test case for Bug#12734 " prepared statement may 2006-01-14 04:55:07 +03:00
item_cmpfunc.h A fix and a test case for Bug#12734 " prepared statement may 2006-01-14 04:55:07 +03:00
item_create.cc
item_create.h
item_func.cc Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was 2006-04-12 23:05:38 +04:00
item_func.h Merge april.(none):/home/svoj/devel/mysql/BUG16893/mysql-4.1 2006-02-07 13:49:55 +04:00
item_geofunc.cc Fix for bug #12839 (Endian support is absurd) 2005-09-21 14:35:01 +05:00
item_geofunc.h
item_row.cc A fix and a test case for Bug#16248 "WHERE (col1,col2) IN ((?,?)) 2006-04-07 22:26:25 +04:00
item_row.h A fix and a test case for Bug#16248 "WHERE (col1,col2) IN ((?,?)) 2006-04-07 22:26:25 +04:00
item_strfunc.cc A fix for Bug#13944 "libmysqlclient exporting sha1_result function": 2006-01-11 17:31:52 +03:00
item_strfunc.h BUG#9535 Warning for "create table t as select uuid();" 2005-12-07 15:45:31 +01:00
item_subselect.cc fixed convertion and handling IN subqueries with rows (BUG#11867) 2005-08-13 07:45:14 +03:00
item_subselect.h - a fix for Bug#11458 "Prepared statement with subselects return random 2005-07-13 17:38:55 +04:00
item_sum.cc Fixed bug#15560: GROUP_CONCAT wasn't ready for WITH ROLLUP queries 2006-03-29 23:30:34 +04:00
item_sum.h Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was 2006-04-12 23:05:38 +04:00
item_timefunc.cc Bug#18691: Converting number to UNICODE string returns invalid result. 2006-04-13 10:55:48 +05:00
item_timefunc.h Bug#18691: Converting number to UNICODE string returns invalid result. 2006-04-13 10:55:48 +05:00
item_uniq.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
item_uniq.h
key.cc
lex.h
lex_symbol.h
lock.cc Bug#18544 - LOCK TABLES timeout causes MyISAM table corruption 2006-04-19 22:54:25 +05:00
log.cc Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; 2005-10-12 13:29:55 +02:00
log_event.cc BUG#16217 fix partly backported from 5.0. It is different in mysqlbinlog part. 2006-02-10 15:12:27 +02:00
log_event.h Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; 2005-10-12 13:29:55 +02:00
Makefile.am Makefile.am, configure.in: 2005-09-24 15:51:45 +02:00
matherr.c
mf_iocache.cc
my_lock.c
mysql_priv.h Merge bk-internal.mysql.com:/home/bk/mysql-4.1 2006-04-07 23:50:45 +04:00
mysqld.cc Fix a typo in the help message. 2006-04-13 14:06:46 +04:00
mysqld_suffix.h
net_serv.cc Merge selena.:H:/MYSQL/src/#05588-mysql-4.0 2005-09-07 14:59:41 +04:00
nt_servc.cc
nt_servc.h
opt_range.cc BUG#12915: post-review fixes 2005-10-18 14:04:14 +04:00
opt_range.h BUG#12915: Added single-table UPDATE/DELTE ... ORDER BY ... LIMIT 2005-09-30 15:21:37 +04:00
opt_sum.cc Fixed error found during review of new pushed code 2005-09-25 21:22:23 +03:00
password.c A fix for Bug#13944 "libmysqlclient exporting sha1_result function": 2006-01-11 17:31:52 +03:00
procedure.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
procedure.h
protocol.cc A fix and a test case for Bug#15613 "libmysqlclient API function 2006-01-18 22:50:31 +03:00
protocol.h
protocol_cursor.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
records.cc Added more tests for new UPDATE ... ORDER BY ... LIMIT optimization 2005-10-25 02:27:40 +03:00
repl_failsafe.cc fix for Valgrind errors: query_id needs to be inited early (already fixed in 5.0 by Konstantin) and so does client_capabilities (not fixed in 5.0); 2005-10-14 15:34:52 +02:00
repl_failsafe.h
set_var.cc A fix and a test case for Bug#16365 "Prepared Statements: DoS with 2006-04-07 23:37:06 +04:00
set_var.h A fix and a test case for Bug#16365 "Prepared Statements: DoS with 2006-04-07 23:37:06 +04:00
slave.cc fix for Valgrind errors: query_id needs to be inited early (already fixed in 5.0 by Konstantin) and so does client_capabilities (not fixed in 5.0); 2005-10-14 15:34:52 +02:00
slave.h Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; 2005-10-12 13:29:55 +02:00
spatial.cc Review of new pushed code 2005-11-01 13:00:02 +02:00
spatial.h Fix for bug #14320 (MBROverlaps does wrong test) 2005-12-10 18:20:00 +04:00
sql_acl.cc Fix for bug#14385 GRANT and mapping to correct user account problems 2006-03-06 14:03:40 +04:00
sql_acl.h Fix for bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in 2005-09-01 16:52:59 +04:00
sql_analyse.cc Merged code. Removed unneccessary repeating. 2005-09-13 18:11:51 +03:00
sql_analyse.h
sql_base.cc BUG#16893: Crash in test 'fulltext_order_by' 2006-02-03 14:09:33 +04:00
sql_bitmap.h
sql_cache.cc A fix for Bug#7209 "Client error with "Access Denied" on updates 2006-01-04 17:35:30 +03:00
sql_cache.h Merge sanja.is.com.ua:/home/bell/mysql/bk/work-4.0 2005-09-06 12:18:23 +03:00
sql_class.cc A fix and a test case for Bug#16365 "Prepared Statements: DoS with 2006-04-07 23:37:06 +04:00
sql_class.h Merge bk-internal.mysql.com:/home/bk/mysql-4.1 2006-04-07 23:50:45 +04:00
sql_client.cc
sql_crypt.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
sql_crypt.h
sql_db.cc Bug #15302 LOAD DATA FROM MASTER -> Packets out of order (Found: 2, expected 1) 2006-01-31 12:47:22 +01:00
sql_delete.cc Bug#17137 Running "truncate table" on temporary table leaves the table open on a slave 2006-03-08 10:15:48 +01:00
sql_derived.cc
sql_do.cc
sql_error.cc abort storing query to query cache if warnings appeared (BUG#9414) 2005-06-28 00:52:21 +03:00
sql_handler.cc Re-run fix-fields on condition if table was reopened in HANDLERREAD 2006-01-10 19:13:12 +02:00
sql_help.cc
sql_insert.cc Fix calls to free_underlaid_joins() in INSERT, DELETE, and UPDATE 2005-12-08 12:33:33 -08:00
sql_lex.cc select.test, sql_select.cc, sql_lex.cc, item.cc: 2005-10-13 00:58:59 +04:00
sql_lex.h Manual merge, fix for bug #7672 2005-10-12 03:32:14 +04:00
sql_list.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
sql_list.h
sql_load.cc Bug #17154 load data infile of char values into a table of char(PK) hangs 2006-02-07 00:03:39 +01:00
sql_manager.cc
sql_manager.h
sql_map.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
sql_map.h
sql_olap.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
sql_parse.cc A fix and a test case for Bug#13134 "Length of VARCHAR() utf8 2006-02-21 19:52:20 +03:00
sql_prepare.cc A fix and a test case for Bug#16365 "Prepared Statements: DoS with 2006-04-07 23:37:06 +04:00
sql_rename.cc
sql_repl.cc Fix for BUG#12003 "assertion failure in testsuite (double lock of 2005-07-18 14:46:53 +02:00
sql_repl.h
sql_select.cc Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was 2006-04-12 23:05:38 +04:00
sql_select.h Excluded posibility of tmp_table_param.copy_field double deletion (BUG#14851). 2006-01-18 13:48:57 +02:00
sql_show.cc Avoid possible race condition in accessing slave statistics 2005-11-01 11:48:55 -08:00
sql_sort.h
sql_state.c
sql_string.cc Bug#15375 Unassigned multibyte codes are broken 2005-12-12 21:42:09 +04:00
sql_string.h
sql_table.cc Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1 2006-03-30 10:22:03 +04:00
sql_test.cc Bug#12920 - key_read_requests counter appears to re-set 2005-09-14 13:18:16 +02:00
sql_udf.cc - backport of a compile fix from 4.1 (ChangeSet@1.2260.23.2 2005/05/19 from reggie) 2005-06-30 17:33:23 +02:00
sql_udf.h
sql_union.cc Review of new pushed code 2005-08-09 00:13:49 +03:00
sql_update.cc BUG#15935: post-review fixes: added comment 2006-01-26 00:09:04 +03:00
sql_yacc.yy kill (subquery) - three years old bugfix that never worked 2006-03-06 18:26:39 +01:00
stacktrace.c
stacktrace.h
strfunc.cc
structs.h Added more tests for new UPDATE ... ORDER BY ... LIMIT optimization 2005-10-25 02:27:40 +03:00
table.cc Bug#18004 Connecting crashes server when default charset is UCS2 2006-03-20 14:43:02 +04:00
table.h Merge mysql.com:/home/mydev/mysql-4.0-bug5390 2006-01-23 19:19:29 +01:00
thr_malloc.cc
time.cc
tzfile.h
tztime.cc Minor Netware specific changes. 2005-12-13 18:30:10 +02:00
tztime.h
udf_example.cc
uniques.cc
unireg.cc Review of new code: 2005-07-27 13:05:30 +03:00
unireg.h Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was 2006-04-12 23:05:38 +04:00
watchdog_mysqld