diff options
author | unknown <heikki@hundin.mysql.fi> | 2005-08-03 17:09:21 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2005-08-03 17:09:21 +0300 |
commit | a8bb376fc7ecc3e26623c897c4ec99739a3d1a29 (patch) | |
tree | aedea677efe6043e724f01c1c14864393d62c931 /sql | |
parent | acc423865419b1b9269b4e4777a27b431526d9da (diff) | |
download | mariadb-git-a8bb376fc7ecc3e26623c897c4ec99739a3d1a29.tar.gz |
Many files:
Push the patch of Jan Lindstrom: better comments
ha_innodb.cc:
Partial fix for Bug #12263 : we let InnoDB always to perform a rollback on the trx object if MySQL closes a connection; but we do print a warning to the .err log if an InnoDB transaction was active; we may remove that print later, since the situation really is not a bug; MySQL just is not aware that some cursor operation started an InnoDB transaction
sql/ha_innodb.cc:
Partial fix for Bug #12263 : we let InnoDB always to perform a rollback on the trx object if MySQL closes a connection; but we do print a warning to the .err log if an InnoDB transaction was active; we may remove that print later, since the situation really is not a bug; MySQL just is not aware that some cursor operation started an InnoDB transaction
sql/ha_innodb.h:
Push the patch of Jan Lindstrom: better comments
innobase/trx/trx0trx.c:
Push the patch of Jan Lindstrom: better comments
innobase/srv/srv0srv.c:
Push the patch of Jan Lindstrom: better comments
innobase/srv/srv0start.c:
Push the patch of Jan Lindstrom: better comments
innobase/row/row0sel.c:
Push the patch of Jan Lindstrom: better comments
innobase/read/read0read.c:
Push the patch of Jan Lindstrom: better comments
innobase/include/read0read.h:
Push the patch of Jan Lindstrom: better comments
innobase/include/trx0trx.h:
Push the patch of Jan Lindstrom: better comments
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innodb.cc | 54 | ||||
-rw-r--r-- | sql/ha_innodb.h | 21 |
2 files changed, 50 insertions, 25 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index d40e58aa4cb..a6edb2ea20f 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -538,7 +538,7 @@ innobase_mysql_prepare_print_arbitrary_thd(void) } /***************************************************************** -Relases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd(). +Releases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd(). NOTE that /mysql/innobase/lock/lock0lock.c must contain the prototype for this function! */ extern "C" @@ -1700,7 +1700,7 @@ innobase_store_binlog_offset_and_flush_log( /* Commits the mini-transaction */ mtr_commit(&mtr); - /* Syncronous flush of the log buffer to disk */ + /* Synchronous flush of the log buffer to disk */ log_buffer_flush_to_disk(); } #endif @@ -2132,15 +2132,34 @@ innobase_savepoint( /********************************************************************* Frees a possible InnoDB trx object associated with the current THD. */ - -static int +static +int innobase_close_connection( /*======================*/ /* out: 0 or error number */ THD* thd) /* in: handle to the MySQL thread of the user whose resources should be free'd */ { - trx_free_for_mysql((trx_t*)thd->ha_data[innobase_hton.slot]); + trx_t* trx; + + trx = (trx_t*)thd->ha_data[innobase_hton.slot]; + + ut_a(trx); + + if (trx->conc_state != TRX_NOT_STARTED) { + ut_print_timestamp(stderr); + + fprintf(stderr, +" InnoDB: Warning: MySQL is closing a connection" +"InnoDB: that has an active InnoDB transaction. We roll back that\n" +"InnoDB: transaction. %lu row modifications to roll back.\n", + (ulong)ut_dulint_get_low(trx->undo_no)); + } + + innobase_rollback_trx(trx); + + trx_free_for_mysql(trx); + return(0); } @@ -2834,7 +2853,7 @@ ha_innobase::store_key_val_for_row( /* All indexes on BLOB and TEXT are column prefix indexes, and we may need to truncate the data to be - stored in the kay value: */ + stored in the key value: */ if (blob_len > key_part->length) { blob_len = key_part->length; @@ -7117,7 +7136,7 @@ int innobase_rollback_by_xid( /*=====================*/ /* out: 0 or error number */ - XID *xid) /* in: X/Open XA transaction idenfification */ + XID *xid) /* in: X/Open XA transaction identification */ { trx_t* trx; @@ -7131,9 +7150,10 @@ innobase_rollback_by_xid( } /*********************************************************************** -This function creates a consistent view for a cursor and start a transaction -if it has not been started. This consistent view is then used inside of MySQL -when accesing records using a cursor. */ +Create a consistent view for a cursor based on current transaction +which is created if the corresponding MySQL thread still lacks one. +This consistent view is then used inside of MySQL when accessing records +using a cursor. */ void* innobase_create_cursor_view(void) @@ -7145,9 +7165,9 @@ innobase_create_cursor_view(void) } /*********************************************************************** -This function closes the given consistent cursor view. Note that -global read view is restored to a transaction and a transaction is -started if it has not been started. */ +Close the given consistent cursor view of a transaction and restore +global read view to a transaction read view. Transaction is created if the +corresponding MySQL thread still lacks one. */ void innobase_close_cursor_view( @@ -7159,13 +7179,15 @@ innobase_close_cursor_view( } /*********************************************************************** -This function sets the given consistent cursor view to a transaction. -If a transaction does not exist, transaction is started. */ +Set the given consistent cursor view to a transaction which is created +if the corresponding MySQL thread still lacks one. If the given +consistent cursor view is NULL global read view of a transaction is +restored to a transaction read view. */ void innobase_set_cursor_view( /*=====================*/ - void* curview)/* in: Consistent cursor view to be closed */ + void* curview)/* in: Consistent cursor view to be set */ { read_cursor_set_for_mysql(check_trx_exists(current_thd), (cursor_view_t*) curview); diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index 2cbc1c8d91b..3bc1fc5b2c8 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -302,7 +302,7 @@ which is in the prepared state */ int innobase_rollback_by_xid( /* out: 0 or error number */ - XID *xid); /* in : X/Open XA Transaction Idenfification */ + XID *xid); /* in : X/Open XA Transaction Identification */ int innobase_xa_end(THD *thd); @@ -312,9 +312,10 @@ int innobase_repl_report_sent_binlog(THD *thd, char *log_file_name, my_off_t end_offset); /*********************************************************************** -This function creates a consistent view for a cursor and start a transaction -if it has not been started. This consistent view is then used inside of MySQL -when accesing records using a cursor. */ +Create a consistent view for a cursor based on current transaction +which is created if the corresponding MySQL thread still lacks one. +This consistent view is then used inside of MySQL when accessing records +using a cursor. */ void* innobase_create_cursor_view(void); @@ -322,9 +323,9 @@ innobase_create_cursor_view(void); /* out: Pointer to cursor view or NULL */ /*********************************************************************** -This function closes the given consistent cursor view. Note that -global read view is restored to a transaction and a transaction is -started if it has not been started. */ +Close the given consistent cursor view of a transaction and restore +global read view to a transaction read view. Transaction is created if the +corresponding MySQL thread still lacks one. */ void innobase_close_cursor_view( @@ -332,8 +333,10 @@ innobase_close_cursor_view( void* curview); /* in: Consistent read view to be closed */ /*********************************************************************** -This function sets the given consistent cursor view to a transaction. -If a transaction does not exist, transaction is started. */ +Set the given consistent cursor view to a transaction which is created +if the corresponding MySQL thread still lacks one. If the given +consistent cursor view is NULL global read view of a transaction is +restored to a transaction read view. */ void innobase_set_cursor_view( |