summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2021-10-05 12:56:11 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2022-01-20 14:44:56 +0400
commit466d81709bf0d1d73dcade887bdc88ff5330739e (patch)
treec57f885e2e7510b349f33d25dcae981f1b13064e
parent7922fbf7b7704db520ceec4ef5878fba632618f4 (diff)
downloadmariadb-git-466d81709bf0d1d73dcade887bdc88ff5330739e.tar.gz
MDEV-26768 Spider table crashes the server after the mysql_list_fields() client's call and produces weird result for SHOW FIELDS.bb-10.3-hf-2
Suppress errors in ha_spider::info() called from mysqld_show_fields()
-rw-r--r--storage/spider/ha_spider.cc18
-rw-r--r--storage/spider/mysql-test/spider/r/ha_part.result9
-rw-r--r--storage/spider/mysql-test/spider/t/ha_part.test7
3 files changed, 28 insertions, 6 deletions
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index 0f222577515..7f6b4ea1958 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -1125,7 +1125,8 @@ THR_LOCK_DATA **ha_spider::store_lock(
if (
sql_command == SQLCOM_DROP_TABLE ||
sql_command == SQLCOM_ALTER_TABLE ||
- sql_command == SQLCOM_SHOW_CREATE
+ sql_command == SQLCOM_SHOW_CREATE ||
+ sql_command == SQLCOM_SHOW_FIELDS
) {
if (
lock_type == TL_READ_NO_INSERT &&
@@ -8707,7 +8708,8 @@ int ha_spider::info(
spider_param_table_init_error_interval())
{
pthread_mutex_unlock(&share->sts_mutex);
- if (sql_command == SQLCOM_SHOW_CREATE)
+ if (sql_command == SQLCOM_SHOW_CREATE ||
+ sql_command == SQLCOM_SHOW_FIELDS)
{
if (thd->is_error())
{
@@ -8781,7 +8783,8 @@ int ha_spider::info(
share->init_error = TRUE;
share->init = TRUE;
}
- if (sql_command == SQLCOM_SHOW_CREATE)
+ if (sql_command == SQLCOM_SHOW_CREATE ||
+ sql_command == SQLCOM_SHOW_FIELDS)
{
if (thd->is_error())
{
@@ -8844,7 +8847,8 @@ int ha_spider::info(
share->init_error = TRUE;
share->init = TRUE;
}
- if (sql_command == SQLCOM_SHOW_CREATE)
+ if (sql_command == SQLCOM_SHOW_CREATE ||
+ sql_command == SQLCOM_SHOW_FIELDS)
{
if (thd->is_error())
{
@@ -8873,7 +8877,8 @@ int ha_spider::info(
if ((error_num = spider_create_sts_thread(share)))
{
pthread_mutex_unlock(&share->sts_mutex);
- if (sql_command == SQLCOM_SHOW_CREATE)
+ if (sql_command == SQLCOM_SHOW_CREATE ||
+ sql_command == SQLCOM_SHOW_FIELDS)
{
if (thd->is_error())
{
@@ -8904,7 +8909,8 @@ int ha_spider::info(
{
if ((error_num = check_crd()))
{
- if (sql_command == SQLCOM_SHOW_CREATE)
+ if (sql_command == SQLCOM_SHOW_CREATE ||
+ sql_command == SQLCOM_SHOW_FIELDS)
{
if (thd->is_error())
{
diff --git a/storage/spider/mysql-test/spider/r/ha_part.result b/storage/spider/mysql-test/spider/r/ha_part.result
index 315f37298bc..d70d62404c0 100644
--- a/storage/spider/mysql-test/spider/r/ha_part.result
+++ b/storage/spider/mysql-test/spider/r/ha_part.result
@@ -248,6 +248,15 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s')
8 g 2011-05-05 21:33:30
9 h 2011-05-05 22:32:10
DROP TABLE ta_l2;
+connection master_1;
+CREATE TABLE t (c INT) PARTITION BY LIST COLUMNS (c) (PARTITION p DEFAULT ENGINE=SPIDER);
+SHOW FIELDS FROM t;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+SHOW FIELDS FROM t;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+DROP TABLE t;
deinit
connection master_1;
diff --git a/storage/spider/mysql-test/spider/t/ha_part.test b/storage/spider/mysql-test/spider/t/ha_part.test
index 72ddcfd1f10..7e9d6f7715c 100644
--- a/storage/spider/mysql-test/spider/t/ha_part.test
+++ b/storage/spider/mysql-test/spider/t/ha_part.test
@@ -982,6 +982,13 @@ if ($HAVE_PARTITION)
}
}
+--connection master_1
+
+CREATE TABLE t (c INT) PARTITION BY LIST COLUMNS (c) (PARTITION p DEFAULT ENGINE=SPIDER);
+SHOW FIELDS FROM t;
+SHOW FIELDS FROM t;
+DROP TABLE t;
+
--echo
--echo deinit
--disable_warnings