summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSreeharsha Ramanavarapu <sreeharsha.ramanavarapu@oracle.com>2015-10-06 07:09:36 +0530
committerSreeharsha Ramanavarapu <sreeharsha.ramanavarapu@oracle.com>2015-10-06 07:09:36 +0530
commit130b5fbf91520e504194eb59c16a6ce38006ff7a (patch)
treef2cd9bbca21ca621313709d46701bbd9ec0908cd /sql
parent415faa122b9c683661dafac82fff414fa6864151 (diff)
downloadmariadb-git-130b5fbf91520e504194eb59c16a6ce38006ff7a.tar.gz
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.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_insert.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 731aa82fe6e..7bfc7b083ac 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1887,7 +1887,7 @@ public:
*/
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),
status(0), handler_thread_initialized(FALSE), group_count(0)
{
@@ -1898,7 +1898,7 @@ public:
USERNAME_LENGTH);
thd.current_tablenr=0;
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()
/*
Prevent changes to global.lock_wait_timeout from affecting
@@ -2078,7 +2078,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
*/
if (! (di= find_handler(thd, table_list)))
{
- if (!(di= new Delayed_insert()))
+ if (!(di= new Delayed_insert(thd->lex->current_select)))
goto end_create;
mysql_mutex_lock(&LOCK_thread_count);
thread_count++;
@@ -2663,6 +2663,16 @@ pthread_handler_t handle_delayed_insert(void *arg)
if (di->open_and_lock_table())
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 */
mysql_cond_signal(&di->cond_client);