diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 06378462c53..d86afee51ca 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -433,6 +433,8 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_rows_read, SHOW_LONG}, {"rows_updated", (char*) &export_vars.innodb_rows_updated, SHOW_LONG}, + {"wake_ups", + (char*) &export_vars.innodb_wake_ups, SHOW_LONG}, {NullS, NullS, SHOW_LONG} }; diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 528c4053a2e..fa206f16415 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -251,6 +251,9 @@ extern ulint srv_read_ahead_seq; /* variable to count the number of random read-aheads were done */ extern ulint srv_read_ahead_rnd; +/* Number of threads that may have missed a lock wait wakeup */ +extern ulint sync_wake_ups; + /* In this structure we store status variables to be passed to MySQL */ typedef struct export_var_struct export_struc; @@ -545,6 +548,7 @@ struct export_var_struct{ ulint innodb_rows_inserted; ulint innodb_rows_updated; ulint innodb_rows_deleted; + ulint innodb_wake_ups; }; /* The server system struct */ diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index 305be04874f..6b1df957194 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -1939,6 +1939,7 @@ srv_export_innodb_status(void) export_vars.innodb_rows_inserted = srv_n_rows_inserted; export_vars.innodb_rows_updated = srv_n_rows_updated; export_vars.innodb_rows_deleted = srv_n_rows_deleted; + export_vars.innodb_wake_ups = sync_wake_ups; mutex_exit(&srv_innodb_monitor_mutex); } diff --git a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c index 5ee2a37bfd9..a03d6d13502 100644 --- a/storage/innobase/sync/sync0arr.c +++ b/storage/innobase/sync/sync0arr.c @@ -110,6 +110,10 @@ struct sync_array_struct { since creation of the array */ }; +/* Counts the number of times that sync_arr_wake_threads_if_sema_free has + * found a thread that can run because it may have missed a wakeup signal. */ +ulint sync_wake_ups = 0; + #ifdef UNIV_SYNC_DEBUG /********************************************************************** This function is called only in the debug version. Detects a deadlock @@ -481,7 +485,11 @@ sync_array_cell_print( || type == RW_LOCK_WAIT_EX || type == RW_LOCK_SHARED) { - fputs(type == RW_LOCK_EX ? "X-lock on" : "S-lock on", file); + switch(type) { + case RW_LOCK_EX: fputs("X-lock on", file); break; + case RW_LOCK_WAIT_EX: fputs("wait-X-lock on", file); break; + default: fputs("S-lock on", file); break; + } rwlock = cell->old_wait_rw_lock; @@ -884,6 +892,7 @@ sync_arr_wake_threads_if_sema_free(void) event = sync_cell_get_event(cell); os_event_set(event); + sync_wake_ups++; } }