| 1 |
--source include/have_ndb.inc |
| 2 |
|
| 3 |
|
| 4 |
# Use large batch sizes to see behaviour in the limit |
| 5 |
set @saved_batch_size:=@@ndb_batch_size; |
| 6 |
set @saved_blob_write_batch:=@@ndb_blob_write_batch_bytes; |
| 7 |
set @saved_blob_read_batch:=@@ndb_blob_read_batch_bytes; |
| 8 |
|
| 9 |
set @batch_sz = 8 * 1024 * 1024; |
| 10 |
set global ndb_batch_size=@batch_sz; |
| 11 |
set ndb_batch_size=@batch_sz; |
| 12 |
set global ndb_blob_write_batch_bytes=@batch_sz; |
| 13 |
set ndb_blob_write_batch_bytes=@batch_sz; |
| 14 |
set global ndb_blob_read_batch_bytes=@batch_sz; |
| 15 |
set ndb_blob_read_batch_bytes=@batch_sz; |
| 16 |
|
| 17 |
let $_count_suffix=_session; |
| 18 |
|
| 19 |
# t1 - single blob table |
| 20 |
create table t1 (a varchar(10) character set utf8mb4 primary key, |
| 21 |
b text) engine=ndb; |
| 22 |
|
| 23 |
# t2 - multi blob table |
| 24 |
create table t2 (a varchar(10) character set utf8mb4 primary key, |
| 25 |
b text, |
| 26 |
c text) engine=ndb; |
| 27 |
|
| 28 |
# tv - varbinary table |
| 29 |
create table tv (a varchar(10) character set utf8mb4 primary key, |
| 30 |
b varbinary(5000)) engine=ndb; |
| 31 |
|
| 32 |
--echo Testing round trips with varying factors |
| 33 |
--echo rows - Number of rows affected by single statement |
| 34 |
--echo blobs - Number of blobs per row affected by single statement |
| 35 |
--echo autocommit - Whether autocommit or separate prepare, commit |
| 36 |
--echo parts - Whether the operation requires part rows ops or not |
| 37 |
--echo Update |
| 38 |
--echo blind/RMW - column value updated with no reference to existing |
| 39 |
--echo value |
| 40 |
--echo read-modify-write |
| 41 |
--echo - new column value is a function of existing value |
| 42 |
|
| 43 |
--echo ********************************************************* |
| 44 |
--echo Basic varbinary batching tests showing baseline behaviour |
| 45 |
--echo ********************************************************* |
| 46 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 47 |
|
| 48 |
--let $tablename=tv |
| 49 |
--let $valCol1=b |
| 50 |
--let $valCol2=0 |
| 51 |
|
| 52 |
--echo Single row |
| 53 |
--echo ---------- |
| 54 |
|
| 55 |
--echo INSERT single row, no parts, autocommit |
| 56 |
--echo Expect 2 RTs |
| 57 |
# Interesting : 1 RT ideally : Missing autocommit optimisation? |
| 58 |
--let $sql_statement=insert into tv values ("A", repeat("J", 20)); |
| 59 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 60 |
|
| 61 |
--echo INSERT Single row, no parts, prepare only |
| 62 |
--echo Expect 1 RT |
| 63 |
--let $sql_statement=begin; insert into tv values ("A", repeat("J", 20)); |
| 64 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 65 |
|
| 66 |
--echo UPDATE single row, no parts, autocommit, blind update |
| 67 |
--echo Expect 1 RT |
| 68 |
--let $sql_statement=update tv set b=repeat("Y",20) where a="Short1"; |
| 69 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 70 |
|
| 71 |
--echo UPDATE single row, no parts, autocommit, read-modify-write |
| 72 |
--echo Expect 2 RTs |
| 73 |
--let $sql_statement=update tv set b=concat(b, "U") where a="Short1"; |
| 74 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 75 |
|
| 76 |
--echo DELETE single row, no parts, autocommit |
| 77 |
--echo Expect 1 Rt |
| 78 |
--let $sql_statement=delete from tv where a="Short1"; |
| 79 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 80 |
|
| 81 |
--echo DELETE single row, no parts, prepare only |
| 82 |
--echo Expect 1 Rt |
| 83 |
--let $sql_statement=begin; delete from tv where a="Short1"; |
| 84 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 85 |
|
| 86 |
|
| 87 |
--echo Multi row |
| 88 |
--echo --------- |
| 89 |
|
| 90 |
# INSERT |
| 91 |
--echo INSERT multi row, no parts, autocommit |
| 92 |
--echo Expect 1 RT |
| 93 |
--let $sql_statement=insert into tv values ("C", repeat("C", 20)), ("D", repeat("T", 20)); |
| 94 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 95 |
|
| 96 |
--echo INSERT multi row, no parts, prepare only |
| 97 |
--echo Expect 1 Rt |
| 98 |
--let $sql_statement=begin; insert into tv values ("E", repeat("S", 20)), ("F", repeat("D", 20)); |
| 99 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 100 |
|
| 101 |
|
| 102 |
# UPDATE |
| 103 |
--echo UPDATE multi row, no parts, autocommit, blind update |
| 104 |
--echo Expect 1 Rt |
| 105 |
--let $sql_statement=update tv set b=repeat("Y",20) where a in ("Short1", "Short2"); |
| 106 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 107 |
|
| 108 |
|
| 109 |
--echo UPDATE multi row, no parts, autocommit, read-modify-write |
| 110 |
--echo Expect 2 Rts |
| 111 |
--let $sql_statement=update tv set b=concat(b, "M") where a in ("Short1", "Short2"); |
| 112 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 113 |
|
| 114 |
|
| 115 |
# DELETE |
| 116 |
--echo DELETE multi row, no parts, autocommit |
| 117 |
--echo Expect 1 Rt |
| 118 |
--let $sql_statement=delete from tv where a in ("Short1", "Short2"); |
| 119 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 120 |
|
| 121 |
--echo DELETE multi row, no parts, prepare-only |
| 122 |
--echo Expect 1 Rt |
| 123 |
--let $sql_statement=begin; delete from tv where a in("Short1", "Short2"); |
| 124 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
--echo ************************* |
| 129 |
--echo Basic blob batching tests |
| 130 |
--echo ************************* |
| 131 |
|
| 132 |
# FC : RBW removal allows blind updates to avoid RTs |
| 133 |
# FC : Exec on commit allows RT reduction |
| 134 |
|
| 135 |
--echo ----------------------------- |
| 136 |
--echo Single row, single blob tests |
| 137 |
--echo ----------------------------- |
| 138 |
|
| 139 |
--let $tablename=t1 |
| 140 |
--let $valCol1=b |
| 141 |
--let $valCol2=0 |
| 142 |
|
| 143 |
# INSERT |
| 144 |
--echo INSERT single row, single blob, no parts, autocommit |
| 145 |
--echo Expect 3 Rts |
| 146 |
# Interesting : Ideally 1 RT |
| 147 |
--let $sql_statement=insert into t1 values ("A", repeat("B", 20)); |
| 148 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 149 |
|
| 150 |
--echo INSERT single row, single blob, parts, autocommit |
| 151 |
--echo Expect 3 Rts |
| 152 |
# Interesting : Ideally 1 RT |
| 153 |
--let $sql_statement=insert into t1 values ("B", repeat("J", 5000)); |
| 154 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 155 |
|
| 156 |
--echo INSERT single row, single blob, no parts, prepare only |
| 157 |
--echo Expect 2 RTs |
| 158 |
--let $sql_statement=begin; insert into t1 values ("C", repeat("C", 20)); |
| 159 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 160 |
|
| 161 |
--echo INSERT single row, single blob, parts, prepare only |
| 162 |
--echo Expect 2 RTs |
| 163 |
--let $sql_statement=begin; insert into t1 values ("D", repeat("T", 40000)); |
| 164 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 165 |
|
| 166 |
# UPDATE |
| 167 |
|
| 168 |
--echo UPDATE single row, single blob, no parts, autocommit, blind update |
| 169 |
--echo Expect 4 Rts |
| 170 |
# Interesting, ideally 2 RTs |
| 171 |
--let $sql_statement=update t1 set b=repeat("Y",20) where a="Short1"; |
| 172 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 173 |
|
| 174 |
--echo UPDATE single row, single blob, no parts, autocommit, read-modify-write |
| 175 |
--echo Expect 4 Rts |
| 176 |
# Interesting, ideally 2 RTs |
| 177 |
--let $sql_statement=update t1 set b=concat(b, "U") where a="Short1"; |
| 178 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 179 |
|
| 180 |
--echo UPDATE single row, single blob, parts, autocommit, blind update |
| 181 |
--echo Expect 4 Rts |
| 182 |
# Interesting, ideally 2 RTs |
| 183 |
--let $sql_statement=update t1 set b=repeat("Y",40000) where a="Long1"; |
| 184 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 185 |
|
| 186 |
--echo UPDATE single row, single blob, parts, autocommit, read-modify-write |
| 187 |
--echo Expect 5 RTs |
| 188 |
# Interesting, ideally 3 RTs |
| 189 |
--let $sql_statement=update t1 set b=concat(b, "U") where a="Long1"; |
| 190 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 191 |
|
| 192 |
|
| 193 |
# DELETE |
| 194 |
--echo DELETE single row, single blob, no parts, autocommit |
| 195 |
--echo Expect 3 Rts |
| 196 |
# Interesting, ideally 2 RTs |
| 197 |
--let $sql_statement=delete from t1 where a="Short1"; |
| 198 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 199 |
|
| 200 |
--echo DELETE single row, single blob, parts, autocommit |
| 201 |
--echo Expect 3 Rts |
| 202 |
# Interesting, ideally 2 RTs |
| 203 |
--let $sql_statement=delete from t1 where a="Long1"; |
| 204 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 205 |
|
| 206 |
|
| 207 |
--echo ---------------------------- |
| 208 |
--echo Single row, multi blob tests |
| 209 |
--echo ---------------------------- |
| 210 |
--let $tablename=t2 |
| 211 |
--let $valCol1=b |
| 212 |
--let $valCol2=c |
| 213 |
|
| 214 |
# INSERT |
| 215 |
|
| 216 |
--echo INSERT single row, multi blob, no parts, autocommit |
| 217 |
--echo Expect 3 Rts |
| 218 |
# Interesting, ideally 1 RT |
| 219 |
--let $sql_statement=insert into t2 values ("A", repeat("B", 20), repeat("B", 20)); |
| 220 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 221 |
|
| 222 |
--echo INSERT single row, multi blob, parts, autocommit |
| 223 |
--echo Expect 3 Rts |
| 224 |
# Interesting, ideally 1 RT |
| 225 |
--let $sql_statement=insert into t2 values ("B", repeat("J", 5000), repeat("J", 5000)); |
| 226 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 227 |
|
| 228 |
--echo INSERT single row, multi blob, no parts, prepare only |
| 229 |
--echo Expect 2 Rts |
| 230 |
# Interesting, ideally 1 RT |
| 231 |
--let $sql_statement=begin; insert into t2 values("C", repeat("C", 20), repeat("C", 20)); |
| 232 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 233 |
|
| 234 |
--echo INSERT single row, multi blob, parts, prepare only |
| 235 |
--echo Expect 2 Rts |
| 236 |
# Interesting, ideally 1 RT |
| 237 |
--let $sql_statement=begin; insert into t2 values("D", repeat("T", 40000), repeat("C", 40000)); |
| 238 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 239 |
|
| 240 |
# UPDATE |
| 241 |
|
| 242 |
--echo UPDATE single row, multi blob, no parts, autocommit, blind update |
| 243 |
--echo Expect 4 Rts |
| 244 |
# Could be improved, but reads break batching |
| 245 |
--let $sql_statement=update t2 set b=repeat("Y",20), c=repeat("Y", 20) where a="Short1"; |
| 246 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 247 |
|
| 248 |
--echo UPDATE single row, multi blob, no parts, autocommit, read-modify-write |
| 249 |
--echo Expect 4 Rts |
| 250 |
# Could be improved, but reads break batching |
| 251 |
--let $sql_statement=update t2 set b=concat(b, "U"), c=concat(c, "U") where a="Short1"; |
| 252 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 253 |
|
| 254 |
--echo UPDATE single row, multi blob, parts, autocommit, blind update |
| 255 |
--echo Expect 4 Rts |
| 256 |
# Could be improved, but reads break batching |
| 257 |
--let $sql_statement=update t2 set b=repeat("Y",5000), c=repeat("Y", 5000) where a="Long1"; |
| 258 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 259 |
|
| 260 |
--echo UPDATE single row, multi blob, parts, autocommit, read-modify-write |
| 261 |
--echo Expect 6 RTs |
| 262 |
# Could be improved, but reads break batching |
| 263 |
--let $sql_statement=update t2 set b=concat(b, "U"), c=concat(c, "U") where a="Long1"; |
| 264 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 265 |
|
| 266 |
# DELETE |
| 267 |
|
| 268 |
--echo DELETE single row, multi blob, no parts, autocommit |
| 269 |
--echo Expect 3 Rts |
| 270 |
# Interesting, ideally 2 RTs |
| 271 |
--let $sql_statement=delete from t2 where a="Short1"; |
| 272 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 273 |
|
| 274 |
--echo DELETE single row, multi blob, parts, autocommit |
| 275 |
--echo Expect 4 Rts |
| 276 |
# Interesting, ideally 2 RTs |
| 277 |
--let $sql_statement=delete from t2 where a="Long1"; |
| 278 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 279 |
|
| 280 |
--echo --------------- |
| 281 |
--echo Multi row tests |
| 282 |
--echo --------------- |
| 283 |
|
| 284 |
--echo ---------------------------- |
| 285 |
--echo Multi row, single blob tests |
| 286 |
--echo ---------------------------- |
| 287 |
--let $tablename=t1 |
| 288 |
--let $valCol1=b |
| 289 |
--let $valCol2=0 |
| 290 |
|
| 291 |
# INSERT |
| 292 |
|
| 293 |
--echo INSERT multi row, single blob, no parts, autocommit |
| 294 |
--echo Expect 1 Rt |
| 295 |
--let $sql_statement=insert into t1 values ("A", repeat("B", 20)), ("B", repeat("J", 20)); |
| 296 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 297 |
|
| 298 |
--echo INSERT multi row, single blob, parts, autocommit |
| 299 |
--echo Expect 1 Rt |
| 300 |
--let $sql_statement=insert into t1 values ("C", repeat("C", 5000)), ("D", repeat("T", 5000)); |
| 301 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 302 |
|
| 303 |
--echo INSERT multi row, single blob, noparts, prepare only |
| 304 |
--echo Expect 2 Rts |
| 305 |
# Require 2 for safe IgnoreError Insert |
| 306 |
--let $sql_statement=begin; insert into t1 values ("E", repeat("B", 20)), ("F", repeat("J", 20)); |
| 307 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 308 |
|
| 309 |
--echo INSERT multi row, single blob, parts, prepare only |
| 310 |
--echo Expect 2 Rts |
| 311 |
--let $sql_statement=begin; insert into t1 values ("G", repeat("C", 5000)),("H", repeat("T", 5000)); |
| 312 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 313 |
|
| 314 |
# UPDATE |
| 315 |
|
| 316 |
# noparts |
| 317 |
--echo UPDATE multi row, single blob, no parts, autocommit, blind update |
| 318 |
--echo Expect 4 Rts |
| 319 |
# Could be improved, but reads break batching |
| 320 |
--let $sql_statement=update t1 set b=repeat("Y", 20) where a in ("Short1", "Short2"); |
| 321 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 322 |
|
| 323 |
--echo UPDATE multi row, single blob, no parts, autocommit, read-modify-write |
| 324 |
--echo Expect 6 Rts |
| 325 |
# Could be improved, but reads break batching |
| 326 |
--let $sql_statement=update t1 set b=concat(b, "U") where a in ("Short1", "Short2"); |
| 327 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 328 |
|
| 329 |
# parts |
| 330 |
--echo UPDATE multi row, single blob, parts, autocommit, blind update |
| 331 |
--echo Expect 4 Rts |
| 332 |
# Could be improved, but reads break batching |
| 333 |
--let $sql_statement=update t1 set b=repeat("M", 5000) where a in ("Long1", "Long2"); |
| 334 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 335 |
|
| 336 |
--echo UPDATE multi row, single blob, parts, autocommit, read-modify-write |
| 337 |
--echo Expect 8 Rts |
| 338 |
# Could be improved, but reads break batching |
| 339 |
--let $sql_statement=update t1 set b=concat(b, "M") where a in ("Long1", "Long2"); |
| 340 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 341 |
|
| 342 |
# DELETE |
| 343 |
|
| 344 |
# noparts |
| 345 |
--echo DELETE multi row, single blob, noparts, autocommit |
| 346 |
--echo expect 3 Rts |
| 347 |
# Interesting, ideally 2 RTs |
| 348 |
--let $sql_statement=delete from t1 where a in ("Short1", "Short2"); |
| 349 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 350 |
|
| 351 |
# parts |
| 352 |
--echo DELETE multi row, single blob, parts, autocommit |
| 353 |
--echo expect 3 Rts |
| 354 |
# Interesting, ideally 2 RTs |
| 355 |
--let $sql_statement=delete from t1 where a in ("Long1", "Long2"); |
| 356 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 357 |
|
| 358 |
|
| 359 |
--echo --------------------------- |
| 360 |
--echo Multi row, multi blob tests |
| 361 |
--echo --------------------------- |
| 362 |
--let $tablename=t2 |
| 363 |
--let $valCol1=b |
| 364 |
--let $valCol2=c |
| 365 |
|
| 366 |
# INSERT |
| 367 |
|
| 368 |
--echo INSERT multi row, multi blob, no parts, autocommit |
| 369 |
--echo Expect 1 Rt |
| 370 |
--let $sql_statement=insert into t2 values ("I", repeat("S", 20), repeat("S", 20)),("J", repeat("D", 20), repeat("D", 20)); |
| 371 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 372 |
|
| 373 |
--echo INSERT multi row, multi blob, parts, autocommit |
| 374 |
--echo Expect 1 Rt |
| 375 |
--let $sql_statement=insert into t2 values ("K", repeat("G", 5000), repeat("G", 5000)),("L", repeat("!", 5000), repeat("!", 5000)); |
| 376 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 377 |
|
| 378 |
--echo INSERT multi row, multi blob, no parts, prepare only |
| 379 |
--echo Expect 2 Rts |
| 380 |
# Required for safe IgnoreError insert |
| 381 |
--let $sql_statement=begin;insert into t2 values ("M", repeat("S", 20), repeat("S", 20)),("N", repeat("D", 20), repeat("D", 20)); |
| 382 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 383 |
|
| 384 |
--echo INSERT multi row, multi blob, parts, prepare only |
| 385 |
--echo Expect 2 Rts |
| 386 |
--let $sql_statement=begin;insert into t2 values ("O", repeat("G", 5000), repeat("G", 5000)),("P", repeat("!", 5000), repeat("!", 5000)); |
| 387 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 388 |
|
| 389 |
# UPDATE |
| 390 |
--echo UPDATE multi row, multi blob, no parts, autocommit, blind update |
| 391 |
--echo Expect 4 Rts |
| 392 |
# Could be improved, but reads break batching |
| 393 |
--let $sql_statement=update t2 set b=repeat("Y", 20), c= repeat("U", 20) where a in ("Short1", "Short2"); |
| 394 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 395 |
|
| 396 |
--echo UPDATE multi row, multi blob, no parts, autocommit, read-modify-write |
| 397 |
--echo Expect 6 Rts |
| 398 |
# Could be improved, but reads break batching |
| 399 |
--let $sql_statement=update t2 set b=concat(b, "M"), c= concat(b, "M") where a in ("Short1", "Short2"); |
| 400 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 401 |
|
| 402 |
--echo UPDATE multi row, multi blob, parts, autocommit, blind update |
| 403 |
--echo Expect 4 Rts |
| 404 |
# Could be improved, but reads break batching |
| 405 |
--let $sql_statement=update t2 set b=repeat("Y", 5000), c= repeat("U", 5000) where a in ("Long1", "Long2"); |
| 406 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 407 |
|
| 408 |
--echo UPDATE multi row, multi blob, parts, autocommit, read-modify-write |
| 409 |
--echo Expect 8 Rts |
| 410 |
# Could be improved, but reads break batching |
| 411 |
--let $sql_statement=update t2 set b=concat(b, "M"), c= concat(b, "M") where a in ("Long1", "Long2"); |
| 412 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 413 |
|
| 414 |
# DELETE |
| 415 |
# noparts |
| 416 |
--echo DELETE multi row, multi blob, no parts, autocommit |
| 417 |
--echo Expect 3 Rts |
| 418 |
# Interesting, ideally 2 RTs |
| 419 |
--let $sql_statement=delete from t2 where a in ("Short1", "Short2"); |
| 420 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 421 |
|
| 422 |
# parts |
| 423 |
--echo DELETE multi row, multi blob, parts, autocommit |
| 424 |
--echo Expect 3 Rts |
| 425 |
# Interesting, ideally 2 RTs |
| 426 |
--let $sql_statement=delete from t2 where a in ("Long1", "Long2"); |
| 427 |
--source suite/ndb/t/ndb_blob_helper.inc |
| 428 |
|
| 429 |
drop table t1; |
| 430 |
drop table t2; |
| 431 |
drop table tv; |
| 432 |
|
| 433 |
--echo **************************************** |
| 434 |
--echo Testing of various bulk insert scenarios |
| 435 |
--echo **************************************** |
| 436 |
|
| 437 |
--echo Create table with blob content on InnoDB, which can be scanned |
| 438 |
--echo without any Ndb round trips |
| 439 |
create table ta (a int primary key, b blob, c blob) engine=innodb; |
| 440 |
|
| 441 |
--disable_query_log |
| 442 |
--let $r=40 |
| 443 |
while($r) |
| 444 |
{ |
| 445 |
eval insert into ta values ($r, repeat("B", 5000), repeat("C", 5000)); |
| 446 |
--dec $r |
| 447 |
} |
| 448 |
--enable_query_log |
| 449 |
|
| 450 |
--echo ********************* |
| 451 |
--echo Test LOAD DATA INFILE |
| 452 |
--echo ********************* |
| 453 |
|
| 454 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 455 |
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR |
| 456 |
--eval select * into outfile '$MYSQLD_DATADIR/ta_data' from test.ta; |
| 457 |
|
| 458 |
--echo Varbinary Load Data Infile |
| 459 |
create table ti (a int primary key, b varbinary(5000), c varbinary(5000)) engine=ndb; |
| 460 |
|
| 461 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 462 |
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR |
| 463 |
--eval load data infile '$MYSQLD_DATADIR/ta_data' into table ti; |
| 464 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 465 |
drop table ti; |
| 466 |
|
| 467 |
--echo Blob Load Data Infile |
| 468 |
create table ti (a int primary key, b blob, c blob) engine=ndb; |
| 469 |
|
| 470 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 471 |
|
| 472 |
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR |
| 473 |
--eval load data infile '$MYSQLD_DATADIR/ta_data' into table ti; |
| 474 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 475 |
drop table ti; |
| 476 |
|
| 477 |
--remove_file $MYSQLD_DATADIR/ta_data |
| 478 |
|
| 479 |
|
| 480 |
--echo *************************** |
| 481 |
--echo Test Create Table As Select |
| 482 |
--echo *************************** |
| 483 |
|
| 484 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 485 |
--echo Varbinary CTAS |
| 486 |
create table tn (a int primary key, b varbinary(5000), c varbinary(5000)) engine=ndb |
| 487 |
as select * from ta; |
| 488 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 489 |
drop table tn; |
| 490 |
|
| 491 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 492 |
--echo Blob CTAS |
| 493 |
create table tn (a int primary key, b blob, c blob) engine=ndb |
| 494 |
as select * from ta; |
| 495 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 496 |
drop table tn; |
| 497 |
|
| 498 |
--echo ***************************** |
| 499 |
--echo Test ALTER engine bulk insert |
| 500 |
--echo ***************************** |
| 501 |
|
| 502 |
create table tb (a int primary key, b varbinary(5000), c varbinary(5000)) engine=innodb |
| 503 |
as select * from ta; |
| 504 |
--echo Varbinary ALTER |
| 505 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 506 |
alter table tb engine=ndb; |
| 507 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 508 |
drop table tb; |
| 509 |
|
| 510 |
--echo Blob ALTER |
| 511 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 512 |
alter table ta engine=ndb; |
| 513 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 514 |
drop table ta; |
| 515 |
|
| 516 |
--echo ************** |
| 517 |
--echo Test JSON type |
| 518 |
--echo ************** |
| 519 |
|
| 520 |
# The JSON type maps to a Blob in NdbApi, let's capture the round-trip |
| 521 |
# properties it has. |
| 522 |
|
| 523 |
--disable_result_log |
| 524 |
--disable_query_log |
| 525 |
select repeat('JS', 20000) into @content; |
| 526 |
--let $JSONVAL=query_get_value(select @content as j, j, 1) |
| 527 |
--enable_result_log |
| 528 |
--enable_query_log |
| 529 |
|
| 530 |
--echo Single JSON columns in row |
| 531 |
--echo -------------------------- |
| 532 |
|
| 533 |
create table js1 (a int primary key, b json) engine=ndb; |
| 534 |
|
| 535 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 536 |
|
| 537 |
--echo Single row JSON insert autocommit. |
| 538 |
--echo Expect 3 RTs |
| 539 |
--disable_query_log |
| 540 |
--eval insert into js1 values (1, '{"key1":"$JSONVAL"}'); |
| 541 |
--enable_query_log |
| 542 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 543 |
|
| 544 |
--echo Multi row JSON insert autocommit |
| 545 |
--echo Expect 1 RT |
| 546 |
--disable_query_log |
| 547 |
--eval insert into js1 values (2, '{"key1":"$JSONVAL"}'),(3, '{"key1":"$JSONVAL"}'),(4, '{"key1":"$JSONVAL"}'); |
| 548 |
--enable_query_log |
| 549 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 550 |
|
| 551 |
--echo Single row JSON update autocommit |
| 552 |
--echo Expect 4 RTs |
| 553 |
--disable_query_log |
| 554 |
--eval update js1 set b='{"key2":"$JSONVAL"}' where a=1; |
| 555 |
--enable_query_log |
| 556 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 557 |
|
| 558 |
--echo Multi row JSON update autocommit |
| 559 |
--echo Expect 4 RTs |
| 560 |
--disable_query_log |
| 561 |
--eval update js1 set b='{"key2":"$JSONVAL"}' where a in (2,3,4); |
| 562 |
--enable_query_log |
| 563 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 564 |
|
| 565 |
--echo Single row JSON delete autocommit |
| 566 |
--echo Expect 3 RTs |
| 567 |
delete from js1 where a=1; |
| 568 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 569 |
|
| 570 |
--echo Expect 3RTs |
| 571 |
delete from js1 where a in (2,3,4); |
| 572 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 573 |
drop table js1; |
| 574 |
|
| 575 |
|
| 576 |
--echo Multiple JSON columns in row |
| 577 |
--echo ---------------------------- |
| 578 |
create table js2 (a int primary key, b json, c json) engine=ndb; |
| 579 |
|
| 580 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 581 |
|
| 582 |
--echo Single row JSON insert autocommit. |
| 583 |
--echo Expect 3 RTs |
| 584 |
--disable_query_log |
| 585 |
--eval insert into js2 values (1, '{"key1":"$JSONVAL"}', '{"keyA":"$JSONVAL"}'); |
| 586 |
--enable_query_log |
| 587 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 588 |
|
| 589 |
--echo Multi row JSON insert autocommit |
| 590 |
--echo Expect 1 RT |
| 591 |
--disable_query_log |
| 592 |
--eval insert into js2 values (2, '{"key1":"$JSONVAL"}', '{"keyA":"$JSONVAL"}'),(3, '{"key1":"$JSONVAL"}', '{"keyA":"$JSONVAL"}'),(4, '{"key1":"$JSONVAL"}', '{"keyA":"$JSONVAL"}'); |
| 593 |
--enable_query_log |
| 594 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 595 |
|
| 596 |
--echo Single row JSON update autocommit |
| 597 |
--echo Expect 4 RTs |
| 598 |
--disable_query_log |
| 599 |
--eval update js2 set b='{"key2":"$JSONVAL"}', c='{"keyB":"$JSONVAL"}' where a=1; |
| 600 |
--enable_query_log |
| 601 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 602 |
|
| 603 |
--echo Multi row JSON update autocommit |
| 604 |
--echo Expect 4 RTs |
| 605 |
--disable_query_log |
| 606 |
--eval update js2 set b='{"key2":"$JSONVAL"}', c='{"keyB":"$JSONVAL"}' where a in (2,3,4); |
| 607 |
--enable_query_log |
| 608 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 609 |
|
| 610 |
--echo Single row JSON delete autocommit |
| 611 |
--echo Expect 3 RTs |
| 612 |
delete from js2 where a=1; |
| 613 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 614 |
|
| 615 |
--echo Expect 3RTs |
| 616 |
delete from js2 where a in (2,3,4); |
| 617 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 618 |
|
| 619 |
drop table js2; |
| 620 |
|
| 621 |
# Cleanup |
| 622 |
set global ndb_batch_size=@saved_batch_size; |
| 623 |
set ndb_batch_size=@saved_batch_size; |
| 624 |
set global ndb_blob_write_batch_bytes=@saved_blob_write_batch; |
| 625 |
set ndb_blob_write_batch_bytes=@saved_blob_write_batch; |
| 626 |
set global ndb_blob_read_batch_bytes=@saved_blob_read_batch; |
| 627 |
set ndb_blob_read_batch_bytes=@saved_blob_read_batch; |
| 628 |
|
| 629 |
# TODO |
| 630 |
# Replace |
| 631 |
# Insert on duplicate key update |
| 632 |
# Insert Ignore |
| 633 |
# Missing opt 1 : Autocommit can defer until commit time |
| 634 |
# Missing opt 2 : Read before Write removal? |
| 635 |
# Similar key |
| 636 |
# |