Commit 282b92f0 authored by Yuchen Pei's avatar Yuchen Pei

MDEV-34589 Do not execute before queries in spider_db_mbase::rollback()

Rollback is not supposed to fail. This prevents false failures in
spider rollback.
parent 42735c55
for master_1
for child2
for child3
set spider_same_server_link= 1;
CREATE USER spider@localhost IDENTIFIED BY 'pwd';
GRANT ALL ON test.* TO spider@localhost;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd');
SET spider_internal_sql_log_off=0;
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2;
CHECK TABLE t2;
Table Op Msg_type Msg_text
test.t2 check error Partition p0 returned error
test.t2 check Error Access denied; you need (at least one of) the SUPER privilege(s) for this operation
test.t2 check Error Access denied; you need (at least one of) the SUPER privilege(s) for this operation
test.t2 check error Unknown - internal error 1227 during operation
drop table t1, t2;
drop server srv;
drop user spider@localhost;
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;
CREATE USER spider@localhost IDENTIFIED BY 'pwd';
GRANT ALL ON test.* TO spider@localhost;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd');
SET spider_internal_sql_log_off=0;
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2;
CHECK TABLE t2;
drop table t1, t2;
drop server srv;
drop user spider@localhost;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
...@@ -2548,13 +2548,21 @@ int spider_db_mbase::commit( ...@@ -2548,13 +2548,21 @@ int spider_db_mbase::commit(
int spider_db_mbase::rollback( int spider_db_mbase::rollback(
int *need_mon int *need_mon
) { ) {
bool is_error; bool is_error, save_in_before_query;
int error_num= 0; int error_num= 0;
DBUG_ENTER("spider_db_mbase::rollback"); DBUG_ENTER("spider_db_mbase::rollback");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
spider_lock_before_query(conn, need_mon); spider_lock_before_query(conn, need_mon);
if (spider_db_query(conn, SPIDER_SQL_ROLLBACK_STR, save_in_before_query= conn->in_before_query;
SPIDER_SQL_ROLLBACK_LEN, -1, need_mon)) /*
We do not execute the before queries to avoid unnecessary
failures in rollback
*/
conn->in_before_query= TRUE;
error_num= spider_db_query(conn, SPIDER_SQL_ROLLBACK_STR,
SPIDER_SQL_ROLLBACK_LEN, -1, need_mon);
conn->in_before_query= save_in_before_query;
if (error_num)
{ {
is_error= conn->thd->is_error(); is_error= conn->thd->is_error();
error_num= spider_db_errorno(conn); error_num= spider_db_errorno(conn);
......
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