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

bug#11675 - ndb backup

  Fix invalid backup log when using #nodes != 2^x
  Fix ndb_restore --printXXX options
    (among other init counters)
parent 5faa698e
...@@ -2858,8 +2858,6 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len) ...@@ -2858,8 +2858,6 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len)
/** /**
* Initialize table object * Initialize table object
*/ */
tabPtr.p->frag_mask = RNIL;
tabPtr.p->schemaVersion = tmpTab.TableVersion; tabPtr.p->schemaVersion = tmpTab.TableVersion;
tabPtr.p->noOfAttributes = tmpTab.NoOfAttributes; tabPtr.p->noOfAttributes = tmpTab.NoOfAttributes;
tabPtr.p->noOfNull = 0; tabPtr.p->noOfNull = 0;
...@@ -2952,7 +2950,6 @@ Backup::execDI_FCOUNTCONF(Signal* signal) ...@@ -2952,7 +2950,6 @@ Backup::execDI_FCOUNTCONF(Signal* signal)
ndbrequire(findTable(ptr, tabPtr, tableId)); ndbrequire(findTable(ptr, tabPtr, tableId));
ndbrequire(tabPtr.p->fragments.seize(fragCount) != false); ndbrequire(tabPtr.p->fragments.seize(fragCount) != false);
tabPtr.p->frag_mask = calculate_frag_mask(fragCount);
for(Uint32 i = 0; i<fragCount; i++) { for(Uint32 i = 0; i<fragCount; i++) {
jam(); jam();
FragmentPtr fragPtr; FragmentPtr fragPtr;
...@@ -3769,15 +3766,6 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr) ...@@ -3769,15 +3766,6 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
* Slave functionallity: Perform logging * Slave functionallity: Perform logging
* *
****************************************************************************/ ****************************************************************************/
Uint32
Backup::calculate_frag_mask(Uint32 count)
{
Uint32 mask = 1;
while (mask < count) mask <<= 1;
mask -= 1;
return mask;
}
void void
Backup::execBACKUP_TRIG_REQ(Signal* signal) Backup::execBACKUP_TRIG_REQ(Signal* signal)
{ {
...@@ -3794,14 +3782,6 @@ Backup::execBACKUP_TRIG_REQ(Signal* signal) ...@@ -3794,14 +3782,6 @@ Backup::execBACKUP_TRIG_REQ(Signal* signal)
jamEntry(); jamEntry();
c_triggerPool.getPtr(trigPtr, trigger_id); c_triggerPool.getPtr(trigPtr, trigger_id);
c_tablePool.getPtr(tabPtr, trigPtr.p->tab_ptr_i); c_tablePool.getPtr(tabPtr, trigPtr.p->tab_ptr_i);
frag_id = frag_id & tabPtr.p->frag_mask;
/*
At the moment the fragment identity known by TUP is the
actual fragment id but with possibly an extra bit set.
This is due to that ACC splits the fragment. Thus fragment id 5 can
here be either 5 or 13. Thus masking with 2 ** n - 1 where number of
fragments <= 2 ** n will always provide a correct fragment id.
*/
tabPtr.p->fragments.getPtr(fragPtr, frag_id); tabPtr.p->fragments.getPtr(fragPtr, frag_id);
if (fragPtr.p->node != getOwnNodeId()) { if (fragPtr.p->node != getOwnNodeId()) {
jam(); jam();
......
...@@ -195,7 +195,6 @@ public: ...@@ -195,7 +195,6 @@ public:
Uint32 tableId; Uint32 tableId;
Uint32 schemaVersion; Uint32 schemaVersion;
Uint32 frag_mask;
Uint32 tableType; Uint32 tableType;
Uint32 noOfNull; Uint32 noOfNull;
Uint32 noOfAttributes; Uint32 noOfAttributes;
...@@ -526,8 +525,6 @@ public: ...@@ -526,8 +525,6 @@ public:
ArrayPool<Node> c_nodePool; ArrayPool<Node> c_nodePool;
ArrayPool<TriggerRecord> c_triggerPool; ArrayPool<TriggerRecord> c_triggerPool;
Uint32 calculate_frag_mask(Uint32);
void checkFile(Signal*, BackupFilePtr); void checkFile(Signal*, BackupFilePtr);
void checkScan(Signal*, BackupFilePtr); void checkScan(Signal*, BackupFilePtr);
void fragmentCompleted(Signal*, BackupFilePtr); void fragmentCompleted(Signal*, BackupFilePtr);
......
...@@ -603,7 +603,7 @@ void Dbtup::executeTrigger(Signal* signal, ...@@ -603,7 +603,7 @@ void Dbtup::executeTrigger(Signal* signal,
for everybody else. for everybody else.
*/ */
signal->theData[0] = trigPtr->triggerId; signal->theData[0] = trigPtr->triggerId;
signal->theData[1] = regOperPtr->fragId; signal->theData[1] = regOperPtr->fragId >> 1; // send "real" frag id
EXECUTE_DIRECT(BACKUP, GSN_BACKUP_TRIG_REQ, signal, 2); EXECUTE_DIRECT(BACKUP, GSN_BACKUP_TRIG_REQ, signal, 2);
ljamEntry(); ljamEntry();
if (signal->theData[0] == 0) { if (signal->theData[0] == 0) {
......
...@@ -646,7 +646,7 @@ bool RestoreDataIterator::readFragmentHeader(int & ret) ...@@ -646,7 +646,7 @@ bool RestoreDataIterator::readFragmentHeader(int & ret)
} }
info << "_____________________________________________________" << endl info << "_____________________________________________________" << endl
<< "Restoring data in table: " << m_currentTable->getTableName() << "Processing data in table: " << m_currentTable->getTableName()
<< "(" << Header.TableId << ") fragment " << "(" << Header.TableId << ") fragment "
<< Header.FragmentNo << endl; << Header.FragmentNo << endl;
......
...@@ -29,6 +29,8 @@ public: ...@@ -29,6 +29,8 @@ public:
m_print_log = false; m_print_log = false;
m_print_data = false; m_print_data = false;
m_print_meta = false; m_print_meta = false;
m_logCount = 0;
m_dataCount = 0;
} }
virtual bool table(const TableS &); virtual bool table(const TableS &);
......
...@@ -317,7 +317,7 @@ main(int argc, char** argv) ...@@ -317,7 +317,7 @@ main(int argc, char** argv)
if (ga_restore || ga_print) if (ga_restore || ga_print)
{ {
if (ga_restore) if(_restore_data || _print_data)
{ {
RestoreDataIterator dataIter(metaData, &free_data_callback); RestoreDataIterator dataIter(metaData, &free_data_callback);
...@@ -364,7 +364,10 @@ main(int argc, char** argv) ...@@ -364,7 +364,10 @@ main(int argc, char** argv)
for (i= 0; i < g_consumers.size(); i++) for (i= 0; i < g_consumers.size(); i++)
g_consumers[i]->endOfTuples(); g_consumers[i]->endOfTuples();
}
if(_restore_data || _print_log)
{
RestoreLogIterator logIter(metaData); RestoreLogIterator logIter(metaData);
if (!logIter.readHeader()) if (!logIter.readHeader())
{ {
...@@ -388,6 +391,10 @@ main(int argc, char** argv) ...@@ -388,6 +391,10 @@ main(int argc, char** argv)
logIter.validateFooter(); //not implemented logIter.validateFooter(); //not implemented
for (i= 0; i < g_consumers.size(); i++) for (i= 0; i < g_consumers.size(); i++)
g_consumers[i]->endOfLogEntrys(); g_consumers[i]->endOfLogEntrys();
}
if(_restore_data)
{
for(i = 0; i<metaData.getNoOfTables(); i++) for(i = 0; i<metaData.getNoOfTables(); i++)
{ {
if (checkSysTable(metaData[i]->getTableName())) if (checkSysTable(metaData[i]->getTableName()))
......
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