| 1 |
############################################################################### |
| 2 |
# This test confirm that when adding a SAVEPOINT with a identifier already |
| 3 |
# defined in transaction, the older one will be replaced by the new definirtion |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. Enable debug point that asserts that the SAVEPOINT position is equal |
| 7 |
# to write_set size and when executing ROLLBACK TO the write_set size is 1 |
| 8 |
# 1. Create a table to insert data |
| 9 |
# 2. Create SAVEPOINT S0 |
| 10 |
# 3. Insert values on t1 |
| 11 |
# 4. Redefine SAVEPOINT S0 that will overwrite previous definition |
| 12 |
# 5. ROLLBACK TO S0 that won't modify the content of t1 |
| 13 |
# |
| 14 |
############################################################################### |
| 15 |
|
| 16 |
|
| 17 |
--source include/have_debug.inc |
| 18 |
--source include/have_binlog_format_row.inc |
| 19 |
|
| 20 |
SET @save_session_debug= @@SESSION.debug; |
| 21 |
SET @@SESSION.debug = "+d,transaction_write_set_savepoint_add_savepoint"; |
| 22 |
|
| 23 |
CREATE TABLE t1 (c1 INT PRIMARY KEY); |
| 24 |
|
| 25 |
BEGIN; |
| 26 |
|
| 27 |
SAVEPOINT S0; |
| 28 |
INSERT INTO t1 VALUES (0); |
| 29 |
|
| 30 |
SAVEPOINT S0; |
| 31 |
ROLLBACK TO S0; |
| 32 |
|
| 33 |
COMMIT; |
| 34 |
|
| 35 |
--let $assert_text= 'There is one value in table t1' |
| 36 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 1 |
| 37 |
--source include/assert.inc |
| 38 |
|
| 39 |
# Cleanup |
| 40 |
SET @@SESSION.debug= @save_session_debug; |
| 41 |
DROP TABLE t1; |