From: John David Duncan Date: September 29 2011 7:16pm Subject: bzr push into mysql-5.5-cluster branch (john.duncan:3570 to 3571) List-Archive: http://lists.mysql.com/commits/141220 Message-Id: <201109291917.p8TJH37t003808@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3571 John David Duncan 2011-09-29 Column->getSizeInBytes() seems to work for all cases of getColumnRecordSize(). It also does better for determining alignment; for instance NdbApi seems to treat a timestamp column as an array of 4 chars, so getSize() was 1. modified: storage/ndb/memcache/include/DataTypeHandler.h storage/ndb/memcache/include/QueryPlan.h storage/ndb/memcache/include/Record.h storage/ndb/memcache/src/DataTypeHandler.cc storage/ndb/memcache/src/QueryPlan.cc storage/ndb/memcache/src/Record.cc 3570 John David Duncan 2011-09-28 Refactor how the ndb_memcache test suite uses & checks for online reconfiguration. added: mysql-test/suite/ndb_memcache/include/wait_for_reconf.inc modified: mysql-test/lib/My/Memcache.pm mysql-test/suite/ndb_memcache/include/datatypes_tables.inc mysql-test/suite/ndb_memcache/include/memcached_wait_for_ready.inc mysql-test/suite/ndb_memcache/t/reconf1.test mysql-test/suite/ndb_memcache/t/type_char.test mysql-test/suite/ndb_memcache/t/type_numeric.test mysql-test/suite/ndb_memcache/t/type_signed.test mysql-test/suite/ndb_memcache/t/type_unsigned.test === modified file 'storage/ndb/memcache/include/DataTypeHandler.h' --- a/storage/ndb/memcache/include/DataTypeHandler.h 2011-09-28 21:43:28 +0000 +++ b/storage/ndb/memcache/include/DataTypeHandler.h 2011-09-29 19:13:43 +0000 @@ -113,8 +113,4 @@ typedef struct { DataTypeHandler * getDataTypeHandlerForColumn(const NdbDictionary::Column *); -/* Function to retrieve the buffer size required for an NDB column - */ -size_t getColumnRecordSize(const NdbDictionary::Column *col); - #endif === modified file 'storage/ndb/memcache/include/QueryPlan.h' --- a/storage/ndb/memcache/include/QueryPlan.h 2011-09-12 10:05:07 +0000 +++ b/storage/ndb/memcache/include/QueryPlan.h 2011-09-29 19:13:43 +0000 @@ -48,7 +48,8 @@ class QueryPlan { QueryPlan(Ndb *, const TableSpec *, PlanOpts opts = NoOptions); ~QueryPlan(); bool keyIsPrimaryKey(); - + void debug_dump(); + /* public instance variables */ bool initialized; bool dup_numbers; === modified file 'storage/ndb/memcache/include/Record.h' --- a/storage/ndb/memcache/include/Record.h 2011-09-28 20:28:34 +0000 +++ b/storage/ndb/memcache/include/Record.h 2011-09-29 19:13:43 +0000 @@ -62,6 +62,7 @@ class Record { const NdbDictionary::Table *); bool complete(NdbDictionary::Dictionary *, const NdbDictionary::Index *); + void debug_dump(); /* const public methods that operate on an (external) data buffer */ void clearNullBits(char *data) const; === modified file 'storage/ndb/memcache/src/DataTypeHandler.cc' --- a/storage/ndb/memcache/src/DataTypeHandler.cc 2011-09-28 21:43:28 +0000 +++ b/storage/ndb/memcache/src/DataTypeHandler.cc 2011-09-29 19:13:43 +0000 @@ -395,28 +395,6 @@ DataTypeHandler * getDataTypeHandlerForC } } -/* - * getColumnRecordSize() - */ -size_t getColumnRecordSize(const NdbDictionary::Column *col) { - switch(col->getType()) { - case NdbDictionary::Column::Varchar: - case NdbDictionary::Column::Varbinary: - return col->getLength() + 1; - - case NdbDictionary::Column::Longvarchar: - case NdbDictionary::Column::Longvarbinary: - return col->getLength() + 2; - - case NdbDictionary::Column::Char: - case NdbDictionary::Column::Binary: - return col->getLength(); - - default: - return col->getSizeInBytes(); - } -} - /******************* IMPLEMENTATIONS *******************/ /***** UNSUPPORTED COLUMN TYPE ******/ === modified file 'storage/ndb/memcache/src/QueryPlan.cc' --- a/storage/ndb/memcache/src/QueryPlan.cc 2011-09-25 05:06:46 +0000 +++ b/storage/ndb/memcache/src/QueryPlan.cc 2011-09-29 19:13:43 +0000 @@ -217,6 +217,21 @@ QueryPlan::~QueryPlan() { } +void QueryPlan::debug_dump() { + if(key_record) { + DEBUG_PRINT("Key record:"); + key_record->debug_dump(); + } + if(row_record) { + DEBUG_PRINT("Row record:"); + row_record->debug_dump(); + } + if(val_record) { + DEBUG_PRINT("val_record"); + val_record->debug_dump(); + } +} + bool QueryPlan::keyIsPrimaryKey() { if(spec->nkeycols == table->getNoOfPrimaryKeys()) { for(int i = 0 ; i < spec->nkeycols ; i++) === modified file 'storage/ndb/memcache/src/Record.cc' --- a/storage/ndb/memcache/src/Record.cc 2011-09-29 03:26:04 +0000 +++ b/storage/ndb/memcache/src/Record.cc 2011-09-29 19:13:43 +0000 @@ -99,7 +99,9 @@ void Record::addColumn(short col_type, c /* Increment the counter and record size */ index += 1; - rec_size += getColumnRecordSize(column); + +// rec_size += getColumnRecordSize(column); + rec_size += column->getSizeInBytes(); }; @@ -295,7 +297,8 @@ void Record::pad_offset_for_alignment() alignment = 8; } else if(! handlers[index]->contains_string) { - alignment = specs[index].column->getSize(); +// alignment = specs[index].column->getSize(); + alignment = specs[index].column->getSizeInBytes(); } switch(alignment) { @@ -308,3 +311,14 @@ void Record::pad_offset_for_alignment() break; } } + + +void Record::debug_dump() { + for(int i = 0 ; i < ncolumns ; i++) { + DEBUG_PRINT("Col %d column : %s %d/%d", i, specs[i].column->getName() + , specs[i].column->getSize(), specs[i].column->getSizeInBytes()); + DEBUG_PRINT("Col %d offset : %d", i, specs[i].offset); + DEBUG_PRINT("Col %d null bit: %d.%d", i, + specs[i].nullbit_byte_offset, specs[i].nullbit_bit_in_byte); + } +} No bundle (reason: useless for push emails).