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 /innobase | |
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 'innobase')
-rw-r--r-- | innobase/include/read0read.h | 8 | ||||
-rw-r--r-- | innobase/include/trx0trx.h | 11 | ||||
-rw-r--r-- | innobase/read/read0read.c | 6 | ||||
-rw-r--r-- | innobase/row/row0sel.c | 12 | ||||
-rw-r--r-- | innobase/srv/srv0srv.c | 4 | ||||
-rw-r--r-- | innobase/srv/srv0start.c | 10 | ||||
-rw-r--r-- | innobase/trx/trx0trx.c | 20 |
7 files changed, 39 insertions, 32 deletions
diff --git a/innobase/include/read0read.h b/innobase/include/read0read.h index 1a7a86470a8..b5edcefb544 100644 --- a/innobase/include/read0read.h +++ b/innobase/include/read0read.h @@ -68,7 +68,6 @@ void read_view_print( /*============*/ read_view_t* view); /* in: read view */ - /************************************************************************* Create a consistent cursor view for mysql to be used in cursors. In this consistent read view modifications done by the creating transaction or future @@ -78,10 +77,9 @@ cursor_view_t* read_cursor_view_create_for_mysql( /*==============================*/ trx_t* cr_trx);/* in: trx where cursor view is created */ - /************************************************************************* -Close a given consistent cursor view for and restore global read view -back to a transaction. */ +Close a given consistent cursor view for mysql and restore global read view +back to a transaction read view. */ void read_cursor_view_close_for_mysql( @@ -90,7 +88,7 @@ read_cursor_view_close_for_mysql( cursor_view_t* curview); /* in: cursor view to be closed */ /************************************************************************* This function sets a given consistent cursor view to a transaction -read view if given consistent cursor view is not null. Otherwice, function +read view if given consistent cursor view is not NULL. Otherwise, function restores a global read view to a transaction read view. */ void diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index 2fc4d5a289f..a3ef755348c 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -606,14 +606,13 @@ struct trx_struct{ /* memory heap for the global read view */ read_view_t* global_read_view; - /* consistent read view used in the - transaction is stored here if - transaction is using a consistent - read view associated to a cursor */ + /* consistent read view associated + to a transaction or NULL */ read_view_t* read_view; /* consistent read view used in the transaction or NULL, this read view - can be normal read view associated - to a transaction or read view + if defined can be normal read view + associated to a transaction (i.e. + same as global_read_view) or read view associated to a cursor */ /*------------------------------*/ UT_LIST_BASE_NODE_T(trx_named_savept_t) diff --git a/innobase/read/read0read.c b/innobase/read/read0read.c index 76df7cdbee0..334f9a8a85a 100644 --- a/innobase/read/read0read.c +++ b/innobase/read/read0read.c @@ -347,8 +347,8 @@ read_cursor_view_create_for_mysql( } /************************************************************************* -Close a given consistent cursor view for and restore global read view -back to a transaction. */ +Close a given consistent cursor view for mysql and restore global read view +back to a transaction read view. */ void read_cursor_view_close_for_mysql( @@ -372,7 +372,7 @@ read_cursor_view_close_for_mysql( /************************************************************************* This function sets a given consistent cursor view to a transaction -read view if given consistent cursor view is not null. Otherwice, function +read view if given consistent cursor view is not NULL. Otherwise, function restores a global read view to a transaction read view. */ void diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 0b563eb147e..15881cb8c5d 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -3100,6 +3100,13 @@ row_search_for_mysql( "http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" "InnoDB: how you can resolve the problem.\n", prebuilt->table->name); + + /* Restore a global read view back to a transaction. This + forces MySQL always to set a cursor view before fetch from + a cursor. */ + + trx->read_view = trx->global_read_view; + return(DB_ERROR); } @@ -4091,8 +4098,9 @@ normal_return: } func_exit: - /* Restore a global read view back to transaction. This forces - MySQL always to set cursor view before fetch if it is used. */ + /* Restore a global read view back to a transaction. This + forces MySQL always to set a cursor view before fetch from + a cursor. */ trx->read_view = trx->global_read_view; diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 837c5be2bb6..dc85750f0be 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -1711,6 +1711,10 @@ srv_printf_innodb_monitor( fprintf(file, "%ld queries inside InnoDB, %lu queries in queue\n", (long) srv_conc_n_threads, (ulong) srv_conc_n_waiting_threads); + + fprintf(file, "%lu read views open inside InnoDB\n", + UT_LIST_GET_LEN(trx_sys->view_list)); + n_reserved = fil_space_get_n_reserved_extents(0); if (n_reserved > 0) { fprintf(file, diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 7798e0c8e32..ffe4ba08ee9 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -1833,6 +1833,16 @@ innobase_shutdown_for_mysql(void) srv_free(); os_sync_free(); + /* Check that all read views are closed except read view owned + by a purge. */ + + if (UT_LIST_GET_LEN(trx_sys->view_list) > 1) { + fprintf(stderr, +"InnoDB: Error: all read views were not closed before shutdown:\n" +"InnoDB: %lu read views open \n", + UT_LIST_GET_LEN(trx_sys->view_list) - 1); + } + /* 5. Free all allocated memory and the os_fast_mutex created in ut0mem.c */ diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index f95491443ee..1681bed9af2 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -833,26 +833,14 @@ trx_commit_off_kernel( lock_release_off_kernel(trx); - if (trx->read_view) { - /* If transaction has a global read view this case - means that transaction has been using a consistent - read view associated to a cursor. Only the global - read view associated to a transaction is closed - and read view is then removed from the transaction. - If read view associated to a cursor is still used - it must be re-registered to another transaction. */ - - if (UNIV_LIKELY_NULL(trx->global_read_view)) { - trx->read_view = trx->global_read_view; - } - - read_view_close(trx->read_view); - + if (trx->global_read_view) { + read_view_close(trx->global_read_view); mem_heap_empty(trx->global_read_view_heap); - trx->read_view = NULL; trx->global_read_view = NULL; } + trx->read_view = NULL; + if (must_flush_log) { mutex_exit(&kernel_mutex); |