| 1 |
result_format: 2 |
| 2 |
## CREATE and INSERT definitions of extended Blob feature BLOB_INLINE_SIZE |
| 3 |
CREATE TABLE test.defs( |
| 4 |
a int primary key, |
| 5 |
b blob, |
| 6 |
bm mediumblob, |
| 7 |
bl longblob, |
| 8 |
t text, |
| 9 |
tm mediumtext, |
| 10 |
tl longtext, |
| 11 |
j json) engine=ndb; |
| 12 |
|
| 13 |
## Verify inline and partition sizes of test.defs |
| 14 |
SELECT inline_size, part_size FROM ndbinfo.blobs WHERE table_name = 'defs'; |
| 15 |
inline_size part_size |
| 16 |
256 2000 |
| 17 |
256 4000 |
| 18 |
256 13948 |
| 19 |
256 2000 |
| 20 |
256 4000 |
| 21 |
256 13948 |
| 22 |
4000 8100 |
| 23 |
|
| 24 |
DROP TABLE test.defs; |
| 25 |
|
| 26 |
## Create table with inline values of 0 |
| 27 |
CREATE TABLE test.zeroinline( |
| 28 |
a int primary key, |
| 29 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=0", |
| 30 |
bm mediumblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=0", |
| 31 |
bl longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=0", |
| 32 |
t text comment "NDB_COLUMN=BLOB_INLINE_SIZE=0", |
| 33 |
tm mediumtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=0", |
| 34 |
tl longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=0", |
| 35 |
j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=0") engine=ndb; |
| 36 |
|
| 37 |
## Verify inline and partition sizes of test.zeroinline |
| 38 |
SELECT inline_size, part_size FROM ndbinfo.blobs WHERE table_name = 'zeroinline'; |
| 39 |
inline_size part_size |
| 40 |
0 2000 |
| 41 |
0 4000 |
| 42 |
0 13948 |
| 43 |
0 2000 |
| 44 |
0 4000 |
| 45 |
0 13948 |
| 46 |
0 8100 |
| 47 |
|
| 48 |
DROP TABLE test.zeroinline; |
| 49 |
|
| 50 |
## Create table with less than default inline values |
| 51 |
CREATE TABLE test.shortinline( |
| 52 |
a int primary key, |
| 53 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 54 |
bm mediumblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 55 |
bl longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 56 |
t text comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 57 |
tm mediumtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 58 |
tl longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 59 |
j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=10") engine=ndb; |
| 60 |
|
| 61 |
## Verify inline and partition sizes of test.shortinline |
| 62 |
SELECT inline_size, part_size FROM ndbinfo.blobs WHERE table_name = 'shortinline'; |
| 63 |
inline_size part_size |
| 64 |
10 2000 |
| 65 |
10 4000 |
| 66 |
10 13948 |
| 67 |
10 2000 |
| 68 |
10 4000 |
| 69 |
10 13948 |
| 70 |
10 8100 |
| 71 |
|
| 72 |
## Insert and validate test.shortinline |
| 73 |
INSERT INTO test.shortinline VALUES ( |
| 74 |
1, |
| 75 |
repeat('J',60000), |
| 76 |
repeat('J',60000), |
| 77 |
repeat('J',60000), |
| 78 |
repeat(_utf32 0x1F47E,15000), |
| 79 |
repeat(_utf32 0x1F47E,60000), |
| 80 |
repeat(_utf32 0x1F47E,60000), |
| 81 |
"{\"f\": \"12\"}"); |
| 82 |
|
| 83 |
SELECT a, sha1(b), sha1(bm), sha1(bl), sha1(t), sha1(tm), sha1(tl), sha1(j) FROM test.shortinline; |
| 84 |
a sha1(b) sha1(bm) sha1(bl) sha1(t) sha1(tm) sha1(tl) sha1(j) |
| 85 |
1 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 5adfaa7bc57d12afbafae28fbe2497f36e604ff9 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 097feaddb29114042fe77f8cdfc7aa6b9074b939 |
| 86 |
DROP TABLE test.shortinline; |
| 87 |
|
| 88 |
## Create table with large inline values |
| 89 |
CREATE TABLE test.longinline( |
| 90 |
a int primary key, |
| 91 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=3000", |
| 92 |
bm mediumblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=3000", |
| 93 |
bl longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=3000", |
| 94 |
t text comment "NDB_COLUMN=BLOB_INLINE_SIZE=3000", |
| 95 |
tm mediumtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=3000", |
| 96 |
tl longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=3000", |
| 97 |
j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=6000") engine=ndb; |
| 98 |
|
| 99 |
## Verify inline and partition sizes of test.longinline |
| 100 |
SELECT inline_size, part_size FROM ndbinfo.blobs WHERE table_name = 'longinline'; |
| 101 |
inline_size part_size |
| 102 |
3000 2000 |
| 103 |
3000 4000 |
| 104 |
3000 13948 |
| 105 |
3000 2000 |
| 106 |
3000 4000 |
| 107 |
3000 13948 |
| 108 |
6000 8100 |
| 109 |
|
| 110 |
## Insert and validate |
| 111 |
INSERT INTO test.longinline values ( |
| 112 |
1, |
| 113 |
repeat('J',60000), |
| 114 |
repeat('J',60000), |
| 115 |
repeat('J',60000), |
| 116 |
repeat(_utf32 0x1F47E,15000), |
| 117 |
repeat(_utf32 0x1F47E,60000), |
| 118 |
repeat(_utf32 0x1F47E,60000), |
| 119 |
"{\"f\": \"12\"}"); |
| 120 |
|
| 121 |
SELECT a, sha1(b), sha1(bm), sha1(bl), sha1(t), sha1(tm), sha1(tl), sha1(j) FROM test.longinline; |
| 122 |
a sha1(b) sha1(bm) sha1(bl) sha1(t) sha1(tm) sha1(tl) sha1(j) |
| 123 |
1 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 5adfaa7bc57d12afbafae28fbe2497f36e604ff9 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 097feaddb29114042fe77f8cdfc7aa6b9074b939 |
| 124 |
DROP TABLE test.longinline; |
| 125 |
|
| 126 |
## Create table with some inline values below their default |
| 127 |
CREATE TABLE test.mixedinline( |
| 128 |
a int primary key, |
| 129 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=20000", |
| 130 |
bm mediumblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=25", |
| 131 |
bl longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=288", |
| 132 |
t text, |
| 133 |
tm mediumtext comment "Random other comment", |
| 134 |
tl longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=233", |
| 135 |
j json) engine=ndb; |
| 136 |
|
| 137 |
## Verify inline and partition sizes of test.mixedinline |
| 138 |
SELECT inline_size, part_size FROM ndbinfo.blobs WHERE table_name = 'mixedinline'; |
| 139 |
inline_size part_size |
| 140 |
20000 2000 |
| 141 |
25 4000 |
| 142 |
288 13948 |
| 143 |
256 2000 |
| 144 |
256 4000 |
| 145 |
233 13948 |
| 146 |
4000 8100 |
| 147 |
|
| 148 |
## Insert and validate test.mixedinline |
| 149 |
INSERT INTO test.mixedinline VALUES ( |
| 150 |
1, |
| 151 |
repeat('J',60000), |
| 152 |
repeat('J',60000), |
| 153 |
repeat('J',60000), |
| 154 |
repeat(_utf32 0x1F47E,15000), |
| 155 |
repeat(_utf32 0x1F47E,60000), |
| 156 |
repeat(_utf32 0x1F47E,60000), |
| 157 |
"{\"f\": \"12\"}"); |
| 158 |
|
| 159 |
SELECT a, sha1(b), sha1(bm), sha1(bl), sha1(t), sha1(tm), sha1(tl), sha1(j) FROM test.mixedinline; |
| 160 |
a sha1(b) sha1(bm) sha1(bl) sha1(t) sha1(tm) sha1(tl) sha1(j) |
| 161 |
1 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 5adfaa7bc57d12afbafae28fbe2497f36e604ff9 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 097feaddb29114042fe77f8cdfc7aa6b9074b939 |
| 162 |
|
| 163 |
DROP TABLE test.mixedinline; |
| 164 |
|
| 165 |
## Create table with larger inline values and maximum partition size (= 13948) |
| 166 |
CREATE TABLE test.withmaxparts( |
| 167 |
a int primary key, |
| 168 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=20000,MAX_BLOB_PART_SIZE=1", |
| 169 |
bm mediumblob comment "NDB_COLUMN=MAX_BLOB_PART_SIZE=1,BLOB_INLINE_SIZE=320", |
| 170 |
bl longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=320", |
| 171 |
t text comment "NDB_COLUMN=BLOB_INLINE_SIZE=320,MAX_BLOB_PART_SIZE", |
| 172 |
tm mediumtext comment "NDB_COLUMN=MAX_BLOB_PART_SIZE=0", |
| 173 |
tl longtext comment "NDB_COLUMN=MAX_BLOB_PART_SIZE=1", |
| 174 |
j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=8192") engine=ndb; |
| 175 |
|
| 176 |
## Verify inline and partition sizes of test.withmaxparts |
| 177 |
SELECT inline_size, part_size FROM ndbinfo.blobs WHERE table_name = 'withmaxparts'; |
| 178 |
inline_size part_size |
| 179 |
20000 13948 |
| 180 |
320 13948 |
| 181 |
320 13948 |
| 182 |
320 13948 |
| 183 |
256 13948 |
| 184 |
256 13948 |
| 185 |
8192 8100 |
| 186 |
|
| 187 |
## Insert and validate test.withmaxparts |
| 188 |
INSERT INTO test.withmaxparts VALUES ( |
| 189 |
1, |
| 190 |
repeat('J',60000), |
| 191 |
repeat('J',60000), |
| 192 |
repeat('J',60000), |
| 193 |
repeat(_utf32 0x1F47E,15000), |
| 194 |
repeat(_utf32 0x1F47E,60000), |
| 195 |
repeat(_utf32 0x1F47E,60000), |
| 196 |
"{\"f\": \"12\"}"); |
| 197 |
|
| 198 |
SELECT a, sha1(b), sha1(bm), sha1(bl), sha1(t), sha1(tm), sha1(tl), sha1(j) FROM test.withmaxparts; |
| 199 |
a sha1(b) sha1(bm) sha1(bl) sha1(t) sha1(tm) sha1(tl) sha1(j) |
| 200 |
1 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 5adfaa7bc57d12afbafae28fbe2497f36e604ff9 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 097feaddb29114042fe77f8cdfc7aa6b9074b939 |
| 201 |
|
| 202 |
DROP TABLE test.withmaxparts; |
| 203 |
|
| 204 |
## Create tables with bad values |
| 205 |
CREATE TABLE test.neglen( |
| 206 |
a int primary key, |
| 207 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=-20") engine=ndb; |
| 208 |
Warnings: |
| 209 |
Warning 1296 Failed to parse BLOB_INLINE_SIZE=-20, using default value 256 |
| 210 |
CREATE TABLE test.badchar( |
| 211 |
a int primary key, |
| 212 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=ten") engine=ndb; |
| 213 |
Warnings: |
| 214 |
Warning 1296 Failed to parse BLOB_INLINE_SIZE=ten, using default value 256 |
| 215 |
|
| 216 |
## Verify inline_size |
| 217 |
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'neglen'; |
| 218 |
inline_size |
| 219 |
256 |
| 220 |
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'badchar'; |
| 221 |
inline_size |
| 222 |
256 |
| 223 |
|
| 224 |
DROP TABLE test.neglen; |
| 225 |
DROP TABLE test.badchar; |
| 226 |
|
| 227 |
CREATE TABLE test.badlen( |
| 228 |
a int primary key, |
| 229 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=40000") engine=ndb; |
| 230 |
ERROR HY000: Can't create table 'badlen' (use SHOW WARNINGS for more info). |
| 231 |
SHOW WARNINGS; |
| 232 |
Level Code Message |
| 233 |
Warning 1296 Got error 738 'Record too big' from NDB |
| 234 |
Error 1005 Can't create table 'badlen' (use SHOW WARNINGS for more info). |
| 235 |
|
| 236 |
CREATE TABLE test.maxlen( |
| 237 |
a int primary key, |
| 238 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=29981") engine=ndb; |
| 239 |
ERROR HY000: Can't create table 'maxlen' (use SHOW WARNINGS for more info). |
| 240 |
SHOW WARNINGS; |
| 241 |
Level Code Message |
| 242 |
Warning 1296 Got error 738 'Record too big' from NDB |
| 243 |
Error 1005 Can't create table 'maxlen' (use SHOW WARNINGS for more info). |
| 244 |
|
| 245 |
## Max len for inline Blob is 30000 - (4 + 16[header]) |
| 246 |
CREATE TABLE test.maxlen( |
| 247 |
a int primary key, |
| 248 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=29980") engine=ndb; |
| 249 |
## Verify inline of test.maxlen |
| 250 |
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'maxlen'; |
| 251 |
inline_size |
| 252 |
29980 |
| 253 |
|
| 254 |
DROP TABLE test.maxlen; |
| 255 |
|
| 256 |
## TINYBLOB columns ignore the BLOB_INLINE_SIZE option |
| 257 |
CREATE TABLE test.bigtiny( |
| 258 |
a int primary key, |
| 259 |
tb tinyblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=512") engine=ndb; |
| 260 |
Warnings: |
| 261 |
Warning 1296 BLOB_INLINE_SIZE not supported for BLOB column with no part table (e.g. TINYBLOB), using default value 256 |
| 262 |
CREATE TABLE test.smalltiny( |
| 263 |
a int primary key, |
| 264 |
tb tinyblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=128") engine=ndb; |
| 265 |
Warnings: |
| 266 |
Warning 1296 BLOB_INLINE_SIZE not supported for BLOB column with no part table (e.g. TINYBLOB), using default value 256 |
| 267 |
|
| 268 |
DROP TABLE test.bigtiny; |
| 269 |
DROP TABLE test.smalltiny; |
| 270 |
|
| 271 |
## ALTER definitions of extended Blob feature BLOB_INLINE_SIZE |
| 272 |
CREATE TABLE test.inline( |
| 273 |
a int primary key, |
| 274 |
b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 275 |
t longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 276 |
j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=10") engine=ndb; |
| 277 |
|
| 278 |
## Verify inline and partition sizes of test.inline |
| 279 |
SELECT inline_size, part_size FROM ndbinfo.blobs WHERE table_name = 'inline'; |
| 280 |
inline_size part_size |
| 281 |
10 13948 |
| 282 |
10 13948 |
| 283 |
10 8100 |
| 284 |
|
| 285 |
## ALTER with new blob inline size |
| 286 |
ALTER TABLE test.inline |
| 287 |
drop column b, |
| 288 |
drop column t, |
| 289 |
drop column j, |
| 290 |
add column bl longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=512", |
| 291 |
add column tl longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=512", |
| 292 |
add column js json comment "NDB_COLUMN=BLOB_INLINE_SIZE=8192"; |
| 293 |
|
| 294 |
## Verify updated test.inline with new BLOB_INLINE_SIZE |
| 295 |
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'inline'; |
| 296 |
inline_size |
| 297 |
512 |
| 298 |
512 |
| 299 |
8192 |
| 300 |
|
| 301 |
## SHOW CREATE TABLE for new BLOB_INLINE_SIZE |
| 302 |
SHOW CREATE TABLE test.inline; |
| 303 |
Table Create Table |
| 304 |
inline CREATE TABLE `inline` ( |
| 305 |
`a` int NOT NULL, |
| 306 |
`bl` longblob COMMENT 'NDB_COLUMN=BLOB_INLINE_SIZE=512', |
| 307 |
`tl` longtext COMMENT 'NDB_COLUMN=BLOB_INLINE_SIZE=512', |
| 308 |
`js` json DEFAULT NULL COMMENT 'NDB_COLUMN=BLOB_INLINE_SIZE=8192', |
| 309 |
PRIMARY KEY (`a`) |
| 310 |
) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 311 |
|
| 312 |
## In-place ALTER TABLE rename column (same comment) |
| 313 |
ALTER TABLE test.inline ALGORITHM=inplace, |
| 314 |
change column bl b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=512", |
| 315 |
change column tl t longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=512", |
| 316 |
change column js j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=8192"; |
| 317 |
|
| 318 |
## In-place ALTER TABLE add column (non blob due to prevention of online partitioning) |
| 319 |
ALTER TABLE test.inline ALGORITHM=inplace, |
| 320 |
add column c char(32); |
| 321 |
Warnings: |
| 322 |
Warning 1478 Converted FIXED field 'c' to DYNAMIC to enable online ADD COLUMN |
| 323 |
|
| 324 |
## In-place ALTER TABLE change column BLOB_INLINE_SIZE will err |
| 325 |
ALTER TABLE test.inline ALGORITHM=inplace, |
| 326 |
change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=1000"; |
| 327 |
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: NDB_COLUMN= comment changed. Try ALGORITHM=COPY. |
| 328 |
SHOW WARNINGS; |
| 329 |
Level Code Message |
| 330 |
Error 1846 ALGORITHM=INPLACE is not supported. Reason: NDB_COLUMN= comment changed. Try ALGORITHM=COPY. |
| 331 |
|
| 332 |
## In-place ALTER TABLE remove configured BLOB_INLINE_SIZE will err |
| 333 |
ALTER TABLE test.inline ALGORITHM=inplace, |
| 334 |
change column b b longblob; |
| 335 |
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: NDB_COLUMN= comment changed. Try ALGORITHM=COPY. |
| 336 |
SHOW WARNINGS; |
| 337 |
Level Code Message |
| 338 |
Error 1846 ALGORITHM=INPLACE is not supported. Reason: NDB_COLUMN= comment changed. Try ALGORITHM=COPY. |
| 339 |
|
| 340 |
## In-place ALTER TABLE change column comment variations for NDB_COLUMN will err |
| 341 |
ALTER TABLE test.inline ALGORITHM=inplace, |
| 342 |
change column b b longblob comment "randomNDB_COLUMN=BLOB_INLINE_SIZE=1000"; |
| 343 |
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: NDB_COLUMN= comment changed. Try ALGORITHM=COPY. |
| 344 |
SHOW WARNINGS; |
| 345 |
Level Code Message |
| 346 |
Error 1846 ALGORITHM=INPLACE is not supported. Reason: NDB_COLUMN= comment changed. Try ALGORITHM=COPY. |
| 347 |
ALTER TABLE test.inline ALGORITHM=inplace, |
| 348 |
change column b b longblob comment "NDB_COLUMNrandom= BLOB_INLINE_SIZE=1000"; |
| 349 |
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: NDB_COLUMN= comment changed. Try ALGORITHM=COPY. |
| 350 |
SHOW WARNINGS; |
| 351 |
Level Code Message |
| 352 |
Error 1846 ALGORITHM=INPLACE is not supported. Reason: NDB_COLUMN= comment changed. Try ALGORITHM=COPY. |
| 353 |
|
| 354 |
## Insert some data and verify that read data remains the same |
| 355 |
INSERT INTO test.inline (a, b, t, j) VALUES (1, |
| 356 |
repeat(0x424C4F, 512), |
| 357 |
repeat(0x424C4F, 512), |
| 358 |
"{\"a\": \"42\"}"); |
| 359 |
SELECT sha1(b), sha1(t), sha1(j) FROM test.inline; |
| 360 |
sha1(b) sha1(t) sha1(j) |
| 361 |
c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 8bef4ce42aa0c9268e300438f01d118b75e3b423 |
| 362 |
|
| 363 |
## Copy ALTER TABLE change column BLOB_INLINE_SIZE changes inline_blob_size |
| 364 |
ALTER TABLE test.inline algorithm=copy, |
| 365 |
change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=1000", |
| 366 |
change column t t longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=1000", |
| 367 |
change column j j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=10000"; |
| 368 |
|
| 369 |
## Verify updated test.inline |
| 370 |
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'inline'; |
| 371 |
inline_size |
| 372 |
1000 |
| 373 |
1000 |
| 374 |
10000 |
| 375 |
## Verify data |
| 376 |
SELECT sha1(b), sha1(t), sha1(j) FROM test.inline; |
| 377 |
sha1(b) sha1(t) sha1(j) |
| 378 |
c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 8bef4ce42aa0c9268e300438f01d118b75e3b423 |
| 379 |
|
| 380 |
## Copy ALTER TABLE change back BLOB_INLINE_SIZE to less |
| 381 |
ALTER TABLE test.inline algorithm=copy, |
| 382 |
change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 383 |
change column t t longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=10", |
| 384 |
change column j j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=25"; |
| 385 |
|
| 386 |
## Verify updated test.inline with reduced BLOB_INLINE_SIZE |
| 387 |
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'inline'; |
| 388 |
inline_size |
| 389 |
10 |
| 390 |
10 |
| 391 |
25 |
| 392 |
## Verify data |
| 393 |
SELECT sha1(b), sha1(t), sha1(j) FROM test.inline; |
| 394 |
sha1(b) sha1(t) sha1(j) |
| 395 |
c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 8bef4ce42aa0c9268e300438f01d118b75e3b423 |
| 396 |
|
| 397 |
## Copy ALTER TABLE change to zero inline size |
| 398 |
ALTER TABLE test.inline algorithm=copy, |
| 399 |
change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=0", |
| 400 |
change column t t longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=0", |
| 401 |
change column j j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=0"; |
| 402 |
|
| 403 |
## Verify updated test.inline with zero inline size |
| 404 |
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'inline'; |
| 405 |
inline_size |
| 406 |
0 |
| 407 |
0 |
| 408 |
0 |
| 409 |
## Verify data |
| 410 |
SELECT sha1(b), sha1(t), sha1(j) FROM test.inline; |
| 411 |
sha1(b) sha1(t) sha1(j) |
| 412 |
c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 8bef4ce42aa0c9268e300438f01d118b75e3b423 |
| 413 |
|
| 414 |
## Copy ALTER TABLE too big BLOB_INLINE_SIZE |
| 415 |
ALTER TABLE test.inline algorithm=copy, |
| 416 |
change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=27949", |
| 417 |
change column t t longtext comment "NDB_COLUMM=BLOB_INLINE_SIZE=1000", |
| 418 |
change column j j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=27949"; |
| 419 |
ERROR HY000: Can't create destination table for copying alter table (use SHOW WARNINGS for more info). |
| 420 |
SHOW WARNINGS; |
| 421 |
Level Code Message |
| 422 |
Warning 1296 Got error 738 'Record too big' from NDB |
| 423 |
Error 1005 Can't create destination table for copying alter table (use SHOW WARNINGS for more info). |
| 424 |
|
| 425 |
## ALTER TABLE random characters on COMMENT before NDB_COLUMN |
| 426 |
ALTER TABLE test.inline change column b b longblob comment "randomNDB_COLUMN=BLOB_INLINE_SIZE=15"; |
| 427 |
|
| 428 |
## Verify altered test.inline |
| 429 |
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'inline'; |
| 430 |
inline_size |
| 431 |
15 |
| 432 |
0 |
| 433 |
0 |
| 434 |
|
| 435 |
## ALTER TABLE random characters on COMMENT after NDB_COLUMN |
| 436 |
ALTER TABLE test.inline change column b b longblob comment "NDB_COLUMN=randomBLOB_INLINE_SIZE=25"; |
| 437 |
ERROR HY000: Table storage engine 'ndbcluster' does not support the create option 'Syntax error in COMMENT modifier' |
| 438 |
SHOW WARNINGS LIMIT 2; |
| 439 |
Level Code Message |
| 440 |
Warning 1478 NDB_COLUMN= : unknown modifier: randomBLOB_INLINE_SIZE=25 |
| 441 |
Error 1478 Table storage engine 'ndbcluster' does not support the create option 'Syntax error in COMMENT modifier' |
| 442 |
|
| 443 |
## ALTER TABLE on table for TINYBLOB |
| 444 |
ALTER TABLE test.inline change column b tb tinyblob; |
| 445 |
ERROR 22001: Data too long for column 'tb' at row 1 |
| 446 |
## Length value on b (1536) is still larger than what can fit in TINYBLOB length (255) |
| 447 |
ALTER TABLE test.inline change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=255"; |
| 448 |
ALTER TABLE test.inline change column b tb tinyblob; |
| 449 |
ERROR 22001: Data too long for column 'tb' at row 1 |
| 450 |
|
| 451 |
## Must update data to allow to fit TINYBLOB |
| 452 |
UPDATE test.inline SET b = repeat(0x424C4F, 64) WHERE a = 1; |
| 453 |
ALTER TABLE test.inline change column b tb tinyblob; |
| 454 |
SELECT a, length(tb) FROM test.inline; |
| 455 |
a length(tb) |
| 456 |
1 192 |
| 457 |
|
| 458 |
CREATE TABLE test.tiny ( |
| 459 |
a int primary key, |
| 460 |
tb tinyblob) engine = ndb; |
| 461 |
## Always ignored for TINYBLOB |
| 462 |
ALTER TABLE test.tiny change column tb tb tinyblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=128"; |
| 463 |
Warnings: |
| 464 |
Warning 1296 BLOB_INLINE_SIZE not supported for BLOB column with no part table (e.g. TINYBLOB), using default value 256 |
| 465 |
|
| 466 |
DROP TABLE test.tiny; |
| 467 |
DROP TABLE test.inline; |
| 468 |
|
| 469 |
## Show Backup and Restore across BLOB inline sizes |
| 470 |
CREATE TABLE test.withmaxparts( |
| 471 |
a int primary key, |
| 472 |
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=20000,MAX_BLOB_PART_SIZE=1", |
| 473 |
bm mediumblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=320", |
| 474 |
bl longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=320", |
| 475 |
t text comment "NDB_COLUMN=BLOB_INLINE_SIZE=320", |
| 476 |
tm mediumtext comment "irrelevant", |
| 477 |
tl longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=320", |
| 478 |
j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=8192") engine=ndb; |
| 479 |
|
| 480 |
INSERT INTO test.withmaxparts VALUES ( |
| 481 |
1, |
| 482 |
repeat('J',60000), |
| 483 |
repeat('J',60000), |
| 484 |
repeat('J',60000), |
| 485 |
repeat(_utf32 0x1F47E,15000), |
| 486 |
repeat(_utf32 0x1F47E,60000), |
| 487 |
repeat(_utf32 0x1F47E,60000), |
| 488 |
"{\"f\": \"12\"}"); |
| 489 |
|
| 490 |
SELECT a, sha1(b), sha1(bm), sha1(bl), sha1(t), sha1(tm), sha1(tl), sha1(j) FROM test.withmaxparts; |
| 491 |
a sha1(b) sha1(bm) sha1(bl) sha1(t) sha1(tm) sha1(tl) sha1(j) |
| 492 |
1 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 5adfaa7bc57d12afbafae28fbe2497f36e604ff9 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 097feaddb29114042fe77f8cdfc7aa6b9074b939 |
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
DROP TABLE test.withmaxparts; |
| 497 |
|
| 498 |
CREATE TABLE test.withmaxparts( |
| 499 |
a int primary key, |
| 500 |
b blob, |
| 501 |
bm mediumblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=6000,MAX_BLOB_PART_SIZE=1", |
| 502 |
bl longblob, |
| 503 |
t text comment "NDB_COLUMN=BLOB_INLINE_SIZE=10000,MAX_BLOB_PART_SIZE", |
| 504 |
tm mediumtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=3000", |
| 505 |
tl longtext, |
| 506 |
j json comment "irrelevant") engine=ndb; |
| 507 |
|
| 508 |
# restore data from backup |
| 509 |
SELECT a, sha1(b), sha1(bm), sha1(bl), sha1(t), sha1(tm), sha1(tl), sha1(j) FROM test.withmaxparts; |
| 510 |
a sha1(b) sha1(bm) sha1(bl) sha1(t) sha1(tm) sha1(tl) sha1(j) |
| 511 |
1 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 b0be713435a4afe8da1785f8d4c879a7af3a91a5 5adfaa7bc57d12afbafae28fbe2497f36e604ff9 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 83d131c719aaa6026ee3a3fcec2ad856ed1e1a67 097feaddb29114042fe77f8cdfc7aa6b9074b939 |
| 512 |
|
| 513 |
## Verify that inline of test.withmaxparts are the new sizes |
| 514 |
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'withmaxparts'; |
| 515 |
inline_size |
| 516 |
256 |
| 517 |
6000 |
| 518 |
256 |
| 519 |
10000 |
| 520 |
3000 |
| 521 |
256 |
| 522 |
4000 |
| 523 |
|
| 524 |
DROP TABLE test.withmaxparts; |
| 525 |
|