@@ -23,6 +23,30 @@ inline_size part_size
23
23
24
24
DROP TABLE test.defs;
25
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
+
26
50
## Create table with less than default inline values
27
51
CREATE TABLE test.shortinline(
28
52
a int primary key,
@@ -178,11 +202,6 @@ a sha1(b) sha1(bm) sha1(bl) sha1(t) sha1(tm) sha1(tl) sha1(j)
178
202
DROP TABLE test.withmaxparts;
179
203
180
204
## Create tables with bad values
181
- CREATE TABLE test.zerolen(
182
- a int primary key,
183
- b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=0") engine=ndb;
184
- Warnings:
185
- Warning 1296 Failed to parse BLOB_INLINE_SIZE=0, using default value 256
186
205
CREATE TABLE test.neglen(
187
206
a int primary key,
188
207
b blob comment "NDB_COLUMN=BLOB_INLINE_SIZE=-20") engine=ndb;
@@ -194,18 +213,14 @@ CREATE TABLE test.badchar(
194
213
Warnings:
195
214
Warning 1296 Failed to parse BLOB_INLINE_SIZE=ten, using default value 256
196
215
197
- ## Verify inline of test.zerolen and test.neglen
198
- SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'zerolen';
199
- inline_size
200
- 256
216
+ ## Verify inline_size
201
217
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'neglen';
202
218
inline_size
203
219
256
204
220
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'badchar';
205
221
inline_size
206
222
256
207
223
208
- DROP TABLE test.zerolen;
209
224
DROP TABLE test.neglen;
210
225
DROP TABLE test.badchar;
211
226
@@ -321,6 +336,15 @@ SHOW WARNINGS;
321
336
Level Code Message
322
337
Error 1846 ALGORITHM=INPLACE is not supported. Reason: NDB_COLUMN= comment changed. Try ALGORITHM=COPY.
323
338
339
+ ## Insert some data and verify that read data remains the same
340
+ INSERT INTO test.inline (a, b, t, j) VALUES (1,
341
+ repeat(0x424C4F, 512),
342
+ repeat(0x424C4F, 512),
343
+ "{\"a\": \"42\"}");
344
+ SELECT sha1(b), sha1(t), sha1(j) FROM test.inline;
345
+ sha1(b) sha1(t) sha1(j)
346
+ c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 8bef4ce42aa0c9268e300438f01d118b75e3b423
347
+
324
348
## Copy ALTER TABLE change column BLOB_INLINE_SIZE changes inline_blob_size
325
349
ALTER TABLE test.inline algorithm=copy,
326
350
change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=1000",
@@ -333,6 +357,10 @@ inline_size
333
357
1000
334
358
1000
335
359
10000
360
+ ## Verify data
361
+ SELECT sha1(b), sha1(t), sha1(j) FROM test.inline;
362
+ sha1(b) sha1(t) sha1(j)
363
+ c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 8bef4ce42aa0c9268e300438f01d118b75e3b423
336
364
337
365
## Copy ALTER TABLE change back BLOB_INLINE_SIZE to less
338
366
ALTER TABLE test.inline algorithm=copy,
@@ -346,6 +374,27 @@ inline_size
346
374
10
347
375
10
348
376
25
377
+ ## Verify data
378
+ SELECT sha1(b), sha1(t), sha1(j) FROM test.inline;
379
+ sha1(b) sha1(t) sha1(j)
380
+ c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 8bef4ce42aa0c9268e300438f01d118b75e3b423
381
+
382
+ ## Copy ALTER TABLE change to zero inline size
383
+ ALTER TABLE test.inline algorithm=copy,
384
+ change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=0",
385
+ change column t t longtext comment "NDB_COLUMN=BLOB_INLINE_SIZE=0",
386
+ change column j j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=0";
387
+
388
+ ## Verify updated test.inline with zero inline size
389
+ SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'inline';
390
+ inline_size
391
+ 0
392
+ 0
393
+ 0
394
+ ## Verify data
395
+ SELECT sha1(b), sha1(t), sha1(j) FROM test.inline;
396
+ sha1(b) sha1(t) sha1(j)
397
+ c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 8bef4ce42aa0c9268e300438f01d118b75e3b423
349
398
350
399
## Copy ALTER TABLE too big BLOB_INLINE_SIZE
351
400
ALTER TABLE test.inline algorithm=copy,
@@ -365,8 +414,8 @@ ALTER TABLE test.inline change column b b longblob comment "randomNDB_COLUMN=BLO
365
414
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'inline';
366
415
inline_size
367
416
15
368
- 10
369
- 25
417
+ 0
418
+ 0
370
419
371
420
## ALTER TABLE random characters on COMMENT after NDB_COLUMN
372
421
ALTER TABLE test.inline change column b b longblob comment "NDB_COLUMN=randomBLOB_INLINE_SIZE=25";
0 commit comments