File: binlog_transaction_write_set_savepoint_clear_identifiers.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (47 lines) | stat: -rw-r--r-- 1,367 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
###############################################################################
# This test confirm that all information about SAVEPOINT identifiers is erased
# after a COMMIT or ROLLBACK
#
# Test:
#   0. Enable debug point that asserts that when adding a SAVEPOINT it's the
#   only one on savepoint map
#   1. Create a table to insert data
#   2. Commit a transaction and verify that when created a SAVEPOINT was the only
#   one identifier
#   3. Rollback a transaction and verify that when created a SAVEPOINT was the only
#   one identifier
#   4. Commit a transaction and verify that when created a SAVEPOINT was the only
#   one identifier
#
###############################################################################

--source include/have_debug.inc
--source include/have_binlog_format_row.inc

SET @save_session_debug= @@SESSION.debug;
SET @@SESSION.debug = "+d,transaction_write_set_savepoint_clear_on_commit_rollback";

CREATE TABLE t1 (c1 INT PRIMARY KEY);

BEGIN;
SAVEPOINT S0;
INSERT INTO t1 VALUES (0);
COMMIT;

BEGIN;
SAVEPOINT S1;
INSERT INTO t1 VALUES (1);
ROLLBACK;

BEGIN;
SAVEPOINT S2;
INSERT INTO t1 VALUES (2);
COMMIT;

--let $assert_text= 'There are two values in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2
--source include/assert.inc

# Cleanup
SET @@SESSION.debug= @save_session_debug;
DROP TABLE t1;