| 1 |
create schema xtest default charset 'utf8mb4'; |
| 2 |
######### preparation ######### |
| 3 |
|
| 4 |
command ok |
| 5 |
|
| 6 |
0 rows affected |
| 7 |
|
| 8 |
1 rows affected |
| 9 |
|
| 10 |
1 rows affected |
| 11 |
|
| 12 |
1 rows affected |
| 13 |
|
| 14 |
1 rows affected |
| 15 |
|
| 16 |
0 rows affected |
| 17 |
connecting... |
| 18 |
active session is now 'session1' |
| 19 |
connecting... |
| 20 |
active session is now 'session2' |
| 21 |
######### Shared lock after shared lock ######### |
| 22 |
switched to session session1 |
| 23 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 24 |
|
| 25 |
0 rows affected |
| 26 |
doc |
| 27 |
{"a": 1, "_id": "1"} |
| 28 |
command ok |
| 29 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 30 |
switched to session session2 |
| 31 |
|
| 32 |
0 rows affected |
| 33 |
doc |
| 34 |
{"a": 2, "_id": "2"} |
| 35 |
command ok |
| 36 |
doc |
| 37 |
{"a": 1, "_id": "1"} |
| 38 |
command ok |
| 39 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 40 |
switched to session session1 |
| 41 |
|
| 42 |
0 rows affected |
| 43 |
switched to session session2 |
| 44 |
|
| 45 |
0 rows affected |
| 46 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 47 |
######### Shared lock after exclusive lock ######### |
| 48 |
switched to session session1 |
| 49 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 50 |
|
| 51 |
0 rows affected |
| 52 |
doc |
| 53 |
{"a": 1, "_id": "1"} |
| 54 |
command ok |
| 55 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 56 |
switched to session session2 |
| 57 |
|
| 58 |
0 rows affected |
| 59 |
doc |
| 60 |
{"a": 2, "_id": "2"} |
| 61 |
command ok |
| 62 |
Got expected error: Lock wait timeout exceeded; try restarting transaction (code 1205) |
| 63 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 64 |
switched to session session1 |
| 65 |
|
| 66 |
0 rows affected |
| 67 |
switched to session session2 |
| 68 |
|
| 69 |
0 rows affected |
| 70 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 71 |
######### Exclusive lock after shared lock ######### |
| 72 |
switched to session session1 |
| 73 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 74 |
|
| 75 |
0 rows affected |
| 76 |
doc |
| 77 |
{"a": 1, "_id": "1"} |
| 78 |
command ok |
| 79 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 80 |
switched to session session2 |
| 81 |
|
| 82 |
0 rows affected |
| 83 |
doc |
| 84 |
{"a": 2, "_id": "2"} |
| 85 |
command ok |
| 86 |
doc |
| 87 |
{"a": 30, "_id": "3"} |
| 88 |
command ok |
| 89 |
Got expected error: Lock wait timeout exceeded; try restarting transaction (code 1205) |
| 90 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 91 |
switched to session session1 |
| 92 |
|
| 93 |
0 rows affected |
| 94 |
switched to session session2 |
| 95 |
|
| 96 |
0 rows affected |
| 97 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 98 |
######### Exclusive lock after exclusive lock ######### |
| 99 |
switched to session session1 |
| 100 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 101 |
|
| 102 |
0 rows affected |
| 103 |
doc |
| 104 |
{"a": 1, "_id": "1"} |
| 105 |
command ok |
| 106 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 107 |
switched to session session2 |
| 108 |
|
| 109 |
0 rows affected |
| 110 |
doc |
| 111 |
{"a": 2, "_id": "2"} |
| 112 |
command ok |
| 113 |
Got expected error: Lock wait timeout exceeded; try restarting transaction (code 1205) |
| 114 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 115 |
switched to session session1 |
| 116 |
|
| 117 |
0 rows affected |
| 118 |
switched to session session2 |
| 119 |
|
| 120 |
0 rows affected |
| 121 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 122 |
######### Locking with aggregate ######### |
| 123 |
######### Shared lock with grouping ######### |
| 124 |
switched to session session1 |
| 125 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 126 |
|
| 127 |
0 rows affected |
| 128 |
doc |
| 129 |
{"a": 1, "_id": "1"} |
| 130 |
command ok |
| 131 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 132 |
switched to session session2 |
| 133 |
|
| 134 |
0 rows affected |
| 135 |
doc |
| 136 |
{"a": 1} |
| 137 |
{"a": 2} |
| 138 |
{"a": 30} |
| 139 |
command ok |
| 140 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 141 |
switched to session session1 |
| 142 |
|
| 143 |
0 rows affected |
| 144 |
switched to session session2 |
| 145 |
|
| 146 |
0 rows affected |
| 147 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 148 |
######### Exclusive lock with grouping ######### |
| 149 |
switched to session session1 |
| 150 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 151 |
|
| 152 |
0 rows affected |
| 153 |
doc |
| 154 |
{"a": 1, "_id": "1"} |
| 155 |
command ok |
| 156 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 157 |
switched to session session2 |
| 158 |
|
| 159 |
0 rows affected |
| 160 |
doc |
| 161 |
{"a": 1} |
| 162 |
{"a": 2} |
| 163 |
{"a": 30} |
| 164 |
command ok |
| 165 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 166 |
switched to session session1 |
| 167 |
|
| 168 |
0 rows affected |
| 169 |
switched to session session2 |
| 170 |
|
| 171 |
0 rows affected |
| 172 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 173 |
######### Locking options ######### |
| 174 |
######### Shared lock with NOWAIT ######### |
| 175 |
switched to session session1 |
| 176 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 177 |
|
| 178 |
0 rows affected |
| 179 |
doc |
| 180 |
{"a": 1, "_id": "1"} |
| 181 |
command ok |
| 182 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 183 |
switched to session session2 |
| 184 |
|
| 185 |
0 rows affected |
| 186 |
Got expected error: Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set. (code 3572) |
| 187 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 188 |
switched to session session1 |
| 189 |
|
| 190 |
0 rows affected |
| 191 |
switched to session session2 |
| 192 |
|
| 193 |
0 rows affected |
| 194 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 195 |
######### Shared lock with SKIP LOCKED ######### |
| 196 |
switched to session session1 |
| 197 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 198 |
|
| 199 |
0 rows affected |
| 200 |
doc |
| 201 |
{"a": 1, "_id": "1"} |
| 202 |
command ok |
| 203 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 204 |
switched to session session2 |
| 205 |
|
| 206 |
0 rows affected |
| 207 |
doc |
| 208 |
{"a": 2, "_id": "2"} |
| 209 |
{"a": 30, "_id": "3"} |
| 210 |
{"a": 30, "_id": "4"} |
| 211 |
command ok |
| 212 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 213 |
switched to session session1 |
| 214 |
|
| 215 |
0 rows affected |
| 216 |
switched to session session2 |
| 217 |
|
| 218 |
0 rows affected |
| 219 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 220 |
######### Exclusive lock with NOWAIT ######### |
| 221 |
switched to session session1 |
| 222 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 223 |
|
| 224 |
0 rows affected |
| 225 |
doc |
| 226 |
{"a": 1, "_id": "1"} |
| 227 |
command ok |
| 228 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 229 |
switched to session session2 |
| 230 |
|
| 231 |
0 rows affected |
| 232 |
Got expected error: Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set. (code 3572) |
| 233 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 234 |
switched to session session1 |
| 235 |
|
| 236 |
0 rows affected |
| 237 |
switched to session session2 |
| 238 |
|
| 239 |
0 rows affected |
| 240 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 241 |
######### Exclusive lock with SKIP LOCKED ######### |
| 242 |
switched to session session1 |
| 243 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 244 |
|
| 245 |
0 rows affected |
| 246 |
doc |
| 247 |
{"a": 1, "_id": "1"} |
| 248 |
command ok |
| 249 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 250 |
switched to session session2 |
| 251 |
|
| 252 |
0 rows affected |
| 253 |
doc |
| 254 |
{"a": 2, "_id": "2"} |
| 255 |
{"a": 30, "_id": "3"} |
| 256 |
{"a": 30, "_id": "4"} |
| 257 |
command ok |
| 258 |
Verify [Expecting performance_schema.data_locks to be not empty] |
| 259 |
switched to session session1 |
| 260 |
|
| 261 |
0 rows affected |
| 262 |
switched to session session2 |
| 263 |
|
| 264 |
0 rows affected |
| 265 |
Verify [Expecting performance_schema.data_locks to be empty] |
| 266 |
######### NOWAIT set but no locking ######### |
| 267 |
Mysqlx.Error { |
| 268 |
severity: ERROR |
| 269 |
code: 5169 |
| 270 |
msg: "Invalid \"find\" message, \"locking\" field is required when \"locking_options\" is set." |
| 271 |
sql_state: "HY000" |
| 272 |
} |
| 273 |
|
| 274 |
######### SKIP LOCKED set but no locking ######### |
| 275 |
Mysqlx.Error { |
| 276 |
severity: ERROR |
| 277 |
code: 5169 |
| 278 |
msg: "Invalid \"find\" message, \"locking\" field is required when \"locking_options\" is set." |
| 279 |
sql_state: "HY000" |
| 280 |
} |
| 281 |
|
| 282 |
closing session session2 |
| 283 |
Mysqlx.Ok { |
| 284 |
msg: "bye!" |
| 285 |
} |
| 286 |
ok |