Fix for bug #418
Increased skygw_query_type_t to 16 bits, and corrected the way how those bit fields are checked. Added tests for cases where autocommit is disabled and corrected old tests.
This commit is contained in:
@ -33,8 +33,8 @@ fi
|
||||
TINPUT=test_transaction_routing3.sql
|
||||
TRETVAL=2
|
||||
a=`$RUNCMD < ./$TINPUT`
|
||||
if [ "$a" != "$TRETVAL" ]; then
|
||||
echo "$TINPUT FAILED, return value $a when $TRETVAL was expected">>$TLOG;
|
||||
if [ "$a" == "$TMASTER_ID" ]; then
|
||||
echo "$TINPUT FAILED, return value $a when one of the slave IDs was expected">>$TLOG;
|
||||
else
|
||||
echo "$TINPUT PASSED">>$TLOG ;
|
||||
fi
|
||||
@ -113,3 +113,22 @@ if [ "$a" == "$TRETVAL" ]; then
|
||||
else
|
||||
echo "$TINPUT PASSED">>$TLOG ;
|
||||
fi
|
||||
|
||||
TINPUT=test_autocommit_disabled1.sql
|
||||
TRETVAL=1
|
||||
a=`$RUNCMD < ./$TINPUT`
|
||||
if [ "$a" != "$TRETVAL" ]; then
|
||||
echo "$TINPUT FAILED, return value $a when $TRETVAL was expected">>$TLOG;
|
||||
else
|
||||
echo "$TINPUT PASSED">>$TLOG ;
|
||||
fi
|
||||
|
||||
TINPUT=test_autocommit_disabled2.sql
|
||||
TRETVAL=1
|
||||
a=`$RUNCMD < ./$TINPUT`
|
||||
if [ "$a" != "$TRETVAL" ]; then
|
||||
echo "$TINPUT FAILED, return value $a when $TRETVAL was expected">>$TLOG;
|
||||
else
|
||||
echo "$TINPUT PASSED">>$TLOG ;
|
||||
fi
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
create table t1 (id integer);
|
||||
set autocommit=0; -- open transaction
|
||||
insert into t1 values(1); -- write to master
|
||||
select count(*) from t1; -- read from master
|
||||
drop table t1;
|
@ -0,0 +1,9 @@
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
create table t1 (id integer);
|
||||
set autocommit=0; -- open transaction
|
||||
begin;
|
||||
insert into t1 values(1); -- write to master
|
||||
commit;
|
||||
select count(*) from t1; -- read from master since autocommit is disabled
|
||||
drop table t1;
|
@ -1,5 +1,5 @@
|
||||
DROP DATABASE If EXISTS FOO;
|
||||
SET autocommit=0;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE DATABASE FOO; -- implicit commit
|
||||
SELECT (@@server_id) INTO @a;
|
||||
|
@ -1,7 +1,7 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS T1;
|
||||
DROP EVENT IF EXISTS myevent;
|
||||
SET autocommit=0;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE TABLE T1 (id integer);
|
||||
CREATE EVENT myevent
|
||||
|
@ -1,6 +1,6 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS T1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE TABLE T1 (id integer); -- implicit commit
|
||||
SELECT (@@server_id) INTO @a;
|
||||
|
@ -1,6 +1,6 @@
|
||||
USE test;
|
||||
DROP PROCEDURE IF EXISTS simpleproc;
|
||||
SET autocommit=0;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE simpleproc (OUT param1 INT)
|
||||
|
@ -1,6 +1,6 @@
|
||||
USE test;
|
||||
DROP FUNCTION IF EXISTS hello;
|
||||
SET autocommit=0;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE FUNCTION hello (s CHAR(20))
|
||||
RETURNS CHAR(50) DETERMINISTIC
|
||||
|
@ -1,7 +1,7 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS T1;
|
||||
CREATE TABLE T1 (id integer); -- implicit commit
|
||||
SET autocommit=0;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE INDEX foo_t1 on T1 (id); -- implicit commit
|
||||
SELECT (@@server_id) INTO @a;
|
||||
|
@ -1,19 +1,6 @@
|
||||
USE test;
|
||||
SET autocommit = 0;
|
||||
SET @a= -1;
|
||||
SET @b= -2;
|
||||
START TRANSACTION;
|
||||
CREATE TABLE IF NOT EXISTS myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
DELETE FROM myCity;
|
||||
SET @a = (SELECT COUNT(*) FROM myCity);
|
||||
ROLLBACK;
|
||||
START TRANSACTION;
|
||||
SET @b = (SELECT COUNT(*) FROM myCity);
|
||||
START TRANSACTION;
|
||||
DROP TABLE myCity;
|
||||
SELECT (@a+@b) AS res;
|
||||
COMMIT;
|
||||
use test; -- in both
|
||||
drop table if exists t1;
|
||||
create table t1 (id integer);
|
||||
insert into t1 values(1); -- in master
|
||||
commit;
|
||||
select count(*) from t1; -- in slave
|
||||
|
@ -1,10 +1,7 @@
|
||||
-- Read from slave after implicit COMMIT
|
||||
USE test;
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
CREATE TABLE IF NOT EXISTS myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
DELETE FROM myCity;
|
||||
SELECT COUNT(*) FROM myCity; -- read transaction's modifications from slave
|
||||
COMMIT;
|
||||
CREATE TABLE IF NOT EXISTS T2 (id integer);
|
||||
INSERT INTO T2 VALUES (@@server_id);
|
||||
SET AUTOCOMMIT=1;
|
||||
SELECT id from T2; -- read transaction's modifications from slave
|
||||
|
Reference in New Issue
Block a user