Debian Codegraph @

mysql-test/suite/binlog_gtid/t/binlog_gtid_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 'ON',
18 # running any non-innocent statement other than one that explicitly sets
19 # `GTID_NEXT`'s value to a valid value, will trigger an error -
20 # `ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON`
21 #
22 # ==== Implementation ====
23 #
24 # TC.1 `BINLOG` + `Format_description` event inside an active transaction
25 # -----------------------------------------------------------------------
26 # 1) Begin a transaction.
27 # 2) Execute the `BINLOG` + `Format_description` event and expect an error -
28 # `ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION`.
29 # 3) End the current active transaction.
30 #
31 # TC.2 `BINLOG` + `Format_description` event with no active transaction
32 # ---------------------------------------------------------------------
33 # 1) Execute the `BINLOG` + `Format_description` event.
34 # 2) Check the value of `GTID_NEXT` to be 'NOT_YET_DETERMINED'.
35 #
36 # TC.3 `GTID_NEXT` = 'NOT_YET_DETERMINED' and try to execute a statement
37 # ----------------------------------------------------------------------
38 # 1) Execute a non-innocent statement that doesn't explicitly set the value of
39 # `GTID_NEXT` to a valid value and expect an error -
40 # `ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON`
41 # 2) Execute a statement that explicitly sets the value of `GTID_NEXT` to a
42 # valid value.
43 # 3) Execute a non-innocent statement that doesn't explicitly set the value of
44 # `GTID_NEXT` to a valid value and expect success.
45 #
46 # ==== References ====
47 #
48 # binlog_nogtid.binlog_nogitd_not_yet_determined_reacquire
49 #
50 # BUG#27903848 [MYSQL 8.0 GA DEBUG BUILD] ASSERTION `GTID_NEXT_TYPE ==
51 # ANONYMOUS_GTID' FAILED.
52 #
53
54 --echo # TC.1 `BINLOG` + `Format_description` event inside an active transaction
55 --echo # -----------------------------------------------------------------------
56
57 # 1) Begin a transaction.
58 BEGIN;
59
60 # 2) Execute the `BINLOG` + `Format_description` event and expect an error -
61 # `ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION`.
62 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
63 BINLOG
64 '3cTpWw8BAAAAeAAAAHwAAAABAAQAOC4wLjE0LWRlYnVnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
65 AAAAAAAAAAAAAAAAAADdxOlbEwANAAgAAAAABAAEAAAAYAAEGggAAAAICAgCAAAACgoKKioAEjQA
66 CgEyBOzV';
67
68 # 3) End the current active transaction.
69 COMMIT;
70
71 --echo # TC.2 `BINLOG` + `Format_description` event with no active transaction
72 --echo # ---------------------------------------------------------------------
73
74 # 1) Execute the `BINLOG` + `Format_description` event.
75 BINLOG
76 '3cTpWw8BAAAAeAAAAHwAAAABAAQAOC4wLjE0LWRlYnVnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
77 AAAAAAAAAAAAAAAAAADdxOlbEwANAAgAAAAABAAEAAAAYAAEGggAAAAICAgCAAAACgoKKioAEjQA
78 CgEyBOzV';
79
80 # 2) Check the value of `GTID_NEXT` to be 'NOT_YET_DETERMINED'.
81 --let $assert_text= Value of `GTID_NEXT` is `NOT_YET_DETERMINED`
82 --let $assert_cond= "[SELECT @@GTID_NEXT]" = "NOT_YET_DETERMINED"
83 --source include/assert.inc
84
85 --echo # TC.3 `GTID_NEXT` = 'NOT_YET_DETERMINED' and try to execute a statement
86 --echo # ----------------------------------------------------------------------
87
88 # 1) Execute a non-innocent statement that doesn't explicitly set the value of
89 # `GTID_NEXT` to a valid value and expect an error -
90 # `ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON`
91 --error ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON
92 CREATE TABLE t1 (col1 INT);
93
94 # 2) Execute a statement that explicitly sets the value of `GTID_NEXT` to a
95 # valid value.
96 SET @@GTID_NEXT = "AUTOMATIC";
97
98 # 3) Execute a non-innocent statement that doesn't explicitly set the value of
99 # `GTID_NEXT` to a valid value and expect success.
100 CREATE TABLE t1 (col1 INT);
101
102 --echo # Clean up.
103 DROP TABLE t1;