Commit c3db04f6 authored by joreland@mysql.com's avatar joreland@mysql.com

Merge mysql.com:/home/jonas/src/mysql-4.1-fix

into mysql.com:/home/jonas/src/mysql-4.1
parents c735aaeb 4614cdfa
...@@ -1272,10 +1272,6 @@ Backup::createAttributeMask(TablePtr tabPtr, ...@@ -1272,10 +1272,6 @@ Backup::createAttributeMask(TablePtr tabPtr,
jam(); jam();
AttributePtr attr; AttributePtr attr;
table.attributes.getPtr(attr, i); table.attributes.getPtr(attr, i);
if(attr.p->data.key != 0){
jam();
continue;
}
mask.set(i); mask.set(i);
} }
} }
...@@ -2961,12 +2957,9 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len) ...@@ -2961,12 +2957,9 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len)
tabPtr.p->schemaVersion = tmpTab.TableVersion; tabPtr.p->schemaVersion = tmpTab.TableVersion;
tabPtr.p->noOfAttributes = tmpTab.NoOfAttributes; tabPtr.p->noOfAttributes = tmpTab.NoOfAttributes;
tabPtr.p->noOfKeys = tmpTab.NoOfKeyAttr;
tabPtr.p->noOfNull = 0; tabPtr.p->noOfNull = 0;
tabPtr.p->noOfVariable = 0; // Computed while iterating over attribs tabPtr.p->noOfVariable = 0; // Computed while iterating over attribs
tabPtr.p->sz_FixedKeys = 0; // Computed while iterating over attribs
tabPtr.p->sz_FixedAttributes = 0; // Computed while iterating over attribs tabPtr.p->sz_FixedAttributes = 0; // Computed while iterating over attribs
tabPtr.p->variableKeyId = RNIL; // Computed while iterating over attribs
tabPtr.p->triggerIds[0] = ILLEGAL_TRIGGER_ID; tabPtr.p->triggerIds[0] = ILLEGAL_TRIGGER_ID;
tabPtr.p->triggerIds[1] = ILLEGAL_TRIGGER_ID; tabPtr.p->triggerIds[1] = ILLEGAL_TRIGGER_ID;
tabPtr.p->triggerIds[2] = ILLEGAL_TRIGGER_ID; tabPtr.p->triggerIds[2] = ILLEGAL_TRIGGER_ID;
...@@ -3001,7 +2994,6 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len) ...@@ -3001,7 +2994,6 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len)
attrPtr.p->data.nullable = tmp.AttributeNullableFlag; attrPtr.p->data.nullable = tmp.AttributeNullableFlag;
attrPtr.p->data.fixed = (tmp.AttributeArraySize != 0); attrPtr.p->data.fixed = (tmp.AttributeArraySize != 0);
attrPtr.p->data.key = tmp.AttributeKeyFlag;
attrPtr.p->data.sz32 = sz32; attrPtr.p->data.sz32 = sz32;
/** /**
...@@ -3009,12 +3001,7 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len) ...@@ -3009,12 +3001,7 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len)
* 1) Fixed * 1) Fixed
* 2) Nullable * 2) Nullable
* 3) Variable * 3) Variable
* 4) Fixed key
* 5) Variable key
*/ */
if(attrPtr.p->data.key == false) {
jam();
if(attrPtr.p->data.fixed == true && attrPtr.p->data.nullable == false) { if(attrPtr.p->data.fixed == true && attrPtr.p->data.nullable == false) {
jam(); jam();
attrPtr.p->data.offset = tabPtr.p->sz_FixedAttributes; attrPtr.p->data.offset = tabPtr.p->sz_FixedAttributes;
...@@ -3036,25 +3023,6 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len) ...@@ -3036,25 +3023,6 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len)
ndbrequire(0); ndbrequire(0);
}//if }//if
} else if(attrPtr.p->data.key == true) {
jam();
ndbrequire(attrPtr.p->data.nullable == false);
if(attrPtr.p->data.fixed == true) { // Fixed key
jam();
tabPtr.p->sz_FixedKeys += sz32;
}//if
if(attrPtr.p->data.fixed == false) { // Variable key
jam();
attrPtr.p->data.offset = 0;
tabPtr.p->noOfVariable++;
ndbrequire(tabPtr.p->variableKeyId == RNIL); // Only one variable key
tabPtr.p->variableKeyId = attrPtr.i;
ndbrequire(0);
}//if
}//if
it.next(); // Move Past EndOfAttribute it.next(); // Move Past EndOfAttribute
}//for }//for
return tabPtr; return tabPtr;
...@@ -3362,7 +3330,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal) ...@@ -3362,7 +3330,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
Table & table = * tabPtr.p; Table & table = * tabPtr.p;
ScanFragReq * req = (ScanFragReq *)signal->getDataPtrSend(); ScanFragReq * req = (ScanFragReq *)signal->getDataPtrSend();
const Uint32 parallelism = 16; const Uint32 parallelism = 16;
const Uint32 attrLen = 5 + table.noOfAttributes - table.noOfKeys; const Uint32 attrLen = 5 + table.noOfAttributes;
req->senderData = filePtr.i; req->senderData = filePtr.i;
req->resultRef = reference(); req->resultRef = reference();
...@@ -3373,7 +3341,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal) ...@@ -3373,7 +3341,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
req->tableId = table.tableId; req->tableId = table.tableId;
ScanFragReq::setLockMode(req->requestInfo, 0); ScanFragReq::setLockMode(req->requestInfo, 0);
ScanFragReq::setHoldLockFlag(req->requestInfo, 0); ScanFragReq::setHoldLockFlag(req->requestInfo, 0);
ScanFragReq::setKeyinfoFlag(req->requestInfo, 1); ScanFragReq::setKeyinfoFlag(req->requestInfo, 0);
ScanFragReq::setAttrLen(req->requestInfo,attrLen); ScanFragReq::setAttrLen(req->requestInfo,attrLen);
req->transId1 = 0; req->transId1 = 0;
req->transId2 = (BACKUP << 20) + (getOwnNodeId() << 8); req->transId2 = (BACKUP << 20) + (getOwnNodeId() << 8);
...@@ -3388,7 +3356,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal) ...@@ -3388,7 +3356,7 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
signal->theData[2] = (BACKUP << 20) + (getOwnNodeId() << 8); signal->theData[2] = (BACKUP << 20) + (getOwnNodeId() << 8);
// Return all // Return all
signal->theData[3] = table.noOfAttributes - table.noOfKeys; signal->theData[3] = table.noOfAttributes;
signal->theData[4] = 0; signal->theData[4] = 0;
signal->theData[5] = 0; signal->theData[5] = 0;
signal->theData[6] = 0; signal->theData[6] = 0;
...@@ -3400,10 +3368,6 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal) ...@@ -3400,10 +3368,6 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
jam(); jam();
AttributePtr attr; AttributePtr attr;
table.attributes.getPtr(attr, i); table.attributes.getPtr(attr, i);
if(attr.p->data.key != 0) {
jam();
continue;
}//if
AttributeHeader::init(&signal->theData[dataPos], i, 0); AttributeHeader::init(&signal->theData[dataPos], i, 0);
dataPos++; dataPos++;
...@@ -3513,64 +3477,19 @@ Backup::execTRANSID_AI(Signal* signal) ...@@ -3513,64 +3477,19 @@ Backup::execTRANSID_AI(Signal* signal)
} }
} }
void
Backup::execKEYINFO20(Signal* signal)
{
jamEntry();
const Uint32 filePtrI = signal->theData[0];
const Uint32 keyLen = signal->theData[1];
//const Uint32 scanInfo = signal->theData[2];
//const Uint32 transId1 = signal->theData[3];
//const Uint32 transId2 = signal->theData[4];
const Uint32 dataLen = signal->length() - 5;
BackupFilePtr filePtr;
c_backupFilePool.getPtr(filePtr, filePtrI);
OperationRecord & op = filePtr.p->operation;
/**
* Unpack data
*/
ndbrequire(keyLen == dataLen);
const Uint32 * src = &signal->theData[5];
const Uint32 klFixed = op.getFixedKeySize();
ndbrequire(keyLen >= klFixed);
Uint32 * dst = op.newKey();
memcpy(dst, src, klFixed << 2);
const Uint32 szLeft = (keyLen - klFixed);
if(szLeft > 0) {
jam();
src += klFixed;
dst = op.newVariableKey(szLeft);
memcpy(dst, src, (szLeft << 2));
ndbrequire(0);
}//if
if(op.finished()){
jam();
op.newRecord(op.dst);
}
}
void void
Backup::OperationRecord::init(const TablePtr & ptr) Backup::OperationRecord::init(const TablePtr & ptr)
{ {
tablePtr = ptr.i; tablePtr = ptr.i;
noOfAttributes = (ptr.p->noOfAttributes - ptr.p->noOfKeys) + 1; noOfAttributes = ptr.p->noOfAttributes;
variableKeyId = ptr.p->variableKeyId;
sz_Bitmask = (ptr.p->noOfNull + 31) >> 5; sz_Bitmask = (ptr.p->noOfNull + 31) >> 5;
sz_FixedKeys = ptr.p->sz_FixedKeys;
sz_FixedAttribs = ptr.p->sz_FixedAttributes; sz_FixedAttribs = ptr.p->sz_FixedAttributes;
if(ptr.p->noOfVariable == 0) { if(ptr.p->noOfVariable == 0) {
jam(); jam();
maxRecordSize = 1 + sz_Bitmask + sz_FixedKeys + sz_FixedAttribs; maxRecordSize = 1 + sz_Bitmask + sz_FixedAttribs;
} else { } else {
jam(); jam();
maxRecordSize = maxRecordSize =
......
...@@ -76,7 +76,6 @@ protected: ...@@ -76,7 +76,6 @@ protected:
*/ */
void execSCAN_HBREP(Signal* signal); void execSCAN_HBREP(Signal* signal);
void execTRANSID_AI(Signal* signal); void execTRANSID_AI(Signal* signal);
void execKEYINFO20(Signal* signal);
void execSCAN_FRAGREF(Signal* signal); void execSCAN_FRAGREF(Signal* signal);
void execSCAN_FRAGCONF(Signal* signal); void execSCAN_FRAGCONF(Signal* signal);
...@@ -172,8 +171,8 @@ public: ...@@ -172,8 +171,8 @@ public:
struct Data { struct Data {
Uint8 nullable; Uint8 nullable;
Uint8 fixed; Uint8 fixed;
Uint8 key;
Uint8 unused; Uint8 unused;
Uint8 unused2;
Uint32 sz32; // No of 32 bit words Uint32 sz32; // No of 32 bit words
Uint32 offset; // Relative DataFixedAttributes/DataFixedKeys Uint32 offset; // Relative DataFixedAttributes/DataFixedKeys
Uint32 offsetNull; // In NullBitmask Uint32 offsetNull; // In NullBitmask
...@@ -199,12 +198,9 @@ public: ...@@ -199,12 +198,9 @@ public:
Uint32 frag_mask; Uint32 frag_mask;
Uint32 tableType; Uint32 tableType;
Uint32 noOfNull; Uint32 noOfNull;
Uint32 noOfKeys;
Uint32 noOfAttributes; Uint32 noOfAttributes;
Uint32 noOfVariable; Uint32 noOfVariable;
Uint32 sz_FixedKeys;
Uint32 sz_FixedAttributes; Uint32 sz_FixedAttributes;
Uint32 variableKeyId;
Uint32 triggerIds[3]; Uint32 triggerIds[3];
bool triggerAllocated[3]; bool triggerAllocated[3];
...@@ -224,7 +220,6 @@ public: ...@@ -224,7 +220,6 @@ public:
* Once per table * Once per table
*/ */
void init(const TablePtr & ptr); void init(const TablePtr & ptr);
inline Uint32 getFixedKeySize() const { return sz_FixedKeys; }
/** /**
* Once per fragment * Once per fragment
...@@ -247,23 +242,19 @@ public: ...@@ -247,23 +242,19 @@ public:
/** /**
* Per attribute * Per attribute
*/ */
Uint32 * newKey();
void nullAttribute(Uint32 nullOffset); void nullAttribute(Uint32 nullOffset);
Uint32 * newNullable(Uint32 attrId, Uint32 sz); Uint32 * newNullable(Uint32 attrId, Uint32 sz);
Uint32 * newAttrib(Uint32 offset, Uint32 sz); Uint32 * newAttrib(Uint32 offset, Uint32 sz);
Uint32 * newVariable(Uint32 id, Uint32 sz); Uint32 * newVariable(Uint32 id, Uint32 sz);
Uint32 * newVariableKey(Uint32 sz);
private: private:
Uint32* base; Uint32* base;
Uint32* dst_Length; Uint32* dst_Length;
Uint32* dst_Bitmask; Uint32* dst_Bitmask;
Uint32* dst_FixedKeys;
Uint32* dst_FixedAttribs; Uint32* dst_FixedAttribs;
BackupFormat::DataFile::VariableData* dst_VariableData; BackupFormat::DataFile::VariableData* dst_VariableData;
Uint32 noOfAttributes; // No of Attributes Uint32 noOfAttributes; // No of Attributes
Uint32 variableKeyId; // Id of variable key
Uint32 attrLeft; // No of attributes left Uint32 attrLeft; // No of attributes left
Uint32 opNoDone; Uint32 opNoDone;
...@@ -289,7 +280,6 @@ public: ...@@ -289,7 +280,6 @@ public:
* sizes of part * sizes of part
*/ */
Uint32 sz_Bitmask; Uint32 sz_Bitmask;
Uint32 sz_FixedKeys;
Uint32 sz_FixedAttribs; Uint32 sz_FixedAttribs;
public: public:
...@@ -629,7 +619,6 @@ Backup::OperationRecord::newRecord(Uint32 * p){ ...@@ -629,7 +619,6 @@ Backup::OperationRecord::newRecord(Uint32 * p){
base = p; base = p;
dst_Length = p; p += 1; dst_Length = p; p += 1;
dst_Bitmask = p; p += sz_Bitmask; dst_Bitmask = p; p += sz_Bitmask;
dst_FixedKeys = p; p += sz_FixedKeys;
dst_FixedAttribs = p; p += sz_FixedAttribs; dst_FixedAttribs = p; p += sz_FixedAttribs;
dst_VariableData = (BackupFormat::DataFile::VariableData*)p; dst_VariableData = (BackupFormat::DataFile::VariableData*)p;
BitmaskImpl::clear(sz_Bitmask, dst_Bitmask); BitmaskImpl::clear(sz_Bitmask, dst_Bitmask);
...@@ -646,14 +635,6 @@ Backup::OperationRecord::newAttrib(Uint32 offset, Uint32 sz){ ...@@ -646,14 +635,6 @@ Backup::OperationRecord::newAttrib(Uint32 offset, Uint32 sz){
return dst; return dst;
} }
inline
Uint32 *
Backup::OperationRecord::newKey(){
attrLeft --;
attrSzLeft = 0;
return dst_FixedKeys;
}
inline inline
void void
Backup::OperationRecord::nullAttribute(Uint32 offsetNull){ Backup::OperationRecord::nullAttribute(Uint32 offsetNull){
...@@ -692,21 +673,6 @@ Backup::OperationRecord::newVariable(Uint32 id, Uint32 sz){ ...@@ -692,21 +673,6 @@ Backup::OperationRecord::newVariable(Uint32 id, Uint32 sz){
return dst; return dst;
} }
inline
Uint32 *
Backup::OperationRecord::newVariableKey(Uint32 sz){
attrLeft--;
attrSzLeft = 0;
attrSzTotal += sz;
dst = &dst_VariableData->Data[0];
dst_VariableData->Sz = htonl(sz);
dst_VariableData->Id = htonl(variableKeyId);
dst_VariableData = (BackupFormat::DataFile::VariableData *)(dst + sz);
return dst;
}
inline inline
bool bool
Backup::OperationRecord::finished(){ Backup::OperationRecord::finished(){
...@@ -714,7 +680,7 @@ Backup::OperationRecord::finished(){ ...@@ -714,7 +680,7 @@ Backup::OperationRecord::finished(){
return false; return false;
} }
opLen += attrSzTotal + sz_FixedKeys; opLen += attrSzTotal;
opNoDone++; opNoDone++;
scanStop = dst = (Uint32 *)dst_VariableData; scanStop = dst = (Uint32 *)dst_VariableData;
......
...@@ -127,7 +127,6 @@ Backup::Backup(const Configuration & conf) : ...@@ -127,7 +127,6 @@ Backup::Backup(const Configuration & conf) :
addRecSignal(GSN_SCAN_HBREP, &Backup::execSCAN_HBREP); addRecSignal(GSN_SCAN_HBREP, &Backup::execSCAN_HBREP);
addRecSignal(GSN_TRANSID_AI, &Backup::execTRANSID_AI); addRecSignal(GSN_TRANSID_AI, &Backup::execTRANSID_AI);
addRecSignal(GSN_KEYINFO20, &Backup::execKEYINFO20);
addRecSignal(GSN_SCAN_FRAGREF, &Backup::execSCAN_FRAGREF); addRecSignal(GSN_SCAN_FRAGREF, &Backup::execSCAN_FRAGREF);
addRecSignal(GSN_SCAN_FRAGCONF, &Backup::execSCAN_FRAGCONF); addRecSignal(GSN_SCAN_FRAGCONF, &Backup::execSCAN_FRAGCONF);
......
...@@ -192,13 +192,14 @@ RestoreMetaData::readGCPEntry() { ...@@ -192,13 +192,14 @@ RestoreMetaData::readGCPEntry() {
return true; return true;
} }
TableS::TableS(NdbTableImpl* tableImpl) TableS::TableS(Uint32 version, NdbTableImpl* tableImpl)
: m_dictTable(tableImpl) : m_dictTable(tableImpl)
{ {
m_dictTable = tableImpl; m_dictTable = tableImpl;
m_noOfNullable = m_nullBitmaskSize = 0; m_noOfNullable = m_nullBitmaskSize = 0;
m_auto_val_id= ~(Uint32)0; m_auto_val_id= ~(Uint32)0;
m_max_auto_val= 0; m_max_auto_val= 0;
backupVersion = version;
for (int i = 0; i < tableImpl->getNoOfColumns(); i++) for (int i = 0; i < tableImpl->getNoOfColumns(); i++)
createAttr(tableImpl->getColumn(i)); createAttr(tableImpl->getColumn(i));
...@@ -226,11 +227,10 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data, Uint32 len) ...@@ -226,11 +227,10 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data, Uint32 len)
debug << "parseTableInfo " << tableImpl->getName() << " done" << endl; debug << "parseTableInfo " << tableImpl->getName() << " done" << endl;
TableS * table = new TableS(tableImpl); TableS * table = new TableS(m_fileHeader.NdbVersion, tableImpl);
if(table == NULL) { if(table == NULL) {
return false; return false;
} }
table->setBackupVersion(m_fileHeader.NdbVersion);
debug << "Parsed table id " << table->getTableId() << endl; debug << "Parsed table id " << table->getTableId() << endl;
debug << "Parsed table #attr " << table->getNoOfAttributes() << endl; debug << "Parsed table #attr " << table->getNoOfAttributes() << endl;
...@@ -699,7 +699,7 @@ void TableS::createAttr(NdbDictionary::Column *column) ...@@ -699,7 +699,7 @@ void TableS::createAttr(NdbDictionary::Column *column)
if (d->m_column->getAutoIncrement()) if (d->m_column->getAutoIncrement())
m_auto_val_id= d->attrId; m_auto_val_id= d->attrId;
if(d->m_column->getPrimaryKey() /* && not variable */) if(d->m_column->getPrimaryKey() && backupVersion <= MAKE_VERSION(4,1,7))
{ {
m_fixedKeys.push_back(d); m_fixedKeys.push_back(d);
return; return;
......
...@@ -140,7 +140,7 @@ class TableS { ...@@ -140,7 +140,7 @@ class TableS {
public: public:
class NdbDictionary::Table* m_dictTable; class NdbDictionary::Table* m_dictTable;
TableS (class NdbTableImpl* dictTable); TableS (Uint32 version, class NdbTableImpl* dictTable);
~TableS(); ~TableS();
Uint32 getTableId() const { Uint32 getTableId() const {
......
...@@ -258,6 +258,13 @@ main(int argc, char** argv) ...@@ -258,6 +258,13 @@ main(int argc, char** argv)
ndbout << "Failed to read " << metaData.getFilename() << endl << endl; ndbout << "Failed to read " << metaData.getFilename() << endl << endl;
return -1; return -1;
} }
const BackupFormat::FileHeader & tmp = metaData.getFileHeader();
const Uint32 version = tmp.NdbVersion;
ndbout << "Ndb version in backup files: "
<< getVersionString(version, 0) << endl;
/** /**
* check wheater we can restore the backup (right version). * check wheater we can restore the backup (right version).
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment