diff options
author | unknown <knielsen@knielsen-hq.org> | 2011-07-05 15:28:15 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2011-07-05 15:28:15 +0200 |
commit | d93b4c539449e951e25f6c0b1e606040a02c58ad (patch) | |
tree | c7009001ea29287fba477cb324d3ce45539ec989 /storage | |
parent | 371d514fdba0bc403aafbcec039586e8aa77aa0a (diff) | |
download | mariadb-git-d93b4c539449e951e25f6c0b1e606040a02c58ad.tar.gz |
MWL#163 lp:798213: Remove the --innodb-release-locks-early feature.
The bug lp:798213 exposes a design flaw in --innodb-release-locks-early.
It does not work with InnoDB crash recovery, so it breaks transactional
integrety. So remove the feature.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/xtradb/handler/ha_innodb.cc | 69 | ||||
-rw-r--r-- | storage/xtradb/include/srv0srv.h | 3 | ||||
-rw-r--r-- | storage/xtradb/include/trx0sys.ic | 9 | ||||
-rw-r--r-- | storage/xtradb/srv/srv0srv.c | 3 |
4 files changed, 1 insertions, 83 deletions
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index c4e6fa0df0d..f409b88cc7b 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -248,7 +248,6 @@ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { static INNOBASE_SHARE *get_share(const char *table_name); static void free_share(INNOBASE_SHARE *share); static int innobase_close_connection(handlerton *hton, THD* thd); -static void innobase_prepare_ordered(handlerton *hton, THD* thd, bool all); static void innobase_commit_ordered(handlerton *hton, THD* thd, bool all); static int innobase_commit(handlerton *hton, THD* thd, bool all); static int innobase_rollback(handlerton *hton, THD* thd, bool all); @@ -2084,10 +2083,6 @@ innobase_init( innobase_hton->savepoint_set=innobase_savepoint; innobase_hton->savepoint_rollback=innobase_rollback_to_savepoint; innobase_hton->savepoint_release=innobase_release_savepoint; - if (innobase_release_locks_early) - innobase_hton->prepare_ordered=innobase_prepare_ordered; - else - innobase_hton->prepare_ordered=NULL; innobase_hton->commit_ordered=innobase_commit_ordered; innobase_hton->commit=innobase_commit; innobase_hton->rollback=innobase_rollback; @@ -2801,54 +2796,6 @@ innobase_start_trx_and_assign_read_view( DBUG_RETURN(0); } -/*****************************************************************//** -Release row locks early during prepare phase. - -Only enabled if --innodb-release-locks-early=1. In this case, a prepared -transaction is treated as committed to memory (but not to disk), and we -release row locks at the end of the prepare phase. - -The consistent commit ordering guarantees of prepare_ordered() calls means -that transactions will not be binlogged in different order than locks are -released (which would cause trouble for statement-based replication). - -This optimisation is not 100% safe, so is not enabled by default. But some -applications may decide to enable it to reduce contention on hotspot rows. - -The consequences of enabling this are: - - - It is not possible to rollback after successful prepare(). If there is - a need to rollback (ie. failure to binlog the transaction), we crash the - server (!) - - - If we crash during commit, it is possible that an application/user can have - seen another transaction committed that is not recovered by XA crash - recovery. Thus durability is partially lost. However, consistency is still - guaranteed, we never recover a transaction and not recover another - transaction that committed before. */ -static -void -innobase_prepare_ordered( -/*============*/ - handlerton *hton, /*!< in: Innodb handlerton */ - THD* thd, /*!< in: MySQL thread handle of the user for whom - the transaction should be committed */ - bool all) /*!< in: TRUE - commit transaction - FALSE - the current SQL statement ended */ -{ - trx_t* trx; - DBUG_ENTER("innobase_prepare_ordered"); - DBUG_ASSERT(hton == innodb_hton_ptr); - - trx = check_trx_exists(thd); - - mutex_enter(&kernel_mutex); - lock_release_off_kernel(trx); - mutex_exit(&kernel_mutex); - - DBUG_VOID_RETURN; -} - static void innobase_commit_ordered_2( @@ -3088,16 +3035,6 @@ innobase_rollback( row_unlock_table_autoinc_for_mysql(trx); - /* if transaction has already released locks, it is too late to - rollback */ - if (innobase_release_locks_early && trx->conc_state == TRX_PREPARED - && UT_LIST_GET_LEN(trx->trx_locks) == 0) { - sql_print_error("Rollback after releasing locks! " - "errno=%d, dberr="ULINTPF, - errno, trx->error_state); - ut_error; - } - if (all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { @@ -11968,11 +11905,6 @@ static MYSQL_SYSVAR_ULINT(pass_corrupt_table, srv_pass_corrupt_table, "except for the deletion.", NULL, NULL, 0, 0, 1, 0); -static MYSQL_SYSVAR_BOOL(release_locks_early, innobase_release_locks_early, - PLUGIN_VAR_READONLY, - "Release row locks in the prepare stage instead of in the commit stage", - NULL, NULL, FALSE); - static MYSQL_SYSVAR_ULINT(lazy_drop_table, srv_lazy_drop_table, PLUGIN_VAR_RQCMDARG, "At deleting tablespace, only miminum needed processes at the time are done. " @@ -12070,7 +12002,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(auto_lru_dump), MYSQL_SYSVAR(use_purge_thread), MYSQL_SYSVAR(pass_corrupt_table), - MYSQL_SYSVAR(release_locks_early), MYSQL_SYSVAR(lazy_drop_table), NULL }; diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index 8bcf215c7ac..ac7ae8c5627 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -351,9 +351,6 @@ extern ulint srv_buf_pool_reads; /** Time in seconds between automatic buffer pool dumps */ extern uint srv_auto_lru_dump; -/** Release row locks already in the prepare phase */ -extern my_bool innobase_release_locks_early; - /** Status variables to be passed to MySQL */ typedef struct export_var_struct export_struc; diff --git a/storage/xtradb/include/trx0sys.ic b/storage/xtradb/include/trx0sys.ic index f39ba3055be..5e0f07c8b9d 100644 --- a/storage/xtradb/include/trx0sys.ic +++ b/storage/xtradb/include/trx0sys.ic @@ -338,12 +338,6 @@ trx_list_get_min_trx_id(void) /****************************************************************//** Checks if a transaction with the given id is active. -IMPORTANT ASSUMPTION: - It is assumed that this function is only used for the purpose of - determining if locks need to be created for the input transaction. - So if innobase_release_locks_early global option is set, and if - the transaction is already in prepared state, this returns FALSE, - as locks are no longer needed for the transaction. @return TRUE if active */ UNIV_INLINE ibool @@ -372,8 +366,7 @@ trx_is_active( trx = trx_get_on_id(trx_id); if (trx && (trx->conc_state == TRX_ACTIVE - || (trx->conc_state == TRX_PREPARED && - !innobase_release_locks_early))) { + || trx->conc_state == TRX_PREPARED)) { return(TRUE); } diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c index fb13ec395c2..1e078e1a6e9 100644 --- a/storage/xtradb/srv/srv0srv.c +++ b/storage/xtradb/srv/srv0srv.c @@ -496,9 +496,6 @@ UNIV_INTERN FILE* srv_misc_tmpfile; UNIV_INTERN ulint srv_main_thread_process_no = 0; UNIV_INTERN ulint srv_main_thread_id = 0; -/* Release row locks already in the prepare phase */ -UNIV_INTERN my_bool innobase_release_locks_early = FALSE; - /* The following count work done by srv_master_thread. */ /* Iterations by the 'once per second' loop. */ |