mariadb/sql
unknown de6f5ae5ab A fix and a test case for Bug#10760 and complementary cleanups.
The idea of the patch
is that every cursor gets its own lock id for table level locking.
Thus cursors are protected from updates performed within the same 
connection. Additionally a list of transient (must be closed at
commit) cursors is maintained and all transient cursors are closed
when necessary. Lastly, this patch adds support for deadlock
timeouts to TLL locking when using cursors.
+ post-review fixes.


include/thr_lock.h:
  - add a notion of lock owner to table level locking. When using
    cursors, lock owner can not be identified by a thread id any more, 
    as we must protect cursors from updates issued within the same 
    connection (thread). So, each cursor has its own lock identifier to 
    use with table level locking.
  - extend return values of thr_lock and thr_multi_lock with
    THR_LOCK_TIMEOUT and THR_LOCK_DEADLOCK, since these conditions
    are now possible (see comments to thr_lock.c)
mysys/thr_lock.c:
  Better support for cursors:
  - use THR_LOCK_OWNER * as lock identifier, not pthread_t.
  - check and return an error for a trivial deadlock case, when an
    update statement is issued to a table locked by a cursor which has 
    been previously opened in the same connection.
  - add support for locking timeouts: with use of cursors, trivial 
    deadlocks can occur. For now the only remedy is the lock wait timeout,
    which is initialized from a new global variable 'table_lock_wait_timeout'
    Example of a deadlock (assuming the storage engine does not downgrade 
    locks):
    con1: open cursor for select * from t1;
    con2: open cursor for select * from t2;
    con1: update t2 set id=id*2;  -- blocked
    con2: update t1 set id=id*2;  -- deadlock
    Lock timeouts are active only if a connection is using cursors.
  - the check in the wait_for_lock loop has been changed from
    data->cond != cond to data->cond != 0. data->cond is zeroed
    in every place it's changed. 
  - added comments
sql/examples/ha_archive.cc:
  - extend the handlerton with the info about cursor behaviour at commit.
sql/examples/ha_archive.h:
  - ctor moved to .cc to make use of archive handlerton
sql/examples/ha_example.cc:
  - add handlerton instance, init handler::ht with it
sql/examples/ha_example.h:
  - ctor moved to .cc to make use of ha_example handlerton
sql/examples/ha_tina.cc:
  - add handlerton instance, init handler::ht with it
sql/examples/ha_tina.h:
  - ctor moved to .cc to make use of CSV handlerton
sql/ha_berkeley.cc:
  - init handlerton::flags and handler::ht
sql/ha_berkeley.h:
  - ctor moved to .cc to make use of BerkeleyDB handlerton
sql/ha_blackhole.cc:
  - add handlerton instance, init handler::ht with it
sql/ha_blackhole.h:
  - ctor moved to .cc to make use of blackhole handlerton
sql/ha_federated.cc:
  - add handlerton instance, init handler::ht with it
sql/ha_federated.h:
  - ctor moved to .cc to make use of federated handlerton
sql/ha_heap.cc:
  - add handlerton instance, init handler::ht with it
sql/ha_heap.h:
  - ctor moved to .cc to make use of ha_heap handlerton
sql/ha_innodb.cc:
  - init handlerton::flags and handler::ht of innobase storage engine
sql/ha_innodb.h:
  - ctor moved to .cc to make use of archive handlerton
sql/ha_myisam.cc:
  - add handlerton instance, init handler::ht with it
sql/ha_myisam.h:
  - ctor moved to .cc to make use of MyISAM handlerton
sql/ha_myisammrg.cc:
  - init handler::ht in the ctor
sql/ha_myisammrg.h:
  - ctor moved to .cc to make use of MyISAM MERGE handlerton
sql/ha_ndbcluster.cc:
  - init handlerton::flags and handler::ht
sql/handler.cc:
  - drop support for ISAM storage engine, which was removed from 5.0
  - close all "transient" cursors at COMMIT/ROLLBACK. A "transient"
    SQL level cursor is a cursor that uses tables that have a transaction-
    specific state.
sql/handler.h:
  - extend struct handlerton with flags, add handlerton *ht to every
    handler instance.
sql/lock.cc:
  - extend mysql_lock_tables to send error to the client if 
    thr_multi_lock returns a timeout or a deadlock error.
sql/mysqld.cc:
  - add server option --table_lock_wait_timeout (in seconds)
sql/set_var.cc:
  - add new global variable 'table_lock_wait_timeout' to specify
  a wait timeout for table-level locks of MySQL (in seconds). The default
  timeout is 50 seconds. The timeout is active only if the connection
  has open cursors.
sql/sql_class.cc:
  - implement Statement_map::close_transient_cursors
  - safety suggests that we need an assert ensuring 
   llock_info->n_cursors is functioning properly, adjust destruction of
   the Statement_map to allow such assert in THD::~THD
sql/sql_class.h:
  - add support for Cursors registry to Statement map.
sql/sql_prepare.cc:
  - maintain a list of cursors that must be closed at commit/rollback.
sql/sql_select.cc:
  - extend class Cursor to support specific at-COMMIT/ROLLBACK behavior.
  If a cursor uses tables of a storage engine that 
  invalidates all open tables at COMMIT/ROLLBACK, it must be closed
  before COMMIT/ROLLBACK is executed.
sql/sql_select.h:
  - add an own lock_id and commit/rollback status flag to class Cursor
tests/mysql_client_test.c:
  A test case for Bug#10760 and complementary issues: test a simple
  deadlock case too.
mysql-test/var:
  New BitKeeper file ``mysql-test/var''
2005-07-19 22:21:12 +04:00
..
examples A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
share Federated Storage Engine, bug 9925 "Federated query processor (step 2 or step 3) not using logic in 2005-07-17 04:10:19 +02:00
.cvsignore
add_errmsg
client_settings.h
custom_conf.h
derror.cc Remove compiler warnings and remove not used variables 2005-02-25 16:53:22 +02:00
des_key_file.cc Merge mysql.com:/home/bkroot/mysql-4.1 2005-07-13 02:13:04 +02:00
discover.cc
field.cc NO_DEFAULT_VALUE_FLAG and BLOB_FLAG combined 2005-07-15 16:25:31 +05:00
field.h Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
field_conv.cc Merge mysql.com:/usr/home/bar/mysql-4.1 2005-07-12 13:18:25 +05:00
filesort.cc Fix bug #7422 "order by" doesn't work 2005-06-21 20:14:50 +04:00
frm_crypt.cc
gen_lex_hash.cc a fix (#10742: Can't compile "sql_lex.cc" on AIX 5.2). 2005-05-19 18:56:01 +05:00
gstream.cc fixes for windows 64-bit compiler warnings 2005-06-13 12:41:15 +02:00
gstream.h
ha_berkeley.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_berkeley.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_blackhole.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_blackhole.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_federated.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_federated.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_heap.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_heap.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_innodb.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_innodb.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_myisam.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_myisam.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_myisammrg.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_myisammrg.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_ndbcluster.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
ha_ndbcluster.h Merge mysql.com:/usr/local/home/marty/MySQL/mysql-4.1 2005-07-06 11:39:48 +02:00
handler.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
handler.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
hash_filo.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
hash_filo.h forgotten s/__GNUC__/USE_PRAGMA_INTERFACE/ causes compilation faliures 2005-05-27 14:15:08 +02:00
hostname.cc Fixes during review 2005-05-13 14:04:32 +03:00
init.cc
item.cc post merge changes: added safe_charset_converter to other static functions 2005-07-16 00:52:00 +03:00
item.h post merge changes: added safe_charset_converter to other static functions 2005-07-16 00:52:00 +03:00
item_buff.cc Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.0 2005-06-22 14:11:23 +05:00
item_cmpfunc.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2005-07-18 19:03:01 +03:00
item_cmpfunc.h After merge fixes 2005-07-04 16:01:04 +03:00
item_create.cc stop evaluation constant functions in WHERE (BUG#4663) 2005-07-16 00:01:44 +03:00
item_create.h
item_func.cc After-merge fixes (4.1 -> 5.0). 2005-07-16 16:10:42 +04:00
item_func.h After-merge fixes (4.1 -> 5.0). 2005-07-16 16:10:42 +04:00
item_geofunc.cc Merge with 4.1 2005-06-07 00:31:53 +03:00
item_geofunc.h Merge neptunus.(none):/home/msvensson/mysql/bug10241 2005-05-09 11:26:48 +02:00
item_row.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
item_row.h Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
item_strfunc.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2005-07-18 19:03:01 +03:00
item_strfunc.h Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0 2005-07-16 00:17:05 +03:00
item_subselect.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
item_subselect.h Merge mysql.com:/opt/local/work/mysql-4.1-11458 2005-07-13 18:05:57 +04:00
item_sum.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
item_sum.h merge 2005-07-05 11:21:47 +03:00
item_timefunc.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
item_timefunc.h Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
item_uniq.cc Merge with 4.1 2005-06-07 00:31:53 +03:00
item_uniq.h Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
key.cc Fixes while reviewing new code 2005-05-06 11:39:30 +03:00
lex.h Disabled the GOTO feature. (It's non-standard and undocumented.) 2005-07-01 15:25:51 +02:00
lex_symbol.h
lock.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
log.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2005-07-18 19:03:01 +03:00
log_event.cc BUG#11567 Fixed binlog tests on windows. 2005-07-18 17:47:26 -04:00
log_event.h Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
Makefile.am init_db.sql: 2005-07-06 10:16:36 +02:00
matherr.c
mf_iocache.cc
my_decimal.cc Trimmed fix for bug #9546 (Crashing with huge decimals) 2005-05-06 19:04:58 +05:00
my_decimal.h Fix for bug #10896 (0.00 > -0.00) 2005-06-08 21:56:22 +05:00
my_lock.c
mysql_priv.h After-merge fixes (4.1 -> 5.0). 2005-07-16 16:10:42 +04:00
mysqld.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
mysqld_suffix.h
net_serv.cc Merge mysql.com:/home/bkroot/mysql-4.1 2005-07-13 02:13:04 +02:00
nt_servc.cc
nt_servc.h
opt_range.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2005-07-18 19:03:01 +03:00
opt_range.h Merge with 4.1 2005-06-07 00:31:53 +03:00
opt_sum.cc Fixed wrong key length when using MIN() optimization (non fatal, but caused InnoDB to write warnings to the log file) 2005-06-06 14:03:33 +03:00
parse_file.cc Cleanups during review 2005-07-18 15:33:18 +03:00
parse_file.h
password.c fixes for windows 64-bit compiler warnings 2005-06-13 12:41:15 +02:00
procedure.cc Merge with 4.1 2005-06-07 00:31:53 +03:00
procedure.h Merge neptunus.(none):/home/msvensson/mysql/bug10241 2005-05-09 11:26:48 +02:00
protocol.cc A fix and a test case for Bug#10794 "mysql_stmt_attr_set no 2005-06-30 16:17:10 +04:00
protocol.h A fix and a test case for Bug#10794 "mysql_stmt_attr_set no 2005-06-30 16:17:10 +04:00
protocol_cursor.cc Merge with 4.1 2005-06-07 00:31:53 +03:00
records.cc Moved some old test and added a new test to only be run with mysql-test-run --big 2005-04-07 19:24:14 +03:00
repl_failsafe.cc Merge of 4.1->5.0. This contained the fixes for GCC 4.0 2005-06-01 21:56:30 -07:00
repl_failsafe.h
set_var.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
set_var.h Merge mysql.com:/opt/local/work/mysql-4.1-root 2005-07-16 13:45:32 +04:00
slave.cc Get rid of checking for ETIME return value of pthread_cond_timedwait. 2005-07-14 19:42:56 +04:00
slave.h merge from 4.1 2005-03-24 14:32:40 +01:00
sp.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2005-07-13 15:08:13 +04:00
sp.h Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2005-07-13 15:08:13 +04:00
sp_cache.cc sp_rcontext.cc, sp_pcontext.cc, sp_head.cc, sp_cache.cc, ha_federated.cc: 2005-06-05 16:20:22 +02:00
sp_cache.h Add USE_PRAGMA_INTERFACE and USE_PRAGMA_IMPLEMENTATION to files not existsing in 4.1 2005-05-27 12:03:37 +02:00
sp_head.cc Fixed BUG#9538: SProc: Creation fails if we try to SET system variable 2005-07-15 17:24:19 +02:00
sp_head.h Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2005-07-09 22:04:18 +04:00
sp_pcontext.cc sp_rcontext.cc, sp_pcontext.cc, sp_head.cc, sp_cache.cc, ha_federated.cc: 2005-06-05 16:20:22 +02:00
sp_pcontext.h Add USE_PRAGMA_INTERFACE and USE_PRAGMA_IMPLEMENTATION to files not existsing in 4.1 2005-05-27 12:03:37 +02:00
sp_rcontext.cc Fixed BUG#11529: crash server after use stored procedure 2005-06-30 18:07:06 +02:00
sp_rcontext.h Fixed BUG#11529: crash server after use stored procedure 2005-06-30 18:07:06 +02:00
spatial.cc Merge mdk10.(none):/home/reggie/bk/mysql-4.1 2005-05-19 15:50:44 -05:00
spatial.h Fix warnings from icc 2005-05-18 19:00:21 +03:00
sql_acl.cc Merge jwinstead@production.mysql.com:my/mysql-5.0-11045 2005-07-06 16:49:04 -07:00
sql_acl.h added processing of view grants to table grants (BUG#9795) 2005-07-05 13:36:36 +03:00
sql_analyse.cc Merge with 4.1 2005-06-07 00:31:53 +03:00
sql_analyse.h Merge from 4.1 2005-05-26 21:01:55 +02:00
sql_base.cc take into account table lock mode when opening table: 2005-07-15 01:22:14 +03:00
sql_bitmap.h Bug#10932 - Building server with key limit of 128, makes test cases fail 2005-07-19 14:13:56 +02:00
sql_cache.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2005-07-18 19:03:01 +03:00
sql_cache.h
sql_class.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
sql_class.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +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 Add ifdefs to control when "#pragma implementation" should be used 2005-05-26 12:09:14 +02:00
sql_db.cc fixed conflicts 2005-05-20 16:34:59 -05:00
sql_delete.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
sql_derived.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
sql_do.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
sql_error.cc merge 2005-07-05 11:38:05 +03:00
sql_error.h Invalid DEFAULT values for CREATE TABLE now generates errors. (Bug #5902) 2005-04-01 15:04:50 +03:00
sql_handler.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
sql_help.cc do not register changes of stack variable 2005-07-03 00:51:02 +03:00
sql_insert.cc Get rid of checking for ETIME return value of pthread_cond_timedwait. 2005-07-14 19:42:56 +04:00
sql_lex.cc Post-merge fixes. 2005-07-15 00:41:58 +04:00
sql_lex.h - a fix for Bug#11458 "Prepared statement with subselects return random 2005-07-13 17:38:55 +04:00
sql_list.cc a compiler must see '#pragma implementation' *before* 2005-06-05 19:38:52 +02:00
sql_list.h merged 2005-05-19 15:20:10 +02:00
sql_load.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
sql_manager.cc
sql_manager.h
sql_map.cc WL#2286 - Compile MySQL w/YASSL support 2005-06-22 14:08:28 +05:00
sql_map.h Add ifdefs to control when "#pragma implementation" should be used 2005-05-26 12:09:14 +02:00
sql_olap.cc Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
sql_parse.cc Bug#11577 'show procedure/function status' doesn't work for user with limited access 2005-07-19 13:49:43 +05:00
sql_prepare.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
sql_rename.cc Bug#6877 MySQL should give an error if the requested table type is not available 2005-06-17 22:14:44 +01:00
sql_repl.cc Merge mysql.com:/home/kostja/mysql/mysql-4.1-root 2005-07-19 00:55:37 +04:00
sql_repl.h WL#874 "Extended LOAD DATA". 2005-03-16 04:32:47 +03:00
sql_select.cc A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
sql_select.h A fix and a test case for Bug#10760 and complementary cleanups. 2005-07-19 22:21:12 +04:00
sql_show.cc Fix for bug#11057 information_schema: columns table has some questionable contents 2005-07-19 14:30:32 +05:00
sql_sort.h
sql_state.c
sql_string.cc Merge with 4.1 2005-06-07 00:31:53 +03:00
sql_string.h Bug#8610: The ucs2_turkish_ci collation fails with upper('i') 2005-06-06 16:54:15 +05:00
sql_table.cc Merge mysql.com:/usr/home/bar/mysql-4.1.num-conv 2005-07-14 16:11:55 +05:00
sql_test.cc Fixes while reviewing new code 2005-05-06 11:39:30 +03:00
sql_trigger.cc Now when we create or drop trigger we will open only subject table and not 2005-07-13 23:51:09 +04:00
sql_trigger.h Enable support of access to tables from triggers. Thus fix bug #8406 "Triggers 2005-07-09 21:51:59 +04:00
sql_udf.cc Merge with 4.1 2005-06-07 00:31:53 +03:00
sql_udf.h Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
sql_union.cc Merge jwinstead@production.mysql.com:my/mysql-5.0-11045 2005-07-06 16:49:04 -07:00
sql_update.cc sql_update.cc: 2005-07-13 16:13:36 +03:00
sql_view.cc view.test, view.result: 2005-07-12 10:44:32 -07:00
sql_view.h Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
sql_yacc.yy Merge mysql.com:/home/kostja/mysql/mysql-4.1-root 2005-07-19 00:55:37 +04:00
stacktrace.c Step 2 of the switch to support configuration with NPTL: 2005-04-20 20:38:57 +02:00
stacktrace.h Step 2 of the switch to support configuration with NPTL: 2005-04-20 20:38:57 +02:00
strfunc.cc Remove compiler warnings and remove not used variables 2005-02-25 16:53:22 +02:00
structs.h Fix for bug#11055: information_schema: routines.sql_data_access has wrong value 2005-06-16 12:12:47 +05:00
table.cc Merge jwinstead@production.mysql.com:my/mysql-5.0-11045 2005-07-06 16:49:04 -07:00
table.h Implementation of Monty's idea: Now we can open mysql.proc table for lookup 2005-07-13 13:48:13 +04:00
thr_malloc.cc
time.cc Don't use -lsupc++ with gcc 3.3 and below as this gives linking problems when linking staticly 2005-04-04 16:43:25 +03:00
tzfile.h
tztime.cc Merge with 4.1 2005-06-07 00:31:53 +03:00
tztime.h Merge neptunus.(none):/home/msvensson/mysql/bug10241 2005-05-09 11:26:48 +02:00
udf_example.cc
uniques.cc Code cleanups during code reviews 2005-06-01 16:35:09 +03:00
unireg.cc Bug#6877 MySQL should give an error if the requested table type is not available 2005-06-17 22:14:44 +01:00
unireg.h
watchdog_mysqld