| 1 |
# |
| 2 |
# WL#6972: Collect GTIDs to include in the protocol's OK packet |
| 3 |
|
| 4 |
# The test goes like this: |
| 5 |
# 1. Statements are executed and depending whether they are |
| 6 |
# updates or not, they get GTID assigned |
| 7 |
# 2. After each statement, we track the contents of the return packet. |
| 8 |
# They are saved to the result file. |
| 9 |
# |
| 10 |
# |
| 11 |
# Scenarios tested: |
| 12 |
# 1. DDL |
| 13 |
# 2. Explicit RW transaction |
| 14 |
# 3. Implicit RW transaction commit |
| 15 |
# 4. RO transaction following an RW autocommit transaction |
| 16 |
# 5. Finally DDL again |
| 17 |
# |
| 18 |
# These scenarios are tested for all three values of the |
| 19 |
# variable SESSION_TRACK_GTIDS |
| 20 |
# |
| 21 |
|
| 22 |
--let $uuid= `SELECT @@server_uuid` |
| 23 |
--let $i=3 |
| 24 |
|
| 25 |
--enable_session_track_info |
| 26 |
|
| 27 |
while($i) |
| 28 |
{ |
| 29 |
if ($i == 3) |
| 30 |
{ |
| 31 |
--let $_option= ALL_GTIDS |
| 32 |
} |
| 33 |
if ($i == 2) |
| 34 |
{ |
| 35 |
--let $_option= OWN_GTID |
| 36 |
} |
| 37 |
if ($i == 1) |
| 38 |
{ |
| 39 |
--let $_option= OFF |
| 40 |
} |
| 41 |
|
| 42 |
--eval SET SESSION SESSION_TRACK_GTIDS=$_option |
| 43 |
RESET MASTER; |
| 44 |
|
| 45 |
# transaction 1 - $uuid:1 |
| 46 |
CREATE TABLE t1 (c1 INT) Engine=InnoDB; |
| 47 |
|
| 48 |
# transaction 2 - $uuid:2 |
| 49 |
BEGIN; |
| 50 |
INSERT INTO t1 VALUES (1); |
| 51 |
COMMIT; |
| 52 |
|
| 53 |
# transaction $uuid:3 and $uuid:4 |
| 54 |
BEGIN; |
| 55 |
INSERT INTO t1 VALUES (2); |
| 56 |
CREATE TABLE t2 (c1 INT) Engine=InnoDB; |
| 57 |
|
| 58 |
# Testing RO transaction following a RW transaction |
| 59 |
|
| 60 |
# transaction $uuid:5 |
| 61 |
INSERT INTO t2 VALUES (1); |
| 62 |
# RO transaction |
| 63 |
SELECT * FROM t1; |
| 64 |
|
| 65 |
BEGIN; |
| 66 |
INSERT INTO t1 VALUES (2); |
| 67 |
SAVEPOINT s; |
| 68 |
INSERT INTO t1 VALUES (3); |
| 69 |
ROLLBACK TO SAVEPOINT s; |
| 70 |
ROLLBACK; |
| 71 |
|
| 72 |
# transaction $uuid:6 |
| 73 |
DROP TABLE t1, t2; |
| 74 |
|
| 75 |
--dec $i |
| 76 |
} |
| 77 |
--disable_session_track_info |