Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Incomplete
-
10.5.6
Description
Following upgrade of our database from 10.2.8 to 10.5.6
Our database started to crash every days
[ERROR] [FATAL] InnoDB: Semaphore wait has lasted > 600 seconds. We intentionally crash the server because it appears to be hung.
After investigation see below, we decided to add primary key on table and also temporary table => No crash for several days. Hope it continue.
No change in our application
In the log I found relevant information to investigate and try to workaround:
Code involved:
--Thread 139635575420672 has waited at dict0boot.ic line 37 for xxx seconds the semaphore:
Mutex DICT_SYS created in dict0dict.cc:1032, lock var 2
*Doing some research I found the occurence of this wait was caused by inserting a row in a inno table without primary key.
*
row_ins -> row_ins_alloc_row_id_step -> dict_sys_get_new_row_id
See code row0ins.cc
/**********************************************************//*
Allocates a row id for row and inits the node->index field. */
UNIV_INLINE
void
row_ins_alloc_row_id_step(
/======================/
ins_node_t* node) /*!< in: row insert node */
{
row_id_t row_id;
ut_ad(node->state == INS_NODE_ALLOC_ROW_ID);
if (dict_index_is_unique(dict_table_get_first_index(node->table)))
{ /* No row id is stored if the clustered index is unique */ return; }/* Fill in row id value to row */
row_id = dict_sys_get_new_row_id();
dict_sys_write_row_id(node->sys_buf, row_id);
}