Description:
NDBAPI allows large BIT type columns to be created (whereas MySQL limits them to 64 bits).
It appears that the only limit placed on the length of BIT columns from NDBAPI is that they must be < 65536 bits.
However, when created, inserts fail if the bit column length is roughly > 8160 bits.
This is probably due to the use of the row's null bits array for storing BIT fields - the length of that array is limited to 255 32-bit words.
See also bug#42046.
How to repeat:
Modify storage/ndb/test/ndbapi/testBitfield to create larger BIT columns.
Run to determine effect on cluster / error messages generated.
Example hacky patch below :
=== modified file 'storage/ndb/test/ndbapi/testBitfield.cpp'
--- storage/ndb/test/ndbapi/testBitfield.cpp 2008-08-25 08:29:58 +0000
+++ storage/ndb/test/ndbapi/testBitfield.cpp 2009-01-12 10:59:47 +0000
@@ -128,8 +128,8 @@
{
do {
NdbDictionary::Table tab;
- Uint32 cols = 1 + (rand() % (NDB_MAX_ATTRIBUTES_IN_TABLE - 1));
- Uint32 length = 4090;
+ Uint32 cols = 2;
+ Uint32 length = 65536;
BaseString name;
name.assfmt("TAB_%d", rand() & 65535);
@@ -139,7 +139,7 @@
NdbDictionary::Column col;
name.assfmt("COL_%d", i);
col.setName(name.c_str());
- if(i == 0 || i == 1)
+ if(i == 0)
{
col.setType(NdbDictionary::Column::Unsigned);
col.setLength(1);
@@ -151,10 +151,10 @@
col.setType(NdbDictionary::Column::Bit);
- Uint32 len = 1 + (rand() % (length - 1));
+ Uint32 len = length;
col.setLength(len); length -= len;
int nullable = (rand() >> 16) & 1;
- col.setNullable(nullable); length -= nullable;
+ col.setNullable(nullable);
col.setPrimaryKey(false);
tab.addColumn(col);
}
@@ -163,6 +163,7 @@
if(pNdb->getDictionary()->createTable(tab) == 0)
{
ndbout << (NDBT_Table&)tab << endl;
+ exit(0);
return pNdb->getDictionary()->getTable(tab.getName());
}
} while(0);
Suggested fix:
Modify kernel to handle requests to define tables with many / large BIT columns.
Could involve increasing maximum size of NULL bit array, or performing more validation and refusing particular schemas.
Document modified schema limitations if any.