Commit a84fae27 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-8836 - Server crashed in my_copy_8bit on querying I_S.PROCESSLIST

Fixed race condition in code filling INFORMATION_SCHEMA.PROCESSLIST.INFO_BINARY.
When loading query string/length of another connection one must have
LOCK_thd_data locked.
parent e1cbca18
...@@ -2888,6 +2888,15 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) ...@@ -2888,6 +2888,15 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[7]->set_notnull(); table->field[7]->set_notnull();
} }
/* INFO_BINARY */
if (tmp->query())
{
table->field[15]->store(tmp->query(),
MY_MIN(PROCESS_LIST_INFO_WIDTH,
tmp->query_length()), &my_charset_bin);
table->field[15]->set_notnull();
}
/* /*
Progress report. We need to do this under a lock to ensure that all Progress report. We need to do this under a lock to ensure that all
is from the same stage. is from the same stage.
...@@ -2916,15 +2925,6 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) ...@@ -2916,15 +2925,6 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
/* QUERY_ID */ /* QUERY_ID */
table->field[14]->store(tmp->query_id, TRUE); table->field[14]->store(tmp->query_id, TRUE);
/* INFO_BINARY */
if (tmp->query())
{
table->field[15]->store(tmp->query(),
MY_MIN(PROCESS_LIST_INFO_WIDTH,
tmp->query_length()), &my_charset_bin);
table->field[15]->set_notnull();
}
table->field[16]->store(tmp->os_thread_id); table->field[16]->store(tmp->os_thread_id);
if (schema_table_store_record(thd, table)) if (schema_table_store_record(thd, table))
......
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