diff options
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/btr/btr0pcur.c | 2 | ||||
-rw-r--r-- | storage/innobase/btr/btr0sea.c | 7 | ||||
-rw-r--r-- | storage/innobase/include/read0read.h | 3 | ||||
-rw-r--r-- | storage/innobase/include/srv0srv.h | 1 | ||||
-rw-r--r-- | storage/innobase/include/trx0trx.h | 15 | ||||
-rw-r--r-- | storage/innobase/include/univ.i | 2 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.c | 8 | ||||
-rw-r--r-- | storage/innobase/read/read0read.c | 17 | ||||
-rw-r--r-- | storage/innobase/row/row0ins.c | 6 | ||||
-rw-r--r-- | storage/innobase/row/row0sel.c | 23 | ||||
-rw-r--r-- | storage/innobase/row/row0umod.c | 2 | ||||
-rw-r--r-- | storage/innobase/row/row0upd.c | 2 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.c | 3 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.c | 3 | ||||
-rw-r--r-- | storage/innobase/trx/trx0trx.c | 25 |
15 files changed, 71 insertions, 48 deletions
diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c index cb398b4afab..5dbbca0b17d 100644 --- a/storage/innobase/btr/btr0pcur.c +++ b/storage/innobase/btr/btr0pcur.c @@ -210,7 +210,7 @@ btr_pcur_restore_position( && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) { ut_print_buf(stderr, (const byte*)cursor, sizeof(btr_pcur_t)); if (cursor->trx_if_known) { - trx_print(stderr, cursor->trx_if_known); + trx_print(stderr, cursor->trx_if_known, 0); } ut_error; diff --git a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c index f705fee4275..7a4e92a672a 100644 --- a/storage/innobase/btr/btr0sea.c +++ b/storage/innobase/btr/btr0sea.c @@ -964,6 +964,13 @@ btr_search_drop_page_hash_index( heap = NULL; offsets = NULL; + if (block->index == NULL) { + + mem_analyze_corruption((byte*)block); + + ut_a(block->index != NULL); + } + while (!page_rec_is_supremum(rec)) { /* FIXME: in a mixed tree, not all records may have enough ordering fields: */ diff --git a/storage/innobase/include/read0read.h b/storage/innobase/include/read0read.h index b5edcefb544..7a91248cf7f 100644 --- a/storage/innobase/include/read0read.h +++ b/storage/innobase/include/read0read.h @@ -136,6 +136,9 @@ struct cursor_view_struct{ /* Memory heap for the cursor view */ read_view_t* read_view; /* Consistent read view of the cursor*/ + ulint n_mysql_tables_in_use; + /* number of Innobase tables used in the + processing of this cursor */ }; #ifndef UNIV_NONINL diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 116ae7b6438..11347f430d4 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -94,6 +94,7 @@ extern ulint srv_max_dirty_pages_pct; extern ulint srv_force_recovery; extern ulong srv_thread_concurrency; +extern ulong srv_commit_concurrency; extern ulint srv_max_n_threads; diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index a3ef755348c..5dbf003594f 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -329,17 +329,20 @@ trx_commit_step( /*============*/ /* out: query thread to run next, or NULL */ que_thr_t* thr); /* in: query thread */ + /************************************************************************** -Prints info about a transaction to the standard output. The caller must -own the kernel mutex and must have called -innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL or -InnoDB cannot meanwhile change the info printed here. */ +Prints info about a transaction to the given file. The caller must own the +kernel mutex and must have called +innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL +or InnoDB cannot meanwhile change the info printed here. */ void trx_print( /*======*/ - FILE* f, /* in: output stream */ - trx_t* trx); /* in: transaction */ + FILE* f, /* in: output stream */ + trx_t* trx, /* in: transaction */ + uint max_query_len); /* in: max query length to print, or 0 to + use the default max length */ #ifndef UNIV_HOTBACKUP /************************************************************************** diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 132ac9e18c5..6849dcd9c51 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -244,7 +244,7 @@ contains the sum of the following flag and the locally stored len. */ #define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE) /* Some macros to improve branch prediction and reduce cache misses */ -#if defined(__GNUC__) && (__GNUC__ > 2) +#if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER) /* Tell the compiler that 'expr' probably evaluates to 'constant'. */ # define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant) /* Tell the compiler that a pointer is likely to be NULL */ diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index 280c4871ee9..1f222d71d6a 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -3297,7 +3297,7 @@ lock_deadlock_recursive( fputs("\n*** (1) TRANSACTION:\n", ef); - trx_print(ef, wait_lock->trx); + trx_print(ef, wait_lock->trx, 3000); fputs( "*** (1) WAITING FOR THIS LOCK TO BE GRANTED:\n", ef); @@ -3310,7 +3310,7 @@ lock_deadlock_recursive( fputs("*** (2) TRANSACTION:\n", ef); - trx_print(ef, lock->trx); + trx_print(ef, lock->trx, 3000); fputs("*** (2) HOLDS THE LOCK(S):\n", ef); @@ -4207,7 +4207,7 @@ lock_print_info_all_transactions( while (trx) { if (trx->conc_state == TRX_NOT_STARTED) { fputs("---", file); - trx_print(file, trx); + trx_print(file, trx, 600); } trx = UT_LIST_GET_NEXT(mysql_trx_list, trx); @@ -4239,7 +4239,7 @@ loop: if (nth_lock == 0) { fputs("---", file); - trx_print(file, trx); + trx_print(file, trx, 600); if (trx->read_view) { fprintf(file, diff --git a/storage/innobase/read/read0read.c b/storage/innobase/read/read0read.c index 334f9a8a85a..06349c1fd39 100644 --- a/storage/innobase/read/read0read.c +++ b/storage/innobase/read/read0read.c @@ -286,6 +286,11 @@ read_cursor_view_create_for_mysql( curview = (cursor_view_t*) mem_heap_alloc(heap, sizeof(cursor_view_t)); curview->heap = heap; + /* Drop cursor tables from consideration when evaluating the need of + auto-commit */ + curview->n_mysql_tables_in_use = cr_trx->n_mysql_tables_in_use; + cr_trx->n_mysql_tables_in_use = 0; + mutex_enter(&kernel_mutex); curview->read_view = read_view_create_low( @@ -305,11 +310,13 @@ read_cursor_view_create_for_mysql( n = 0; trx = UT_LIST_GET_FIRST(trx_sys->trx_list); - /* No active transaction should be visible, not even cr_trx !*/ + /* No active transaction should be visible, except cr_trx. + This is quick fix for a bug 12456 and needs to be fixed when + semi-consistent high-granularity read view is implemented. */ while (trx) { - if (trx->conc_state == TRX_ACTIVE || - trx->conc_state == TRX_PREPARED) { + if (trx != cr_trx && (trx->conc_state == TRX_ACTIVE || + trx->conc_state == TRX_PREPARED)) { read_view_set_nth_trx_id(view, n, trx->id); @@ -360,6 +367,10 @@ read_cursor_view_close_for_mysql( ut_a(curview->read_view); ut_a(curview->heap); + /* Add cursor's tables to the global count of active tables that + belong to this transaction */ + trx->n_mysql_tables_in_use += curview->n_mysql_tables_in_use; + mutex_enter(&kernel_mutex); read_view_close(curview->read_view); diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index bce775c25d6..75d8117a73e 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -602,7 +602,7 @@ row_ins_foreign_report_err( rewind(ef); ut_print_timestamp(ef); fputs(" Transaction:\n", ef); - trx_print(ef, trx); + trx_print(ef, trx, 600); fputs("Foreign key constraint fails for table ", ef); ut_print_name(ef, trx, foreign->foreign_table_name); @@ -653,7 +653,7 @@ row_ins_foreign_report_add_err( rewind(ef); ut_print_timestamp(ef); fputs(" Transaction:\n", ef); - trx_print(ef, trx); + trx_print(ef, trx, 600); fputs("Foreign key constraint fails for table ", ef); ut_print_name(ef, trx, foreign->foreign_table_name); fputs(":\n", ef); @@ -1228,7 +1228,7 @@ run_again: rewind(ef); ut_print_timestamp(ef); fputs(" Transaction:\n", ef); - trx_print(ef, trx); + trx_print(ef, trx, 600); fputs("Foreign key constraint fails for table ", ef); ut_print_name(ef, trx, foreign->foreign_table_name); fputs(":\n", ef); diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 15881cb8c5d..a77010d939b 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -2685,7 +2685,7 @@ row_sel_get_clust_rec_for_mysql( "InnoDB: clust index record ", stderr); rec_print(stderr, clust_rec, clust_index); putc('\n', stderr); - trx_print(stderr, trx); + trx_print(stderr, trx, 600); fputs("\n" "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr); @@ -3101,12 +3101,6 @@ row_search_for_mysql( "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); } @@ -3130,12 +3124,17 @@ row_search_for_mysql( be zero; in that case select_lock_type is set to LOCK_X in ::start_stmt. */ +/* August 19, 2005 by Heikki: temporarily disable this error print until the +cursor lock count is done correctly. See bugs #12263 and #12456! + fputs( "InnoDB: Error: MySQL is trying to perform a SELECT\n" "InnoDB: but it has not locked any tables in ::external_lock()!\n", stderr); - trx_print(stderr, trx); + trx_print(stderr, trx, 600); fputc('\n', stderr); +*/ + } /* fprintf(stderr, "Match mode %lu\n search tuple ", (ulong) match_mode); @@ -3461,7 +3460,7 @@ shortcut_fails_too_big_rec: fputs( "InnoDB: Error: MySQL is trying to perform a consistent read\n" "InnoDB: but the read view is not assigned!\n", stderr); - trx_print(stderr, trx); + trx_print(stderr, trx, 600); fputc('\n', stderr); ut_a(0); } @@ -4098,12 +4097,6 @@ normal_return: } func_exit: - /* 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; - trx->op_info = ""; if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); diff --git a/storage/innobase/row/row0umod.c b/storage/innobase/row/row0umod.c index 0225a9faec5..f906027033f 100644 --- a/storage/innobase/row/row0umod.c +++ b/storage/innobase/row/row0umod.c @@ -431,7 +431,7 @@ row_undo_mod_del_unmark_sec_and_undo_update( "InnoDB: record ", stderr); rec_print(stderr, btr_pcur_get_rec(&pcur), index); putc('\n', stderr); - trx_print(stderr, trx); + trx_print(stderr, trx, 0); fputs("\n" "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr); } else { diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c index 514fb6bd577..4f44dbeae67 100644 --- a/storage/innobase/row/row0upd.c +++ b/storage/innobase/row/row0upd.c @@ -1279,7 +1279,7 @@ row_upd_sec_index_entry( rec_print(stderr, rec, index); putc('\n', stderr); - trx_print(stderr, trx); + trx_print(stderr, trx, 0); fputs("\n" "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr); diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index dc85750f0be..c585536baee 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -261,6 +261,7 @@ Value 10 should be good if there are less than 4 processors + 4 disks in the computer. Bigger computers need bigger values. */ ulong srv_thread_concurrency = SRV_CONCURRENCY_THRESHOLD; +ulong srv_commit_concurrency = 0; os_fast_mutex_t srv_conc_mutex; /* this mutex protects srv_conc data structures */ @@ -999,7 +1000,7 @@ retry: fputs( " InnoDB: Error: trying to declare trx to enter InnoDB, but\n" "InnoDB: it already is declared.\n", stderr); - trx_print(stderr, trx); + trx_print(stderr, trx, 0); putc('\n', stderr); os_fast_mutex_unlock(&srv_conc_mutex); diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index ffe4ba08ee9..325b0a109cf 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1054,7 +1054,8 @@ innobase_start_or_create_for_mysql(void) fprintf(stderr, "InnoDB: Error: You have specified innodb_buffer_pool_awe_mem_mb\n" -"InnoDB: in my.cnf, but AWE can only be used in Windows 2000 and later.\n"); +"InnoDB: in my.cnf, but AWE can only be used in Windows 2000 and later.\n" +"InnoDB: To use AWE, InnoDB must be compiled with __WIN2000__ defined.\n"); return(DB_ERROR); } diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c index 1681bed9af2..078befb81d2 100644 --- a/storage/innobase/trx/trx0trx.c +++ b/storage/innobase/trx/trx0trx.c @@ -30,8 +30,9 @@ Created 3/26/1996 Heikki Tuuri copy MUST be equal to the one in mysql/sql/ha_innodb.cc ! */ void innobase_mysql_print_thd( - FILE* f, - void* thd); + FILE* f, + void* thd, + uint max_query_len); /* Dummy session used currently in MySQL interface */ sess_t* trx_dummy_sess = NULL; @@ -262,7 +263,7 @@ trx_free( fputs( " InnoDB: Error: Freeing a trx which is declared to be processing\n" "InnoDB: inside InnoDB.\n", stderr); - trx_print(stderr, trx); + trx_print(stderr, trx, 600); putc('\n', stderr); } @@ -277,7 +278,7 @@ trx_free( (ulong)trx->n_mysql_tables_in_use, (ulong)trx->mysql_n_tables_locked); - trx_print(stderr, trx); + trx_print(stderr, trx, 600); ut_print_buf(stderr, (byte*)trx, sizeof(trx_t)); } @@ -1651,16 +1652,18 @@ trx_mark_sql_stat_end( } /************************************************************************** -Prints info about a transaction to the standard output. The caller must -own the kernel mutex and must have called -innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL or -InnoDB cannot meanwhile change the info printed here. */ +Prints info about a transaction to the given file. The caller must own the +kernel mutex and must have called +innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL +or InnoDB cannot meanwhile change the info printed here. */ void trx_print( /*======*/ - FILE* f, /* in: output stream */ - trx_t* trx) /* in: transaction */ + FILE* f, /* in: output stream */ + trx_t* trx, /* in: transaction */ + uint max_query_len) /* in: max query length to print, or 0 to + use the default max length */ { ibool newline; @@ -1755,7 +1758,7 @@ trx_print( } if (trx->mysql_thd != NULL) { - innobase_mysql_print_thd(f, trx->mysql_thd); + innobase_mysql_print_thd(f, trx->mysql_thd, max_query_len); } } |