MySQL的多层SP中Cursor的m_max_cursor_index相关BUG分析

MySQL的多层SP中Cursor的m_max_cursor_index相关BUG分析

一、问题发现

在一次开发中用到的sp需要添加新的sp_instr以满足需求,但是添加了数个sp_instr以后发现执行新的sp会发生core。注:本次使用的MySQL数据库版本为最新的debug版本。

1、sp_head.cc的init_sp_psi_keys()代码里面添加10个新的sp_instr:

void init_sp_psi_keys() { mysql_statement_register(category, &sp_instr_stmt1::psi_info, 1); mysql_statement_register(category, &sp_instr_stmt2::psi_info, 1); mysql_statement_register(category, &sp_instr_stmt3::psi_info, 1); ...... mysql_statement_register(category, &sp_instr_stmt10::psi_info, 1); }