bug#11675 - ndb backup

Fix invalid backup log when using #nodes != 2^x
  Fix ndb_restore --printXXX options
    (among other init counters)
This commit is contained in:
joreland@mysql.com 2005-07-22 12:17:53 +02:00
parent 5faa698eef
commit fc2573a086
6 changed files with 12 additions and 26 deletions

View file

@ -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();

View file

@ -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);

View file

@ -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) {

View file

@ -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;

View file

@ -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 &);

View file

@ -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()))