14
14
15
15
1 rows affected
16
16
17
+ 1 rows affected
18
+
17
19
0 rows affected
18
20
connecting...
19
21
active session is now 'session1'
@@ -32,7 +34,7 @@ switched to session session2
32
34
33
35
0 rows affected
34
36
doc
35
- {"a": 1 , "_id": "2"}
37
+ {"a": 2 , "_id": "2"}
36
38
command ok
37
39
doc
38
40
{"a": 1, "_id": "1"}
@@ -58,7 +60,7 @@ switched to session session2
58
60
59
61
0 rows affected
60
62
doc
61
- {"a": 1 , "_id": "2"}
63
+ {"a": 2 , "_id": "2"}
62
64
command ok
63
65
Got expected error: Lock wait timeout exceeded; try restarting transaction (code 1205)
64
66
Verify [Expecting performance_schema.data_locks to be not empty]
@@ -82,10 +84,10 @@ switched to session session2
82
84
83
85
0 rows affected
84
86
doc
85
- {"a": 1 , "_id": "2"}
87
+ {"a": 2 , "_id": "2"}
86
88
command ok
87
89
doc
88
- {"a": 1 , "_id": "3"}
90
+ {"a": 30 , "_id": "3"}
89
91
command ok
90
92
Got expected error: Lock wait timeout exceeded; try restarting transaction (code 1205)
91
93
Verify [Expecting performance_schema.data_locks to be not empty]
@@ -109,7 +111,7 @@ switched to session session2
109
111
110
112
0 rows affected
111
113
doc
112
- {"a": 1 , "_id": "2"}
114
+ {"a": 2 , "_id": "2"}
113
115
command ok
114
116
Got expected error: Lock wait timeout exceeded; try restarting transaction (code 1205)
115
117
Verify [Expecting performance_schema.data_locks to be not empty]
@@ -120,6 +122,166 @@ switched to session session2
120
122
121
123
0 rows affected
122
124
Verify [Expecting performance_schema.data_locks to be empty]
125
+ ######### Locking with aggregate #########
126
+ ######### Shared lock with grouping #########
127
+ switched to session session1
128
+ Verify [Expecting performance_schema.data_locks to be empty]
129
+
130
+ 0 rows affected
131
+ doc
132
+ {"a": 1, "_id": "1"}
133
+ command ok
134
+ Verify [Expecting performance_schema.data_locks to be not empty]
135
+ switched to session session2
136
+
137
+ 0 rows affected
138
+ doc
139
+ {"a": 1}
140
+ {"a": 2}
141
+ {"a": 30}
142
+ command ok
143
+ Verify [Expecting performance_schema.data_locks to be not empty]
144
+ switched to session session1
145
+
146
+ 0 rows affected
147
+ switched to session session2
148
+
149
+ 0 rows affected
150
+ Verify [Expecting performance_schema.data_locks to be empty]
151
+ ######### Exclusive lock with grouping #########
152
+ switched to session session1
153
+ Verify [Expecting performance_schema.data_locks to be empty]
154
+
155
+ 0 rows affected
156
+ doc
157
+ {"a": 1, "_id": "1"}
158
+ command ok
159
+ Verify [Expecting performance_schema.data_locks to be not empty]
160
+ switched to session session2
161
+
162
+ 0 rows affected
163
+ doc
164
+ {"a": 1}
165
+ {"a": 2}
166
+ {"a": 30}
167
+ command ok
168
+ Verify [Expecting performance_schema.data_locks to be not empty]
169
+ switched to session session1
170
+
171
+ 0 rows affected
172
+ switched to session session2
173
+
174
+ 0 rows affected
175
+ Verify [Expecting performance_schema.data_locks to be empty]
176
+ ######### Locking options #########
177
+ ######### Shared lock with NOWAIT #########
178
+ switched to session session1
179
+ Verify [Expecting performance_schema.data_locks to be empty]
180
+
181
+ 0 rows affected
182
+ doc
183
+ {"a": 1, "_id": "1"}
184
+ command ok
185
+ Verify [Expecting performance_schema.data_locks to be not empty]
186
+ switched to session session2
187
+
188
+ 0 rows affected
189
+ Got expected error: Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set. (code 3572)
190
+ Verify [Expecting performance_schema.data_locks to be not empty]
191
+ switched to session session1
192
+
193
+ 0 rows affected
194
+ switched to session session2
195
+
196
+ 0 rows affected
197
+ Verify [Expecting performance_schema.data_locks to be empty]
198
+ ######### Shared lock with SKIP LOCKED #########
199
+ switched to session session1
200
+ Verify [Expecting performance_schema.data_locks to be empty]
201
+
202
+ 0 rows affected
203
+ doc
204
+ {"a": 1, "_id": "1"}
205
+ command ok
206
+ Verify [Expecting performance_schema.data_locks to be not empty]
207
+ switched to session session2
208
+
209
+ 0 rows affected
210
+ doc
211
+ {"a": 2, "_id": "2"}
212
+ {"a": 30, "_id": "3"}
213
+ {"a": 30, "_id": "4"}
214
+ command ok
215
+ Verify [Expecting performance_schema.data_locks to be not empty]
216
+ switched to session session1
217
+
218
+ 0 rows affected
219
+ switched to session session2
220
+
221
+ 0 rows affected
222
+ Verify [Expecting performance_schema.data_locks to be empty]
223
+ ######### Exclusive lock with NOWAIT #########
224
+ switched to session session1
225
+ Verify [Expecting performance_schema.data_locks to be empty]
226
+
227
+ 0 rows affected
228
+ doc
229
+ {"a": 1, "_id": "1"}
230
+ command ok
231
+ Verify [Expecting performance_schema.data_locks to be not empty]
232
+ switched to session session2
233
+
234
+ 0 rows affected
235
+ Got expected error: Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set. (code 3572)
236
+ Verify [Expecting performance_schema.data_locks to be not empty]
237
+ switched to session session1
238
+
239
+ 0 rows affected
240
+ switched to session session2
241
+
242
+ 0 rows affected
243
+ Verify [Expecting performance_schema.data_locks to be empty]
244
+ ######### Exclusive lock with SKIP LOCKED #########
245
+ switched to session session1
246
+ Verify [Expecting performance_schema.data_locks to be empty]
247
+
248
+ 0 rows affected
249
+ doc
250
+ {"a": 1, "_id": "1"}
251
+ command ok
252
+ Verify [Expecting performance_schema.data_locks to be not empty]
253
+ switched to session session2
254
+
255
+ 0 rows affected
256
+ doc
257
+ {"a": 2, "_id": "2"}
258
+ {"a": 30, "_id": "3"}
259
+ {"a": 30, "_id": "4"}
260
+ command ok
261
+ Verify [Expecting performance_schema.data_locks to be not empty]
262
+ switched to session session1
263
+
264
+ 0 rows affected
265
+ switched to session session2
266
+
267
+ 0 rows affected
268
+ Verify [Expecting performance_schema.data_locks to be empty]
269
+ ######### NOWAIT set but no locking #########
270
+ Mysqlx.Error {
271
+ severity: ERROR
272
+ code: 5169
273
+ msg: "Invalid \"find\" message, \"locking\" field is required when \"locking_options\" is set."
274
+ sql_state: "HY000"
275
+ }
276
+
277
+ ######### SKIP LOCKED set but no locking #########
278
+ Mysqlx.Error {
279
+ severity: ERROR
280
+ code: 5169
281
+ msg: "Invalid \"find\" message, \"locking\" field is required when \"locking_options\" is set."
282
+ sql_state: "HY000"
283
+ }
284
+
123
285
closing session session2
124
286
Mysqlx.Ok {
125
287
msg: "bye!"
0 commit comments