From d524cb5b3ddf4dfcaf01c989b1d6fc76be854e15 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 4 Jun 2024 14:07:12 +1000 Subject: [PATCH] MDEV-34002 Initialise fields in spider_db_handler Otherwise it may result in nonsensical values like 190 for a boolean. --- .../spider/mysql-test/spider/bugfix/r/mdev_34002.result | 9 +++++++++ .../spider/mysql-test/spider/bugfix/t/mdev_34002.test | 7 +++++++ storage/spider/spd_db_include.h | 7 ++----- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_34002.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_34002.test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34002.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34002.result new file mode 100644 index 00000000000..7e266156e0a --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34002.result @@ -0,0 +1,9 @@ +INSTALL PLUGIN Spider SONAME 'ha_spider.so'; +CREATE TABLE t (c DATE, c2 VARCHAR(1025) CHARACTER SET utf8mb3, UNIQUE KEY k(c2)) ENGINE=SPIDER; +UPDATE t SET c='2'; +ERROR HY000: Unable to connect to foreign data source: localhost +drop table t; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown +Note 1305 PLUGIN SPIDER_ALLOC_MEM does not exist +Note 1305 PLUGIN SPIDER_WRAPPER_PROTOCOLS does not exist diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34002.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34002.test new file mode 100644 index 00000000000..575a306589d --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34002.test @@ -0,0 +1,7 @@ +INSTALL PLUGIN Spider SONAME 'ha_spider.so'; +CREATE TABLE t (c DATE, c2 VARCHAR(1025) CHARACTER SET utf8mb3, UNIQUE KEY k(c2)) ENGINE=SPIDER; +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +UPDATE t SET c='2'; +drop table t; +--disable_query_log +--source ../../include/clean_up_spider.inc diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 4f25b0a2fe1..0632a816995 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -1136,11 +1136,8 @@ public: ha_spider *spider; spider_db_share *db_share; int first_link_idx; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER - SPIDER_LINK_IDX_CHAIN *link_idx_chain; -#endif - bool strict_group_by; - bool no_where_cond; + bool strict_group_by= false; + bool no_where_cond= false; spider_db_handler(ha_spider *spider, spider_db_share *db_share) : dbton_id(db_share->dbton_id), spider(spider), db_share(db_share), first_link_idx(-1) {}