From: Date: March 17 2008 5:30pm Subject: bk commit into 5.1 tree (jonas:1.2541) BUG#35343 List-Archive: http://lists.mysql.com/commits/44127 X-Bug: 35343 Message-Id: <20080317163020.EA62A8E17DE@perch.localdomain> Below is the list of changes that have just been committed into a local 5.1 repository of jonas. When jonas does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2008-03-17 17:30:16+01:00, jonas@stripped +1 -0 ndb - bug#35343 - incorrectly handled datatypes in ndb_restore when applying backup-logfile Move "special" cases into Twiddle function so that they are correctly check *also* if data accedintly is in backup-log storage/ndb/tools/restore/Restore.cpp@stripped, 2008-03-17 17:30:14+01:00, jonas@stripped +26 -27 Move "special" cases into Twiddle function so that they are correctly check *also* if data accedintly is in backup-log diff -Nrup a/storage/ndb/tools/restore/Restore.cpp b/storage/ndb/tools/restore/Restore.cpp --- a/storage/ndb/tools/restore/Restore.cpp 2007-11-06 10:27:53 +01:00 +++ b/storage/ndb/tools/restore/Restore.cpp 2008-03-17 17:30:14 +01:00 @@ -40,6 +40,32 @@ BackupFile::Twiddle(const AttributeDesc* if(m_hostByteOrder) return true; + if((attr_desc->m_column->getType() == NdbDictionary::Column::Blob + || attr_desc->m_column->getType() == NdbDictionary::Column::Text) + && attr_desc->m_column->getArrayType() == NdbDictionary::Column::ArrayTypeFixed) + { + char* p = (char*)&attr_data->u_int64_value[0]; + Uint64 x; + memcpy(&x, p, sizeof(Uint64)); + x = Twiddle64(x); + memcpy(p, &x, sizeof(Uint64)); + } + + //convert datetime type + if(attr_desc->m_column->getType() == NdbDictionary::Column::Datetime) + { + char* p = (char*)&attr_data->u_int64_value[0]; + Uint64 x; + memcpy(&x, p, sizeof(Uint64)); + x = Twiddle64(x); + memcpy(p, &x, sizeof(Uint64)); + } + + if(attr_desc->m_column->getType() == NdbDictionary::Column::Timestamp) + { + attr_data->u_int32_value[0] = Twiddle32(attr_data->u_int32_value[0]); + } + if(arraySize == 0){ arraySize = attr_desc->arraySize; } @@ -580,29 +606,6 @@ RestoreDataIterator::readTupleData(Uint3 assert(arraySize <= attr_desc->arraySize); //convert the length of blob(v1) and text(v1) - if(!m_hostByteOrder - && (attr_desc->m_column->getType() == NdbDictionary::Column::Blob - || attr_desc->m_column->getType() == NdbDictionary::Column::Text) - && attr_desc->m_column->getArrayType() == NdbDictionary::Column::ArrayTypeFixed) - { - char* p = (char*)&attr_data->u_int64_value[0]; - Uint64 x; - memcpy(&x, p, sizeof(Uint64)); - x = Twiddle64(x); - memcpy(p, &x, sizeof(Uint64)); - } - - //convert datetime type - if(!m_hostByteOrder - && attr_desc->m_column->getType() == NdbDictionary::Column::Datetime) - { - char* p = (char*)&attr_data->u_int64_value[0]; - Uint64 x; - memcpy(&x, p, sizeof(Uint64)); - x = Twiddle64(x); - memcpy(p, &x, sizeof(Uint64)); - } - if(!Twiddle(attr_desc, attr_data, attr_desc->arraySize)) { return -1; @@ -689,10 +692,6 @@ RestoreDataIterator::getNextTuple(int & attr_data->size = 4*sz; //if (m_currentTable->getTableId() >= 2) { ndbout << "fix i=" << i << " off=" << ptr-buf_ptr << " attrId=" << attrId << endl; } - if(!m_hostByteOrder - && attr_desc->m_column->getType() == NdbDictionary::Column::Timestamp) - attr_data->u_int32_value[0] = Twiddle32(attr_data->u_int32_value[0]); - if(!Twiddle(attr_desc, attr_data)) { res = -1;