Skip to content

Commit 5b66d11

Browse files
committed
Merge branch 'mysql-8.0' into mysql-8.4
Change-Id: Ic842a2bcb9a920010ebd2075e2287880a3dc23aa
2 parents 58e7bc5 + 4458a6a commit 5b66d11

File tree

3 files changed

+93
-12
lines changed

3 files changed

+93
-12
lines changed

mysql-test/suite/ndb/r/ndb_blob_size.result

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,21 @@ inline_size
253253

254254
DROP TABLE test.maxlen;
255255

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+
256271
## ALTER definitions of extended Blob feature BLOB_INLINE_SIZE
257272
CREATE TABLE test.inline(
258273
a int primary key,
@@ -399,7 +414,7 @@ c0bb7371406f4b1c5d579dcaad1ff066a3bd09e6 c0bb7371406f4b1c5d579dcaad1ff066a3bd09e
399414
## Copy ALTER TABLE too big BLOB_INLINE_SIZE
400415
ALTER TABLE test.inline algorithm=copy,
401416
change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=27949",
402-
change column t t longtext comment "NDB_COLUMM_BLOB_INLINE_SIZE=1000",
417+
change column t t longtext comment "NDB_COLUMM=BLOB_INLINE_SIZE=1000",
403418
change column j j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=27949";
404419
ERROR HY000: Can't create destination table for copying alter table (use SHOW WARNINGS for more info).
405420
SHOW WARNINGS;
@@ -425,6 +440,30 @@ Level Code Message
425440
Warning 1478 NDB_COLUMN= : unknown modifier: randomBLOB_INLINE_SIZE=25
426441
Error 1478 Table storage engine 'ndbcluster' does not support the create option 'Syntax error in COMMENT modifier'
427442

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;
428467
DROP TABLE test.inline;
429468

430469
## Show Backup and Restore across BLOB inline sizes

mysql-test/suite/ndb/t/ndb_blob_size.test

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ CREATE TABLE test.maxlen(
185185
SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'maxlen';
186186

187187
DROP TABLE test.maxlen;
188+
189+
## TINYBLOB columns ignore the BLOB_INLINE_SIZE option
190+
CREATE TABLE test.bigtiny(
191+
a int primary key,
192+
tb tinyblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=512") engine=ndb;
193+
CREATE TABLE test.smalltiny(
194+
a int primary key,
195+
tb tinyblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=128") engine=ndb;
196+
197+
DROP TABLE test.bigtiny;
198+
DROP TABLE test.smalltiny;
188199
--echo
189200

190201
# WL#15044 Configurable BLOB inline size
@@ -291,7 +302,7 @@ SELECT sha1(b), sha1(t), sha1(j) FROM test.inline;
291302
--error ER_CANT_CREATE_TABLE
292303
ALTER TABLE test.inline algorithm=copy,
293304
change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=27949",
294-
change column t t longtext comment "NDB_COLUMM_BLOB_INLINE_SIZE=1000",
305+
change column t t longtext comment "NDB_COLUMM=BLOB_INLINE_SIZE=1000",
295306
change column j j json comment "NDB_COLUMN=BLOB_INLINE_SIZE=27949";
296307
SHOW WARNINGS;
297308

@@ -306,6 +317,26 @@ SELECT inline_size FROM ndbinfo.blobs WHERE table_name = 'inline';
306317
ALTER TABLE test.inline change column b b longblob comment "NDB_COLUMN=randomBLOB_INLINE_SIZE=25";
307318
SHOW WARNINGS LIMIT 2;
308319

320+
## ALTER TABLE on table for TINYBLOB
321+
--error ER_DATA_TOO_LONG
322+
ALTER TABLE test.inline change column b tb tinyblob;
323+
## Length value on b (1536) is still larger than what can fit in TINYBLOB length (255)
324+
ALTER TABLE test.inline change column b b longblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=255";
325+
--error ER_DATA_TOO_LONG
326+
ALTER TABLE test.inline change column b tb tinyblob;
327+
328+
## Must update data to allow to fit TINYBLOB
329+
UPDATE test.inline SET b = repeat(0x424C4F, 64) WHERE a = 1;
330+
ALTER TABLE test.inline change column b tb tinyblob;
331+
SELECT a, length(tb) FROM test.inline;
332+
333+
CREATE TABLE test.tiny (
334+
a int primary key,
335+
tb tinyblob) engine = ndb;
336+
## Always ignored for TINYBLOB
337+
ALTER TABLE test.tiny change column tb tb tinyblob comment "NDB_COLUMN=BLOB_INLINE_SIZE=128";
338+
339+
DROP TABLE test.tiny;
309340
DROP TABLE test.inline;
310341
--echo
311342

storage/ndb/plugin/ha_ndbcluster.cc

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8178,6 +8178,15 @@ static int create_ndb_column(THD *thd, NDBCOL &col, Field *field,
81788178
}
81798179
mod_size = size;
81808180
}
8181+
if (col.getPartSize() == 0) {
8182+
if (thd) {
8183+
get_thd_ndb(thd)->push_warning(
8184+
"BLOB_INLINE_SIZE not supported for BLOB column with no part "
8185+
"table (e.g. TINYBLOB), using default value %d",
8186+
size);
8187+
}
8188+
mod_size = size;
8189+
}
81818190
col.setInlineSize(mod_size);
81828191
} else {
81838192
col.setInlineSize(size);
@@ -8372,10 +8381,10 @@ static int create_ndb_column(THD *thd, NDBCOL &col, Field *field,
83728381
col.setType(NDBCOL::Text);
83738382
col.setCharset(cs);
83748383
}
8375-
col.setInlineSize(256);
83768384
// No parts
83778385
col.setPartSize(0);
83788386
col.setStripeSize(0);
8387+
set_blob_inline_size(thd, col, 256);
83798388
break;
83808389
// mysql_type_blob:
83818390
case MYSQL_TYPE_GEOMETRY:
@@ -8399,12 +8408,13 @@ static int create_ndb_column(THD *thd, NDBCOL &col, Field *field,
83998408
if (field_blob->max_data_length() < (1 << 8))
84008409
goto mysql_type_tiny_blob;
84018410
else if (field_blob->max_data_length() < (1 << 16)) {
8402-
set_blob_inline_size(thd, col, 256);
8403-
col.setPartSize(2000);
8404-
col.setStripeSize(0);
84058411
if (mod_maxblob->m_found) {
84068412
col.setPartSize(DEFAULT_MAX_BLOB_PART_SIZE);
8413+
} else {
8414+
col.setPartSize(2000);
84078415
}
8416+
col.setStripeSize(0);
8417+
set_blob_inline_size(thd, col, 256);
84088418
} else if (field_blob->max_data_length() < (1 << 24))
84098419
goto mysql_type_medium_blob;
84108420
else
@@ -8419,12 +8429,13 @@ static int create_ndb_column(THD *thd, NDBCOL &col, Field *field,
84198429
col.setType(NDBCOL::Text);
84208430
col.setCharset(cs);
84218431
}
8422-
set_blob_inline_size(thd, col, 256);
8423-
col.setPartSize(4000);
8424-
col.setStripeSize(0);
84258432
if (mod_maxblob->m_found) {
84268433
col.setPartSize(DEFAULT_MAX_BLOB_PART_SIZE);
8434+
} else {
8435+
col.setPartSize(4000);
84278436
}
8437+
col.setStripeSize(0);
8438+
set_blob_inline_size(thd, col, 256);
84288439
break;
84298440
mysql_type_long_blob:
84308441
case MYSQL_TYPE_LONG_BLOB:
@@ -8434,10 +8445,10 @@ static int create_ndb_column(THD *thd, NDBCOL &col, Field *field,
84348445
col.setType(NDBCOL::Text);
84358446
col.setCharset(cs);
84368447
}
8437-
set_blob_inline_size(thd, col, 256);
8448+
// The mod_maxblob modified has no effect here, already at max
84388449
col.setPartSize(DEFAULT_MAX_BLOB_PART_SIZE);
84398450
col.setStripeSize(0);
8440-
// The mod_maxblob modified has no effect here, already at max
8451+
set_blob_inline_size(thd, col, 256);
84418452
break;
84428453

84438454
// MySQL 5.7 binary-encoded JSON type
@@ -8456,9 +8467,9 @@ static int create_ndb_column(THD *thd, NDBCOL &col, Field *field,
84568467
const int NDB_JSON_PART_SIZE = 8100;
84578468

84588469
col.setType(NDBCOL::Blob);
8459-
set_blob_inline_size(thd, col, NDB_JSON_INLINE_SIZE);
84608470
col.setPartSize(NDB_JSON_PART_SIZE);
84618471
col.setStripeSize(0);
8472+
set_blob_inline_size(thd, col, NDB_JSON_INLINE_SIZE);
84628473
break;
84638474
}
84648475

0 commit comments

Comments
 (0)