Commit 3ea233d5 authored by unknown's avatar unknown

bug#11675 - ndb backup

  Fix invalid backup log when using #nodes != 2^x
  Fix ndb_restore --printXXX options
    (among other init counters)


ndb/src/kernel/blocks/backup/Backup.cpp:
  remove frag_mask since in 5.0 extra frag bit in in bit 0
ndb/src/kernel/blocks/backup/Backup.hpp:
  remove frag_mask since in 5.0 extra frag bit in in bit 0
ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp:
  send "real" frag id to backup
ndb/tools/restore/Restore.cpp:
  Changed prinout (since it's wrong if you only print stuff)
ndb/tools/restore/consumer_printer.hpp:
  Init log/data count in printer
ndb/tools/restore/restore_main.cpp:
  Fix if-statements
    for correct handling of ndb_restore flags
parent c556acbf
......@@ -2858,8 +2858,6 @@ Backup::parseTableDescription(Signal* signal, BackupRecordPtr ptr, Uint32 len)
/**
* Initialize table object
*/
tabPtr.p->frag_mask = RNIL;
tabPtr.p->schemaVersion = tmpTab.TableVersion;
tabPtr.p->noOfAttributes = tmpTab.NoOfAttributes;
tabPtr.p->noOfNull = 0;
......@@ -2952,7 +2950,6 @@ Backup::execDI_FCOUNTCONF(Signal* signal)
ndbrequire(findTable(ptr, tabPtr, tableId));
ndbrequire(tabPtr.p->fragments.seize(fragCount) != false);
tabPtr.p->frag_mask = calculate_frag_mask(fragCount);
for(Uint32 i = 0; i<fragCount; i++) {
jam();
FragmentPtr fragPtr;
......@@ -3769,15 +3766,6 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
* Slave functionallity: Perform logging
*
****************************************************************************/
Uint32
Backup::calculate_frag_mask(Uint32 count)
{
Uint32 mask = 1;
while (mask < count) mask <<= 1;
mask -= 1;
return mask;
}
void
Backup::execBACKUP_TRIG_REQ(Signal* signal)
{
......@@ -3794,14 +3782,6 @@ Backup::execBACKUP_TRIG_REQ(Signal* signal)
jamEntry();
c_triggerPool.getPtr(trigPtr, trigger_id);
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);
if (fragPtr.p->node != getOwnNodeId()) {
jam();
......
......@@ -195,7 +195,6 @@ public:
Uint32 tableId;
Uint32 schemaVersion;
Uint32 frag_mask;
Uint32 tableType;
Uint32 noOfNull;
Uint32 noOfAttributes;
......@@ -526,8 +525,6 @@ public:
ArrayPool<Node> c_nodePool;
ArrayPool<TriggerRecord> c_triggerPool;
Uint32 calculate_frag_mask(Uint32);
void checkFile(Signal*, BackupFilePtr);
void checkScan(Signal*, BackupFilePtr);
void fragmentCompleted(Signal*, BackupFilePtr);
......
......@@ -603,7 +603,7 @@ void Dbtup::executeTrigger(Signal* signal,
for everybody else.
*/
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);
ljamEntry();
if (signal->theData[0] == 0) {
......
......@@ -646,7 +646,7 @@ bool RestoreDataIterator::readFragmentHeader(int & ret)
}
info << "_____________________________________________________" << endl
<< "Restoring data in table: " << m_currentTable->getTableName()
<< "Processing data in table: " << m_currentTable->getTableName()
<< "(" << Header.TableId << ") fragment "
<< Header.FragmentNo << endl;
......
......@@ -29,6 +29,8 @@ public:
m_print_log = false;
m_print_data = false;
m_print_meta = false;
m_logCount = 0;
m_dataCount = 0;
}
virtual bool table(const TableS &);
......
......@@ -317,7 +317,7 @@ main(int argc, char** argv)
if (ga_restore || ga_print)
{
if (ga_restore)
if(_restore_data || _print_data)
{
RestoreDataIterator dataIter(metaData, &free_data_callback);
......@@ -364,7 +364,10 @@ main(int argc, char** argv)
for (i= 0; i < g_consumers.size(); i++)
g_consumers[i]->endOfTuples();
}
if(_restore_data || _print_log)
{
RestoreLogIterator logIter(metaData);
if (!logIter.readHeader())
{
......@@ -388,6 +391,10 @@ main(int argc, char** argv)
logIter.validateFooter(); //not implemented
for (i= 0; i < g_consumers.size(); i++)
g_consumers[i]->endOfLogEntrys();
}
if(_restore_data)
{
for(i = 0; i<metaData.getNoOfTables(); i++)
{
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