]>
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! | |
db82db79 AM |
8 | --- a/storage/innobase/handler/ha_innodb.cc |
9 | +++ b/storage/innobase/handler/ha_innodb.cc | |
10 | @@ -687,6 +687,8 @@ | |
b4e1fa2c AM |
11 | (char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG}, |
12 | {"dblwr_writes", | |
13 | (char*) &export_vars.innodb_dblwr_writes, SHOW_LONG}, | |
14 | + {"deadlocks", | |
15 | + (char*) &export_vars.innodb_deadlocks, SHOW_LONG}, | |
16 | {"dict_tables", | |
17 | (char*) &export_vars.innodb_dict_tables, SHOW_LONG}, | |
18 | {"have_atomic_builtins", | |
db82db79 AM |
19 | --- a/storage/innobase/include/lock0lock.h |
20 | +++ b/storage/innobase/include/lock0lock.h | |
b4e1fa2c AM |
21 | @@ -43,6 +43,7 @@ |
22 | #endif /* UNIV_DEBUG */ | |
23 | /* Buffer for storing information about the most recent deadlock error */ | |
24 | extern FILE* lock_latest_err_file; | |
25 | +extern ulint srv_n_lock_deadlock_count; | |
26 | ||
27 | /*********************************************************************//** | |
28 | Gets the size of a lock struct. | |
db82db79 AM |
29 | --- a/storage/innobase/include/srv0srv.h |
30 | +++ b/storage/innobase/include/srv0srv.h | |
adf0fb13 | 31 | @@ -758,6 +758,7 @@ |
b4e1fa2c AM |
32 | ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/ |
33 | ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */ | |
34 | ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */ | |
35 | + ulint innodb_deadlocks; | |
36 | ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */ | |
37 | ulint innodb_log_waits; /*!< srv_log_waits */ | |
38 | ulint innodb_log_write_requests; /*!< srv_log_write_requests */ | |
db82db79 AM |
39 | --- a/storage/innobase/lock/lock0lock.c |
40 | +++ b/storage/innobase/lock/lock0lock.c | |
41 | @@ -3330,6 +3330,7 @@ | |
b4e1fa2c AM |
42 | break; |
43 | ||
44 | case LOCK_VICTIM_IS_START: | |
45 | + srv_n_lock_deadlock_count++; | |
46 | fputs("*** WE ROLL BACK TRANSACTION (2)\n", | |
47 | lock_latest_err_file); | |
48 | break; | |
db82db79 AM |
49 | --- a/storage/innobase/srv/srv0srv.c |
50 | +++ b/storage/innobase/srv/srv0srv.c | |
adf0fb13 | 51 | @@ -468,6 +468,7 @@ |
b4e1fa2c AM |
52 | static ulint srv_n_rows_deleted_old = 0; |
53 | static ulint srv_n_rows_read_old = 0; | |
54 | ||
55 | +UNIV_INTERN ulint srv_n_lock_deadlock_count = 0; | |
56 | UNIV_INTERN ulint srv_n_lock_wait_count = 0; | |
57 | UNIV_INTERN ulint srv_n_lock_wait_current_count = 0; | |
58 | UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0; | |
adf0fb13 | 59 | @@ -2282,6 +2283,7 @@ |
b4e1fa2c AM |
60 | export_vars.innodb_buffer_pool_pages_data = LRU_len; |
61 | export_vars.innodb_buffer_pool_pages_dirty = flush_list_len; | |
62 | export_vars.innodb_buffer_pool_pages_free = free_len; | |
63 | + export_vars.innodb_deadlocks = srv_n_lock_deadlock_count; | |
64 | #ifdef UNIV_DEBUG | |
65 | export_vars.innodb_buffer_pool_pages_latched | |
66 | = buf_get_latched_pages_number(); |