Commit c57d2957 authored by Yuchen Pei's avatar Yuchen Pei

MDEV-34636 Spider: reset wide_handler->trx in two occasions

ha_spider::update_create_info()
ha_spider::append_lock_tables_list()
parent 8c524bdf
...@@ -7805,13 +7805,6 @@ int ha_spider::info( ...@@ -7805,13 +7805,6 @@ int ha_spider::info(
auto_inc_temporary = FALSE; auto_inc_temporary = FALSE;
#endif #endif
wide_handler->sql_command = thd_sql_command(thd); 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 (flag & HA_STATUS_AUTO)
{ {
if (share->lgtm_tblhnd_share->auto_increment_value) if (share->lgtm_tblhnd_share->auto_increment_value)
...@@ -10869,6 +10862,8 @@ void ha_spider::update_create_info( ...@@ -10869,6 +10862,8 @@ void ha_spider::update_create_info(
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
if (wide_handler && wide_handler->sql_command == SQLCOM_ALTER_TABLE) 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; SPIDER_TRX *trx = wide_handler->trx;
THD *thd = trx->thd; THD *thd = trx->thd;
if (trx->query_id != thd->query_id) if (trx->query_id != thd->query_id)
...@@ -14772,6 +14767,8 @@ int ha_spider::append_lock_tables_list() ...@@ -14772,6 +14767,8 @@ int ha_spider::append_lock_tables_list()
DBUG_PRINT("info",("spider lock_table_type=%u", DBUG_PRINT("info",("spider lock_table_type=%u",
wide_handler->lock_table_type)); 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, if ((error_num = spider_check_trx_and_get_conn(wide_handler->trx->thd, this,
FALSE))) FALSE)))
{ {
......
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
--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
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