From: Date: November 6 2007 10:44am Subject: bk commit into 5.1 tree (tomas:1.2713) BUG#31723 List-Archive: http://lists.mysql.com/commits/37165 X-Bug: 31723 Message-Id: <20071106094403.7F2E0181448A1@linux.local> Below is the list of changes that have just been committed into a local 5.1 repository of tomas. When tomas 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, 2007-11-06 10:43:57+01:00, tomas@stripped +3 -0 ndb - bug#31723 fix restore from drop6p >= 3 storage/ndb/tools/restore/Restore.cpp@stripped, 2007-11-06 10:43:55+01:00, tomas@stripped +69 -7 ndb - bug#31723 fix restore from drop6p >= 3 storage/ndb/tools/restore/Restore.hpp@stripped, 2007-11-06 10:43:55+01:00, tomas@stripped +2 -0 ndb - bug#31723 fix restore from drop6p >= 3 storage/ndb/tools/restore/restore_main.cpp@stripped, 2007-11-06 10:43:55+01:00, tomas@stripped +3 -1 ndb - bug#31723 fix restore from drop6p >= 3 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:28:45 +01:00 +++ b/storage/ndb/tools/restore/Restore.cpp 2007-11-06 10:43:55 +01:00 @@ -166,7 +166,8 @@ RestoreMetaData::readMetaTableDesc() { // Read section header Uint32 sz = sizeof(sectionInfo) >> 2; - if (m_fileHeader.NdbVersion < NDBD_ROWID_VERSION) + if (m_fileHeader.NdbVersion < NDBD_ROWID_VERSION || + m_fileHeader.NdbVersion == DROP6_VERSION) { sz = 2; sectionInfo[2] = htonl(DictTabInfo::UserTable); @@ -500,8 +501,10 @@ bool RestoreMetaData::parseTableDescriptor(const Uint32 * data, Uint32 len) { NdbTableImpl* tableImpl = 0; - int ret = NdbDictInterface::parseTableInfo(&tableImpl, data, len, false, - m_fileHeader.NdbVersion); + int ret = NdbDictInterface::parseTableInfo + (&tableImpl, data, len, false, + m_fileHeader.NdbVersion == DROP6_VERSION ? MAKE_VERSION(5,1,2) : + m_fileHeader.NdbVersion); if (ret != 0) { err << "parseTableInfo " << " failed" << endl; @@ -666,6 +669,56 @@ RestoreDataIterator::readTupleData(Uint3 return 0; } + +int +RestoreDataIterator::readTupleData_drop6(Uint32 *buf_ptr, Uint32 *ptr, + Uint32 dataLength) +{ + for (i = 0; i < m_currentTable->m_variableAttribs.size(); i++) + { + const Uint32 attrId = m_currentTable->m_variableAttribs[i]->attrId; + + AttributeData * attr_data = m_tuple.getData(attrId); + const AttributeDesc * attr_desc = m_tuple.getDesc(attrId); + + if(attr_desc->m_column->getNullable()) + { + const Uint32 ind = attr_desc->m_nullBitIndex; + if(BitmaskImpl::get(m_currentTable->m_nullBitmaskSize, + buf_ptr,ind)) + { + attr_data->null = true; + attr_data->void_value = NULL; + continue; + } + } + + assert(ptr < buf_ptr + dataLength); + + typedef BackupFormat::DataFile::VariableData VarData; + VarData * data = (VarData *)ptr; + Uint32 sz = ntohl(data->Sz); + Uint32 id = ntohl(data->Id); + assert(id == attrId); + + attr_data->null = false; + attr_data->void_value = &data->Data[0]; + + /** + * Compute array size + */ + const Uint32 arraySize = (4 * sz) / (attr_desc->size / 8); + assert(arraySize >= attr_desc->arraySize); + if (!Twiddle(attr_desc, attr_data, attr_desc->arraySize)) + { + return -1; + } + ptr += (sz + 2); + } + assert(ptr == buf_ptr + dataLength); + return 0; +} + const TupleS * RestoreDataIterator::getNextTuple(int & res) { @@ -762,8 +815,16 @@ RestoreDataIterator::getNextTuple(int & attr_data->void_value = NULL; } - if ((res = readTupleData(buf_ptr, ptr, dataLength))) - return NULL; + if (m_currentTable->backupVersion != DROP6_VERSION) + { + if ((res = readTupleData(buf_ptr, ptr, dataLength))) + return NULL; + } + else + { + if ((res = readTupleData_drop6(buf_ptr, ptr, dataLength))) + return NULL; + } m_count ++; res = 0; @@ -1105,7 +1166,7 @@ void TableS::createAttr(NdbDictionary::C } // just a reminder - does not solve backwards compat - if (backupVersion < MAKE_VERSION(5,1,3)) + if (backupVersion < MAKE_VERSION(5,1,3) || backupVersion == DROP6_VERSION) { d->m_nullBitIndex = m_noOfNullable; m_noOfNullable++; @@ -1193,7 +1254,8 @@ RestoreLogIterator::getNextLogEntry(int return 0; } - if (unlikely(m_metaData.getFileHeader().NdbVersion < NDBD_FRAGID_VERSION)) + if (unlikely(m_metaData.getFileHeader().NdbVersion < NDBD_FRAGID_VERSION || + m_metaData.getFileHeader().NdbVersion == DROP6_VERSION)) { /* FragId was introduced in LogEntry in version diff -Nrup a/storage/ndb/tools/restore/Restore.hpp b/storage/ndb/tools/restore/Restore.hpp --- a/storage/ndb/tools/restore/Restore.hpp 2007-11-06 10:28:45 +01:00 +++ b/storage/ndb/tools/restore/Restore.hpp 2007-11-06 10:43:55 +01:00 @@ -24,6 +24,7 @@ #include #include +#define DROP6_VERSION MAKE_VERSION(5,2,1) const int FileNameLenC = 256; const int TableNameLenC = 256; @@ -368,6 +369,7 @@ public: private: int readTupleData(Uint32 *buf_ptr, Uint32 *ptr, Uint32 dataLength); + int readTupleData_drop6(Uint32 *buf_ptr, Uint32 *ptr, Uint32 dataLength); }; class LogEntry { diff -Nrup a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp --- a/storage/ndb/tools/restore/restore_main.cpp 2007-09-12 14:04:59 +02:00 +++ b/storage/ndb/tools/restore/restore_main.cpp 2007-11-06 10:43:55 +01:00 @@ -725,7 +725,9 @@ main(int argc, char** argv) char buf[NDB_VERSION_STRING_BUF_SZ]; info.setLevel(254); info << "Ndb version in backup files: " - << ndbGetVersionString(version, 0, 0, buf, sizeof(buf)) << endl; + << ndbGetVersionString(version, 0, + version == DROP6_VERSION ? "-drop6" : 0, + buf, sizeof(buf)) << endl; /** * check wheater we can restore the backup (right version).