ndb - bug#25562 use byte-size max_data_length() when setting blob part size
sql/ha_ndbcluster.cc: bug#25562 use byte-size max_data_length() when setting blob part size
This commit is contained in:
parent
ab8355fab0
commit
25fb32ef84
@ -4185,19 +4185,29 @@ static int create_ndb_column(NDBCOL &col,
|
|||||||
col.setType(NDBCOL::Text);
|
col.setType(NDBCOL::Text);
|
||||||
col.setCharset(cs);
|
col.setCharset(cs);
|
||||||
}
|
}
|
||||||
// Use "<=" even if "<" is the exact condition
|
{
|
||||||
if (field->max_length() <= (1 << 8))
|
Field_blob *field_blob= (Field_blob *)field;
|
||||||
|
/*
|
||||||
|
* max_data_length is 2^8-1, 2^16-1, 2^24-1 for tiny, blob, medium.
|
||||||
|
* Tinyblob gets no blob parts. The other cases are just a crude
|
||||||
|
* way to control part size and striping.
|
||||||
|
*
|
||||||
|
* In mysql blob(256) is promoted to blob(65535) so it does not
|
||||||
|
* in fact fit "inline" in NDB.
|
||||||
|
*/
|
||||||
|
if (field_blob->max_data_length() < (1 << 8))
|
||||||
goto mysql_type_tiny_blob;
|
goto mysql_type_tiny_blob;
|
||||||
else if (field->max_length() <= (1 << 16))
|
else if (field_blob->max_data_length() < (1 << 16))
|
||||||
{
|
{
|
||||||
col.setInlineSize(256);
|
col.setInlineSize(256);
|
||||||
col.setPartSize(2000);
|
col.setPartSize(2000);
|
||||||
col.setStripeSize(16);
|
col.setStripeSize(16);
|
||||||
}
|
}
|
||||||
else if (field->max_length() <= (1 << 24))
|
else if (field_blob->max_data_length() < (1 << 24))
|
||||||
goto mysql_type_medium_blob;
|
goto mysql_type_medium_blob;
|
||||||
else
|
else
|
||||||
goto mysql_type_long_blob;
|
goto mysql_type_long_blob;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
mysql_type_medium_blob:
|
mysql_type_medium_blob:
|
||||||
case MYSQL_TYPE_MEDIUM_BLOB:
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user