diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 701d0c6eba333b643bab58193b4473312ae802a4..b4be3c2fd8ebbfcfd491adf3e0d00e9647307703 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -5746,13 +5746,6 @@ int ha_spider::info( DBUG_PRINT("info",("spider flag=%x", flag)); auto_inc_temporary = FALSE; wide_handler->sql_command = thd_sql_command(thd); -/* - if ( - sql_command == SQLCOM_DROP_TABLE || - sql_command == SQLCOM_ALTER_TABLE || - sql_command == SQLCOM_SHOW_CREATE - ) { -*/ if (flag & HA_STATUS_AUTO) { if (share->lgtm_tblhnd_share->auto_increment_value) @@ -8131,6 +8124,8 @@ void ha_spider::update_create_info( DBUG_PRINT("info",("spider this=%p", this)); if (wide_handler && wide_handler->sql_command == SQLCOM_ALTER_TABLE) { + if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &store_error_num))) + DBUG_VOID_RETURN; SPIDER_TRX *trx = wide_handler->trx; THD *thd = trx->thd; if (trx->query_id != thd->query_id) @@ -11621,6 +11616,8 @@ int ha_spider::append_lock_tables_list() DBUG_PRINT("info",("spider lock_table_type=%u", wide_handler->lock_table_type)); + if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) + DBUG_RETURN(error_num); if ((error_num = spider_check_trx_and_get_conn(wide_handler->trx->thd, this, FALSE))) { diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result new file mode 100644 index 0000000000000000000000000000000000000000..472a050a4f3a62cf9b6c0a323f194b60e7842849 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result @@ -0,0 +1,20 @@ +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t1 (c1 TIME) ENGINE=Spider PARTITION BY HASH(EXTRACT(HOUR_SECOND FROM c1)); +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT,c2 INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"'; +INSERT INTO t2 SELECT * FROM t3; +ERROR 21S01: Column count doesn't match value count at row 1 +SELECT * FROM t3; +ERROR HY000: Unable to connect to foreign data source: localhost +ALTER TABLE t1 CHANGE COLUMN c1 d1 INT; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +DROP TABLE t1,t2,t3; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test new file mode 100644 index 0000000000000000000000000000000000000000..08a699b93708013bf9dc9d90ca512279181a3526 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test @@ -0,0 +1,29 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +CREATE TABLE t1 (c1 TIME) ENGINE=Spider PARTITION BY HASH(EXTRACT(HOUR_SECOND FROM c1)); +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT,c2 INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"'; +--error ER_WRONG_VALUE_COUNT_ON_ROW +INSERT INTO t2 SELECT * FROM t3; +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +SELECT * FROM t3; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE t1 CHANGE COLUMN c1 d1 INT; +# Cleanup +DROP TABLE t1,t2,t3; + +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log