| 1 |
############################################################################### |
| 2 |
# This test confirm that all information about SAVEPOINT identifiers is erased |
| 3 |
# after a COMMIT or ROLLBACK |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. Enable debug point that asserts that when adding a SAVEPOINT it's the |
| 7 |
# only one on savepoint map |
| 8 |
# 1. Create a table to insert data |
| 9 |
# 2. Commit a transaction and verify that when created a SAVEPOINT was the only |
| 10 |
# one identifier |
| 11 |
# 3. Rollback a transaction and verify that when created a SAVEPOINT was the only |
| 12 |
# one identifier |
| 13 |
# 4. Commit a transaction and verify that when created a SAVEPOINT was the only |
| 14 |
# one identifier |
| 15 |
# |
| 16 |
############################################################################### |
| 17 |
|
| 18 |
--source include/have_debug.inc |
| 19 |
--source include/have_binlog_format_row.inc |
| 20 |
|
| 21 |
SET @save_session_debug= @@SESSION.debug; |
| 22 |
SET @@SESSION.debug = "+d,transaction_write_set_savepoint_clear_on_commit_rollback"; |
| 23 |
|
| 24 |
CREATE TABLE t1 (c1 INT PRIMARY KEY); |
| 25 |
|
| 26 |
BEGIN; |
| 27 |
SAVEPOINT S0; |
| 28 |
INSERT INTO t1 VALUES (0); |
| 29 |
COMMIT; |
| 30 |
|
| 31 |
BEGIN; |
| 32 |
SAVEPOINT S1; |
| 33 |
INSERT INTO t1 VALUES (1); |
| 34 |
ROLLBACK; |
| 35 |
|
| 36 |
BEGIN; |
| 37 |
SAVEPOINT S2; |
| 38 |
INSERT INTO t1 VALUES (2); |
| 39 |
COMMIT; |
| 40 |
|
| 41 |
--let $assert_text= 'There are two values in table t1' |
| 42 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2 |
| 43 |
--source include/assert.inc |
| 44 |
|
| 45 |
# Cleanup |
| 46 |
SET @@SESSION.debug= @save_session_debug; |
| 47 |
DROP TABLE t1; |