MDEV-13918 Race condition between INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS and ALTER/DROP/TRUNCATE TABLE
i_s_sys_tables_fill_table_stats(): Acquire dict_operation_lock S-latch before acquiring dict_sys->mutex, to prevent the table from being removed from the data dictionary cache and from being freed while i_s_dict_fill_sys_tablestats() is accessing the table handle.
This commit is contained in:
parent
da4503e956
commit
2eb3c5e542
@ -6403,6 +6403,7 @@ i_s_sys_tables_fill_table_stats(
|
|||||||
}
|
}
|
||||||
|
|
||||||
heap = mem_heap_create(1000);
|
heap = mem_heap_create(1000);
|
||||||
|
rw_lock_s_lock(&dict_operation_lock);
|
||||||
mutex_enter(&dict_sys->mutex);
|
mutex_enter(&dict_sys->mutex);
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
|
|
||||||
@ -6429,9 +6430,11 @@ i_s_sys_tables_fill_table_stats(
|
|||||||
err_msg);
|
err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rw_lock_s_unlock(&dict_operation_lock);
|
||||||
mem_heap_empty(heap);
|
mem_heap_empty(heap);
|
||||||
|
|
||||||
/* Get the next record */
|
/* Get the next record */
|
||||||
|
rw_lock_s_lock(&dict_operation_lock);
|
||||||
mutex_enter(&dict_sys->mutex);
|
mutex_enter(&dict_sys->mutex);
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
rec = dict_getnext_system(&pcur, &mtr);
|
rec = dict_getnext_system(&pcur, &mtr);
|
||||||
@ -6439,6 +6442,7 @@ i_s_sys_tables_fill_table_stats(
|
|||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
mutex_exit(&dict_sys->mutex);
|
mutex_exit(&dict_sys->mutex);
|
||||||
|
rw_lock_s_unlock(&dict_operation_lock);
|
||||||
mem_heap_free(heap);
|
mem_heap_free(heap);
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
@ -6384,6 +6384,7 @@ i_s_sys_tables_fill_table_stats(
|
|||||||
}
|
}
|
||||||
|
|
||||||
heap = mem_heap_create(1000);
|
heap = mem_heap_create(1000);
|
||||||
|
rw_lock_s_lock(&dict_operation_lock);
|
||||||
mutex_enter(&dict_sys->mutex);
|
mutex_enter(&dict_sys->mutex);
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
|
|
||||||
@ -6410,9 +6411,11 @@ i_s_sys_tables_fill_table_stats(
|
|||||||
err_msg);
|
err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rw_lock_s_unlock(&dict_operation_lock);
|
||||||
mem_heap_empty(heap);
|
mem_heap_empty(heap);
|
||||||
|
|
||||||
/* Get the next record */
|
/* Get the next record */
|
||||||
|
rw_lock_s_lock(&dict_operation_lock);
|
||||||
mutex_enter(&dict_sys->mutex);
|
mutex_enter(&dict_sys->mutex);
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
rec = dict_getnext_system(&pcur, &mtr);
|
rec = dict_getnext_system(&pcur, &mtr);
|
||||||
@ -6420,6 +6423,7 @@ i_s_sys_tables_fill_table_stats(
|
|||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
mutex_exit(&dict_sys->mutex);
|
mutex_exit(&dict_sys->mutex);
|
||||||
|
rw_lock_s_unlock(&dict_operation_lock);
|
||||||
mem_heap_free(heap);
|
mem_heap_free(heap);
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user