Bug #19894161: FATAL SIGNAL 11 IN

               CONVERT_CHARSET_PARTITION_CONSTANT:
               SQL/SQL_PARTITION..CC:202

Issue:
-----
This problem happens under the following conditions:
1) A table partitioned with a character column as the key.
2) The expressions specified in the partition definition
   requires a charset conversion. This can happen when the
   server's default collation is different from the
   expression's collation.
3) INSERT DELAYED is used to insert data into the table.

SOLUTION:
---------
While creating the delayed_insert object, initialize it
with the relevant select_lex.
parent 415faa12
...@@ -1887,7 +1887,7 @@ public: ...@@ -1887,7 +1887,7 @@ public:
*/ */
MDL_request grl_protection; MDL_request grl_protection;
Delayed_insert() Delayed_insert(SELECT_LEX *current_select)
:locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0), :locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0),
status(0), handler_thread_initialized(FALSE), group_count(0) status(0), handler_thread_initialized(FALSE), group_count(0)
{ {
...@@ -1898,7 +1898,7 @@ public: ...@@ -1898,7 +1898,7 @@ public:
USERNAME_LENGTH); USERNAME_LENGTH);
thd.current_tablenr=0; thd.current_tablenr=0;
thd.command=COM_DELAYED_INSERT; thd.command=COM_DELAYED_INSERT;
thd.lex->current_select= 0; // for my_message_sql thd.lex->current_select= current_select;
thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock() thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
/* /*
Prevent changes to global.lock_wait_timeout from affecting Prevent changes to global.lock_wait_timeout from affecting
...@@ -2078,7 +2078,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request, ...@@ -2078,7 +2078,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
*/ */
if (! (di= find_handler(thd, table_list))) if (! (di= find_handler(thd, table_list)))
{ {
if (!(di= new Delayed_insert())) if (!(di= new Delayed_insert(thd->lex->current_select)))
goto end_create; goto end_create;
mysql_mutex_lock(&LOCK_thread_count); mysql_mutex_lock(&LOCK_thread_count);
thread_count++; thread_count++;
...@@ -2663,6 +2663,16 @@ pthread_handler_t handle_delayed_insert(void *arg) ...@@ -2663,6 +2663,16 @@ pthread_handler_t handle_delayed_insert(void *arg)
if (di->open_and_lock_table()) if (di->open_and_lock_table())
goto err; goto err;
/*
INSERT DELAYED generally expects thd->lex->current_select to be NULL,
since this is not an attribute of the current thread. This can lead to
problems if the thread that spawned the current one disconnects.
current_select will then point to freed memory. But current_select is
required to resolve the partition function. So, after fulfilling that
requirement, we set the current_select to 0.
*/
thd->lex->current_select= NULL;
/* Tell client that the thread is initialized */ /* Tell client that the thread is initialized */
mysql_cond_signal(&di->cond_client); mysql_cond_signal(&di->cond_client);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment