]>
Commit | Line | Data |
---|---|---|
b4e1fa2c AM |
1 | # name : innodb_deadlock_count.patch |
2 | # introduced : 11 or before | |
3 | # maintainer : Yasufumi | |
4 | # | |
5 | #!!! notice !!! | |
6 | # Any small change to this file in the main branch | |
7 | # should be done or reviewed by the maintainer! | |
8 | diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc | |
9 | --- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:09:53.145500265 +0900 | |
10 | +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:10:24.605515894 +0900 | |
df1b5770 | 11 | @@ -687,6 +687,8 @@ |
b4e1fa2c AM |
12 | (char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG}, |
13 | {"dblwr_writes", | |
14 | (char*) &export_vars.innodb_dblwr_writes, SHOW_LONG}, | |
15 | + {"deadlocks", | |
16 | + (char*) &export_vars.innodb_deadlocks, SHOW_LONG}, | |
17 | {"dict_tables", | |
18 | (char*) &export_vars.innodb_dict_tables, SHOW_LONG}, | |
19 | {"have_atomic_builtins", | |
20 | diff -ruN a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h | |
21 | --- a/storage/innobase/include/lock0lock.h 2010-11-03 07:01:13.000000000 +0900 | |
22 | +++ b/storage/innobase/include/lock0lock.h 2010-12-04 16:10:24.605515894 +0900 | |
23 | @@ -43,6 +43,7 @@ | |
24 | #endif /* UNIV_DEBUG */ | |
25 | /* Buffer for storing information about the most recent deadlock error */ | |
26 | extern FILE* lock_latest_err_file; | |
27 | +extern ulint srv_n_lock_deadlock_count; | |
28 | ||
29 | /*********************************************************************//** | |
30 | Gets the size of a lock struct. | |
31 | diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h | |
32 | --- a/storage/innobase/include/srv0srv.h 2010-12-04 15:55:21.378480843 +0900 | |
33 | +++ b/storage/innobase/include/srv0srv.h 2010-12-04 16:10:24.606550983 +0900 | |
11822e22 | 34 | @@ -776,6 +776,7 @@ |
b4e1fa2c AM |
35 | ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/ |
36 | ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */ | |
37 | ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */ | |
38 | + ulint innodb_deadlocks; | |
39 | ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */ | |
40 | ulint innodb_log_waits; /*!< srv_log_waits */ | |
41 | ulint innodb_log_write_requests; /*!< srv_log_write_requests */ | |
42 | diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c | |
43 | --- a/storage/innobase/lock/lock0lock.c 2010-12-03 17:49:11.609953956 +0900 | |
44 | +++ b/storage/innobase/lock/lock0lock.c 2010-12-04 16:10:24.608513889 +0900 | |
45 | @@ -3328,6 +3328,7 @@ | |
46 | break; | |
47 | ||
48 | case LOCK_VICTIM_IS_START: | |
49 | + srv_n_lock_deadlock_count++; | |
50 | fputs("*** WE ROLL BACK TRANSACTION (2)\n", | |
51 | lock_latest_err_file); | |
52 | break; | |
53 | diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c | |
54 | --- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:57:13.069513371 +0900 | |
55 | +++ b/storage/innobase/srv/srv0srv.c 2010-12-04 16:10:24.610593039 +0900 | |
11822e22 | 56 | @@ -475,6 +475,7 @@ |
b4e1fa2c AM |
57 | static ulint srv_n_rows_deleted_old = 0; |
58 | static ulint srv_n_rows_read_old = 0; | |
59 | ||
60 | +UNIV_INTERN ulint srv_n_lock_deadlock_count = 0; | |
61 | UNIV_INTERN ulint srv_n_lock_wait_count = 0; | |
62 | UNIV_INTERN ulint srv_n_lock_wait_current_count = 0; | |
63 | UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0; | |
11822e22 | 64 | @@ -2293,6 +2294,7 @@ |
b4e1fa2c AM |
65 | export_vars.innodb_buffer_pool_pages_data = LRU_len; |
66 | export_vars.innodb_buffer_pool_pages_dirty = flush_list_len; | |
67 | export_vars.innodb_buffer_pool_pages_free = free_len; | |
68 | + export_vars.innodb_deadlocks = srv_n_lock_deadlock_count; | |
69 | #ifdef UNIV_DEBUG | |
70 | export_vars.innodb_buffer_pool_pages_latched | |
71 | = buf_get_latched_pages_number(); |