Debian Codegraph @

mysql-test/suite/x/r/connection_unixsocket_rpl.result

raw
1 include/master-slave.inc
2 Warnings:
3 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
5 [connection master]
6 call mtr.add_suppression("Error parsing message of type 12: args");
7 call mtr.add_suppression("Error handling message: args");
8 CREATE USER user_localhost@localhost IDENTIFIED WITH 'mysql_native_password' BY '';
9 GRANT ALL ON *.* TO user_localhost@localhost;
10 RUN SELECT CONNECTION_TYPE from performance_schema.threads where processlist_command='Query';
11 CONNECTION_TYPE
12 Socket
13 0 rows affected
14 RUN DROP DATABASE IF EXISTS xplugintest
15
16 0 rows affected
17 RUN CREATE DATABASE xplugintest
18
19 1 rows affected
20 RUN USE xplugintest
21
22 0 rows affected
23 RUN CREATE TABLE table1 ( _id INT PRIMARY KEY, doc JSON )
24
25 0 rows affected
26
27 command ok
28 Insert multiple rows into a Document column
29 send Mysqlx.Crud.Insert {
30 collection {
31 name: "table2"
32 schema: "xplugintest"
33 }
34 data_model: DOCUMENT
35 row {
36 field {
37 type: LITERAL
38 literal {
39 type: V_STRING
40 v_string {
41 value: "\n{\n \"_id\": \"1\",\n \"name\": \"Omar Bras\", \"id\": \"1\"\n}"
42 }
43 }
44 }
45 }
46 row {
47 field {
48 type: LITERAL
49 literal {
50 type: V_STRING
51 v_string {
52 value: "\n{\n \"_id\": \"2\",\n \"name\": \"Omar Mex\", \"id\": \"2\"\n}"
53 }
54 }
55 }
56 }
57 }
58
59
60 2 rows affected
61 Records: 2 Duplicates: 0 Warnings: 0
62 RUN SELECT * FROM xplugintest.table2
63 doc _id _json_schema
64 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"}
65 {"id": "2", "_id": "2", "name": "Omar Mex"} 2 {"type": "object"}
66 0 rows affected
67
68 command ok
69 RUN SHOW CREATE TABLE xplugintest.table2
70 Table Create Table
71 table2 CREATE TABLE `table2` (
72 `doc` json DEFAULT NULL,
73 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
74 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
75 `$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7` text GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$.name'))) VIRTUAL NOT NULL,
76 PRIMARY KEY (`_id`),
77 UNIQUE KEY `name_index` (`$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7`(50)),
78 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
79 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
80 0 rows affected
81 RUN SELECT * FROM xplugintest.table2
82 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
83 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
84 {"id": "2", "_id": "2", "name": "Omar Mex"} 2 {"type": "object"} Omar Mex
85 0 rows affected
86 Update decimal value with a corner value plus 1
87 send Mysqlx.Crud.Update {
88 collection {
89 name: "table2"
90 schema: "xplugintest"
91 }
92 data_model: DOCUMENT
93 criteria {
94 type: OPERATOR
95 operator {
96 name: "=="
97 param {
98 type: IDENT
99 identifier {
100 name: "_id"
101 }
102 }
103 param {
104 type: LITERAL
105 literal {
106 type: V_SINT
107 v_signed_int: 2
108 }
109 }
110 }
111 }
112 operation {
113 source {
114 document_path {
115 type: MEMBER
116 value: "name"
117 }
118 }
119 operation: ITEM_SET
120 value {
121 type: LITERAL
122 literal {
123 type: V_STRING
124 v_string {
125 value: "\"Omar Argentina\""
126 }
127 }
128 }
129 }
130 }
131
132
133 1 rows affected
134 Rows matched: 1 Changed: 1 Warnings: 0
135 RUN SHOW CREATE TABLE xplugintest.table2
136 Table Create Table
137 table2 CREATE TABLE `table2` (
138 `doc` json DEFAULT NULL,
139 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
140 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
141 `$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7` text GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$.name'))) VIRTUAL NOT NULL,
142 PRIMARY KEY (`_id`),
143 UNIQUE KEY `name_index` (`$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7`(50)),
144 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
145 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
146 0 rows affected
147 RUN SELECT JSON_EXTRACT(doc,'$.name') FROM xplugintest.table2
148 JSON_EXTRACT(doc,'$.name')
149 "Omar Bras"
150 "\"Omar Argentina\""
151 0 rows affected
152 RUN SELECT * FROM xplugintest.table2
153 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
154 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
155 {"id": "2", "_id": "2", "name": "\"Omar Argentina\""} 2 {"type": "object"} "Omar Argentina"
156 0 rows affected
157 Delete with == operator
158 send Mysqlx.Crud.Delete {
159 collection {
160 name: "table2"
161 schema: "xplugintest"
162 }
163 data_model: DOCUMENT
164 criteria {
165 type: OPERATOR
166 operator {
167 name: "=="
168 param {
169 type: IDENT
170 identifier {
171 name: "_id"
172 }
173 }
174 param {
175 type: LITERAL
176 literal {
177 type: V_SINT
178 v_signed_int: 2
179 }
180 }
181 }
182 }
183 }
184
185
186 1 rows affected
187 RUN SELECT JSON_EXTRACT(doc,'$.name') FROM xplugintest.table2
188 JSON_EXTRACT(doc,'$.name')
189 "Omar Bras"
190 0 rows affected
191 RUN SELECT * FROM xplugintest.table2
192 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
193 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
194 0 rows affected
195 send Mysqlx.Crud.Insert {
196 collection {
197 name: "table2"
198 schema: "xplugintest"
199 }
200 data_model: DOCUMENT
201 row {
202 field {
203 type: LITERAL
204 literal {
205 type: V_STRING
206 v_string {
207 value: "\n{\n \"_id\": \"3\",\n \"name\": \"Omar Peru\", \"id\": \"3\"\n}"
208 }
209 }
210 }
211 }
212 }
213
214
215 1 rows affected
216 send Mysqlx.Crud.Insert {
217 collection {
218 name: "table2"
219 schema: "xplugintest"
220 }
221 data_model: DOCUMENT
222 row {
223 field {
224 type: LITERAL
225 literal {
226 type: V_STRING
227 v_string {
228 value: "\n{\n \"_id\": \"1\",\n \"name\": \"Omar Colombia\", \"id\": \"3\"\n}"
229 }
230 }
231 }
232 }
233 }
234
235 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
236 RUN SELECT * FROM xplugintest.table2
237 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
238 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
239 {"id": "3", "_id": "3", "name": "Omar Peru"} 3 {"type": "object"} Omar Peru
240 0 rows affected
241 RUN INSERT INTO xplugintest.table1 VALUES (1,'{"a":["x", "y"]}'), (2,'{"b":["x", "y"]}')
242
243 2 rows affected
244 Records: 2 Duplicates: 0 Warnings: 0
245 RUN INSERT INTO xplugintest.table1 VALUES (3,'{"c":["x", "y"]}'), (2,'{"d":["x", "y"]}')
246 While executing INSERT INTO xplugintest.table1 VALUES (3,'{"c":["x", "y"]}'), (2,'{"d":["x", "y"]}'):
247 Got expected error: Duplicate entry '2' for key 'table1.PRIMARY' (code 1062)
248 RUN SELECT * FROM xplugintest.table1
249 _id doc
250 1 {"a": ["x", "y"]}
251 2 {"b": ["x", "y"]}
252 0 rows affected
253 RUN UPDATE xplugintest.table1 SET doc= '{"m":["x", "y"]}' WHERE _id=1
254
255 1 rows affected
256 Rows matched: 1 Changed: 1 Warnings: 0
257 RUN SELECT * FROM xplugintest.table1
258 _id doc
259 1 {"m": ["x", "y"]}
260 2 {"b": ["x", "y"]}
261 0 rows affected
262 Mysqlx.Ok {
263 msg: "bye!"
264 }
265 ok
266 include/sync_slave_sql_with_master.inc
267 # Connection:slave - Row with value 2 is expected on slave.
268 USE xplugintest;
269 SHOW CREATE TABLE xplugintest.table2;
270 Table Create Table
271 table2 CREATE TABLE `table2` (
272 `doc` json DEFAULT NULL,
273 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
274 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
275 `$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7` text GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$.name'))) VIRTUAL NOT NULL,
276 PRIMARY KEY (`_id`),
277 UNIQUE KEY `name_index` (`$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7`(50)),
278 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
279 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
280 SELECT * FROM xplugintest.table2;
281 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
282 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
283 {"id": "3", "_id": "3", "name": "Omar Peru"} 3 {"type": "object"} Omar Peru
284 SELECT * FROM xplugintest.table1;
285 _id doc
286 1 {"m": ["x", "y"]}
287 2 {"b": ["x", "y"]}
288 include/diff_tables.inc [master:xplugintest.table1, slave:xplugintest.table1]
289 include/diff_tables.inc [master:xplugintest.table2, slave:xplugintest.table2]
290 DROP DATABASE IF EXISTS xplugintest;
291 DROP USER IF EXISTS user_localhost@localhost;
292 include/sync_slave_sql_with_master.inc
293 include/rpl_end.inc