Debian Codegraph @

mysql-test/suite/binlog_nogtid/t/binlog_nogtid_not_yet_determined_reacquire.test

raw
1 # ==== Purpose ====
2 #
3 # The purpose of this script is to test the behaviour of `GTID_NEXT` when a
4 # BINLOG statement holding a `Format_description` event is executed inside
5 # and/or outside a transaction.
6 #
7 # ==== Requirements ====
8 #
9 # R1. `GTID_NEXT` value should not be allowed to change when a transaction is
10 # active, even by a `BINLOG` statement holding a `Format_description` event
11 # - which is documented to change `GTID_NEXT`'s value to
12 # 'NOT_YET_DETERMINED'.
13 #
14 # R2. If `BINLOG` statement holding a `Format_description` event outside an
15 # active transaction, `GTID_NEXT`'s value must become 'NOT_YET_DETERMINED'.
16 #
17 # R3. When `GTID_NEXT`'s value is 'NOT_YET_DETERMINED' and `GTID_MODE` is 'OFF',
18 # running any non-innocent statement will set `GTID_NEXT`'s value to
19 # 'ANONYMOUS'
20 #
21 # ==== Implementation ====
22 #
23 # TC.1 `BINLOG` + `Format_description` event inside an active transaction
24 # -----------------------------------------------------------------------
25 # 1) Begin a transaction.
26 # 2) Execute the `BINLOG` + `Format_description` event and expect an error -
27 # `ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION`.
28 # 3) End the current active transaction.
29 #
30 # TC.2 `BINLOG` + `Format_description` event with no active transaction
31 # ---------------------------------------------------------------------
32 # 1) Execute the `BINLOG` + `Format_description` event.
33 # 2) Check the value of `GTID_NEXT` to be 'NOT_YET_DETERMINED'.
34 #
35 # TC.3 `GTID_NEXT` = 'NOT_YET_DETERMINED' and try to execute a statement
36 # ----------------------------------------------------------------------
37 # 1) Execute a non-innocent statement that doesn't explicitly set the value of
38 # `GTID_NEXT` to a valid value and expect success.
39 # 2) Check the value of `GTID_NEXT` to be 'ANONYMOUS'.
40 #
41 # ==== References ====
42 #
43 # binlog_gtid.binlog_gitd_not_yet_determined_reacquire
44 #
45 # BUG#27903848 [MYSQL 8.0 GA DEBUG BUILD] ASSERTION `GTID_NEXT_TYPE ==
46 # ANONYMOUS_GTID' FAILED.
47 #
48
49 --echo # TC.1 `BINLOG` + `Format_description` event inside an active transaction
50 --echo # -----------------------------------------------------------------------
51
52 # 1) Begin a transaction.
53 BEGIN;
54
55 # 2) Execute the `BINLOG` + `Format_description` event and expect an error -
56 # `ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION`.
57 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
58 BINLOG
59 '3cTpWw8BAAAAeAAAAHwAAAABAAQAOC4wLjE0LWRlYnVnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
60 AAAAAAAAAAAAAAAAAADdxOlbEwANAAgAAAAABAAEAAAAYAAEGggAAAAICAgCAAAACgoKKioAEjQA
61 CgEyBOzV';
62
63 # 3) End the current active transaction.
64 COMMIT;
65
66 --echo # TC.2 `BINLOG` + `Format_description` event with no active transaction
67 --echo # ---------------------------------------------------------------------
68
69 # 1) Execute the `BINLOG` + `Format_description` event.
70 BINLOG
71 '3cTpWw8BAAAAeAAAAHwAAAABAAQAOC4wLjE0LWRlYnVnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
72 AAAAAAAAAAAAAAAAAADdxOlbEwANAAgAAAAABAAEAAAAYAAEGggAAAAICAgCAAAACgoKKioAEjQA
73 CgEyBOzV';
74
75 # 2) Check the value of `GTID_NEXT` to be 'NOT_YET_DETERMINED'.
76 --let $assert_text= Value of `GTID_NEXT` is `NOT_YET_DETERMINED`
77 --let $assert_cond= "[SELECT @@GTID_NEXT]" = "NOT_YET_DETERMINED"
78 --source include/assert.inc
79
80 --echo # TC.3 `GTID_NEXT` = 'NOT_YET_DETERMINED' and try to execute a statement
81 --echo # ----------------------------------------------------------------------
82
83 # 1) Execute a non-innocent statement that doesn't explicitly set the value of
84 # `GTID_NEXT` to a valid value and expect success.
85 CREATE TABLE t1 (col1 INT);
86
87 # 2) Check the value of `GTID_NEXT` to be 'ANONYMOUS'.
88 --let $assert_text= Value of `GTID_NEXT` is `ANONYMOUS`
89 --let $assert_cond= "[SELECT @@GTID_NEXT]" = "ANONYMOUS"
90 --source include/assert.inc
91
92 --echo # Clean up.
93 SET @@GTID_NEXT = "AUTOMATIC";
94 DROP TABLE t1;