-
V S Murthy Sidagam authored
INSTALL/UNINSTALL WITH CTRL+C Description: If we try to cancel install/uninstall operation using ctrl+c then there multiple component entries exists in mysql.component table for same component Analysis: 1) For Install component in mysql_persistent_dynamic_loader_imp::load() the thd->killed flag is checked only at open_component_table() 2) For Uninstall component in mysql_persistent_dynamic_loader_imp::unload() the thd->killed flag is checked in two places open_component_table() and h At #1, when kill query is recieved before open_component_table() fails with below error "The mysql.component table is missing or has an incorrect definition." And after open_component_table() thd->killed is not checked so, no roll back of tnx happens at all. At #2, when kill query is recieved before open_component_table() same, behaviour as #1. And when kill query is recieved just before ha_index_read_idx_map() (and say, after first iteration), then ha_index_read_idx_map() fails with error returned from the SE. And the roll back of transactions happens. But here, by then the dynamic_loader::unload has been done (Which is a undone operation). And also mysql_persistent_dynamic_loader_imp::component_id_by_urn has been updated. This mysql_persistent_dynamic_loader_imp::component_id_by_urn variable is used to controll the INSTALL/UNINSTALL urns from mysql.component table. Since the dynamic_loader::unload has been done and those urns also removed from mysql_persistent_dynamic_loader_imp::component_id_by_urn (but the not removed from mysql.component table because of ha_index_read_idx_map() failure), the next INSTALL COMPONENT stmt again adds the urns to the mysql.component table. This leads to residues in mysql.component table. Fix: For #1, It was noticed that If open_component_table() fails because of kill query, then the roll back of dynamic_loader::load is not done, this is because of mysql_dynamic_loader_imp::load() is called before open_component_table() and guard for mysql_dynamic_loader_imp::load() is registered after the open_component_table(). Hence fixed that, by arranging calls open_component_table(), mysql_dynamic_loader_imp::load() and guard for mysql_dynamic_loader_imp::load. And by chance if there is a failure form ha_write_row(), in that case, mysql_persistent_dynamic_loader_imp::component_id_by_urn variable has to be reset. So, did that. For #2, The mysql_dynamic_loader_imp::unload operation has been moved after ha_index_read_idx_map()/ha_index_read_idx_map() calls. Along with this mysql_persistent_dynamic_loader_imp::component_id_by_urn is restored in error cases of ha_index_read_idx_map()/ha_index_read_idx_map(). By moving mysql_dynamic_loader_imp::unload() to end, it helps in not having to undo the unload operation.
V S Murthy Sidagam authoredINSTALL/UNINSTALL WITH CTRL+C Description: If we try to cancel install/uninstall operation using ctrl+c then there multiple component entries exists in mysql.component table for same component Analysis: 1) For Install component in mysql_persistent_dynamic_loader_imp::load() the thd->killed flag is checked only at open_component_table() 2) For Uninstall component in mysql_persistent_dynamic_loader_imp::unload() the thd->killed flag is checked in two places open_component_table() and h At #1, when kill query is recieved before open_component_table() fails with below error "The mysql.component table is missing or has an incorrect definition." And after open_component_table() thd->killed is not checked so, no roll back of tnx happens at all. At #2, when kill query is recieved before open_component_table() same, behaviour as #1. And when kill query is recieved just before ha_index_read_idx_map() (and say, after first iteration), then ha_index_read_idx_map() fails with error returned from the SE. And the roll back of transactions happens. But here, by then the dynamic_loader::unload has been done (Which is a undone operation). And also mysql_persistent_dynamic_loader_imp::component_id_by_urn has been updated. This mysql_persistent_dynamic_loader_imp::component_id_by_urn variable is used to controll the INSTALL/UNINSTALL urns from mysql.component table. Since the dynamic_loader::unload has been done and those urns also removed from mysql_persistent_dynamic_loader_imp::component_id_by_urn (but the not removed from mysql.component table because of ha_index_read_idx_map() failure), the next INSTALL COMPONENT stmt again adds the urns to the mysql.component table. This leads to residues in mysql.component table. Fix: For #1, It was noticed that If open_component_table() fails because of kill query, then the roll back of dynamic_loader::load is not done, this is because of mysql_dynamic_loader_imp::load() is called before open_component_table() and guard for mysql_dynamic_loader_imp::load() is registered after the open_component_table(). Hence fixed that, by arranging calls open_component_table(), mysql_dynamic_loader_imp::load() and guard for mysql_dynamic_loader_imp::load. And by chance if there is a failure form ha_write_row(), in that case, mysql_persistent_dynamic_loader_imp::component_id_by_urn variable has to be reset. So, did that. For #2, The mysql_dynamic_loader_imp::unload operation has been moved after ha_index_read_idx_map()/ha_index_read_idx_map() calls. Along with this mysql_persistent_dynamic_loader_imp::component_id_by_urn is restored in error cases of ha_index_read_idx_map()/ha_index_read_idx_map(). By moving mysql_dynamic_loader_imp::unload() to end, it helps in not having to undo the unload operation.
Loading