diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-10-01 11:35:18 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-10-01 17:39:09 +0400 |
commit | a84fae27d9badef8cc89b1369a90cfef1dc3c715 (patch) | |
tree | ae4a1a2010a8665939f2f108713cc8fca0467bba | |
parent | e1cbca185139eed0ba3cf47807967b25f5a76ea1 (diff) | |
download | mariadb-git-a84fae27d9badef8cc89b1369a90cfef1dc3c715.tar.gz |
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.
-rw-r--r-- | sql/sql_show.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f64c30b88f5..bcc799dce7e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2888,6 +2888,15 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) 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 is from the same stage. @@ -2916,15 +2925,6 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) /* QUERY_ID */ 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); if (schema_table_store_record(thd, table)) |