diff options
author | unknown <pekka@clam.ndb.mysql.com/clam.(none)> | 2007-01-23 12:58:10 +0100 |
---|---|---|
committer | unknown <pekka@clam.ndb.mysql.com/clam.(none)> | 2007-01-23 12:58:10 +0100 |
commit | 25fb32ef8457ac2e3bafcea08b009b9d599a671b (patch) | |
tree | 6e60d8fdb513f437dc05ec7128ba5e75365836a5 /sql/ha_ndbcluster.cc | |
parent | ab8355fab0dec8666481c86d33eb80c9b07e9f88 (diff) | |
download | mariadb-git-25fb32ef8457ac2e3bafcea08b009b9d599a671b.tar.gz |
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
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r-- | sql/ha_ndbcluster.cc | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 3c3f6f4e06b..af097366159 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -4185,19 +4185,29 @@ static int create_ndb_column(NDBCOL &col, col.setType(NDBCOL::Text); col.setCharset(cs); } - // Use "<=" even if "<" is the exact condition - if (field->max_length() <= (1 << 8)) - goto mysql_type_tiny_blob; - else if (field->max_length() <= (1 << 16)) { - col.setInlineSize(256); - col.setPartSize(2000); - col.setStripeSize(16); + 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; + else if (field_blob->max_data_length() < (1 << 16)) + { + col.setInlineSize(256); + col.setPartSize(2000); + col.setStripeSize(16); + } + else if (field_blob->max_data_length() < (1 << 24)) + goto mysql_type_medium_blob; + else + goto mysql_type_long_blob; } - else if (field->max_length() <= (1 << 24)) - goto mysql_type_medium_blob; - else - goto mysql_type_long_blob; break; mysql_type_medium_blob: case MYSQL_TYPE_MEDIUM_BLOB: |