ndb -

  Snapup testBackup XXXerror
parent 802990e1
...@@ -223,6 +223,7 @@ Backup::execCONTINUEB(Signal* signal) ...@@ -223,6 +223,7 @@ Backup::execCONTINUEB(Signal* signal)
} }
case BackupContinueB::BACKUP_FRAGMENT_INFO: case BackupContinueB::BACKUP_FRAGMENT_INFO:
{ {
jam();
const Uint32 ptr_I = Tdata1; const Uint32 ptr_I = Tdata1;
Uint32 tabPtr_I = Tdata2; Uint32 tabPtr_I = Tdata2;
Uint32 fragPtr_I = signal->theData[3]; Uint32 fragPtr_I = signal->theData[3];
...@@ -231,48 +232,56 @@ Backup::execCONTINUEB(Signal* signal) ...@@ -231,48 +232,56 @@ Backup::execCONTINUEB(Signal* signal)
c_backupPool.getPtr(ptr, ptr_I); c_backupPool.getPtr(ptr, ptr_I);
TablePtr tabPtr; TablePtr tabPtr;
ptr.p->tables.getPtr(tabPtr, tabPtr_I); ptr.p->tables.getPtr(tabPtr, tabPtr_I);
FragmentPtr fragPtr;
tabPtr.p->fragments.getPtr(fragPtr, fragPtr_I);
BackupFilePtr filePtr;
ptr.p->files.getPtr(filePtr, ptr.p->ctlFilePtr);
const Uint32 sz = sizeof(BackupFormat::CtlFile::FragmentInfo) >> 2; if (fragPtr_I != tabPtr.p->fragments.getSize())
Uint32 * dst;
if (!filePtr.p->operation.dataBuffer.getWritePtr(&dst, sz))
{ {
sendSignalWithDelay(BACKUP_REF, GSN_CONTINUEB, signal, 100, 4); jam();
return; FragmentPtr fragPtr;
tabPtr.p->fragments.getPtr(fragPtr, fragPtr_I);
BackupFilePtr filePtr;
ptr.p->files.getPtr(filePtr, ptr.p->ctlFilePtr);
const Uint32 sz = sizeof(BackupFormat::CtlFile::FragmentInfo) >> 2;
Uint32 * dst;
if (!filePtr.p->operation.dataBuffer.getWritePtr(&dst, sz))
{
sendSignalWithDelay(BACKUP_REF, GSN_CONTINUEB, signal, 100, 4);
return;
}
BackupFormat::CtlFile::FragmentInfo * fragInfo =
(BackupFormat::CtlFile::FragmentInfo*)dst;
fragInfo->SectionType = htonl(BackupFormat::FRAGMENT_INFO);
fragInfo->SectionLength = htonl(sz);
fragInfo->TableId = htonl(fragPtr.p->tableId);
fragInfo->FragmentNo = htonl(fragPtr_I);
fragInfo->NoOfRecordsLow = htonl(fragPtr.p->noOfRecords & 0xFFFFFFFF);
fragInfo->NoOfRecordsHigh = htonl(fragPtr.p->noOfRecords >> 32);
fragInfo->FilePosLow = htonl(0);
fragInfo->FilePosHigh = htonl(0);
filePtr.p->operation.dataBuffer.updateWritePtr(sz);
fragPtr_I++;
} }
BackupFormat::CtlFile::FragmentInfo * fragInfo =
(BackupFormat::CtlFile::FragmentInfo*)dst;
fragInfo->SectionType = htonl(BackupFormat::FRAGMENT_INFO);
fragInfo->SectionLength = htonl(sz);
fragInfo->TableId = htonl(fragPtr.p->tableId);
fragInfo->FragmentNo = htonl(fragPtr_I);
fragInfo->NoOfRecordsLow = htonl(fragPtr.p->noOfRecords & 0xFFFFFFFF);
fragInfo->NoOfRecordsHigh = htonl(fragPtr.p->noOfRecords >> 32);
fragInfo->FilePosLow = htonl(0);
fragInfo->FilePosHigh = htonl(0);
filePtr.p->operation.dataBuffer.updateWritePtr(sz);
fragPtr_I++;
if (fragPtr_I == tabPtr.p->fragments.getSize()) if (fragPtr_I == tabPtr.p->fragments.getSize())
{ {
signal->theData[0] = tabPtr.p->tableId; signal->theData[0] = tabPtr.p->tableId;
signal->theData[1] = 0; // unlock signal->theData[1] = 0; // unlock
EXECUTE_DIRECT(DBDICT, GSN_BACKUP_FRAGMENT_REQ, signal, 2); EXECUTE_DIRECT(DBDICT, GSN_BACKUP_FRAGMENT_REQ, signal, 2);
fragPtr_I = 0; fragPtr_I = 0;
ptr.p->tables.next(tabPtr); ptr.p->tables.next(tabPtr);
if ((tabPtr_I = tabPtr.i) == RNIL) if ((tabPtr_I = tabPtr.i) == RNIL)
{ {
closeFiles(signal, ptr); jam();
return; closeFiles(signal, ptr);
return;
} }
} }
signal->theData[0] = BackupContinueB::BACKUP_FRAGMENT_INFO; signal->theData[0] = BackupContinueB::BACKUP_FRAGMENT_INFO;
signal->theData[1] = ptr_I; signal->theData[1] = ptr_I;
signal->theData[2] = tabPtr_I; signal->theData[2] = tabPtr_I;
...@@ -2037,13 +2046,20 @@ Backup::sendDropTrig(Signal* signal, BackupRecordPtr ptr) ...@@ -2037,13 +2046,20 @@ Backup::sendDropTrig(Signal* signal, BackupRecordPtr ptr)
{ {
TablePtr tabPtr; TablePtr tabPtr;
ptr.p->tables.first(tabPtr); if (ptr.p->tables.first(tabPtr))
{
signal->theData[0] = BackupContinueB::BACKUP_FRAGMENT_INFO; jam();
signal->theData[1] = ptr.i; signal->theData[0] = BackupContinueB::BACKUP_FRAGMENT_INFO;
signal->theData[2] = tabPtr.i; signal->theData[1] = ptr.i;
signal->theData[3] = 0; signal->theData[2] = tabPtr.i;
sendSignal(BACKUP_REF, GSN_CONTINUEB, signal, 4, JBB); signal->theData[3] = 0;
sendSignal(BACKUP_REF, GSN_CONTINUEB, signal, 4, JBB);
}
else
{
jam();
closeFiles(signal, ptr);
}
} }
} }
} }
...@@ -2362,19 +2378,10 @@ Backup::defineBackupRef(Signal* signal, BackupRecordPtr ptr, Uint32 errCode) ...@@ -2362,19 +2378,10 @@ Backup::defineBackupRef(Signal* signal, BackupRecordPtr ptr, Uint32 errCode)
{ {
jam(); jam();
ndbrequire(! (filePtr.p->m_flags & BackupFile::BF_FILE_THREAD)); ndbrequire(! (filePtr.p->m_flags & BackupFile::BF_FILE_THREAD));
ndbrequire(! (filePtr.p->m_flags & BackupFile::BF_CLOSING));
filePtr.p->m_flags &= ~(Uint32)BackupFile::BF_LCP_META; filePtr.p->m_flags &= ~(Uint32)BackupFile::BF_LCP_META;
if (filePtr.p->m_flags & BackupFile::BF_OPEN) if (filePtr.p->m_flags & BackupFile::BF_OPEN)
{ {
filePtr.p->m_flags |= BackupFile::BF_CLOSING; closeFile(signal, ptr, filePtr);
FsCloseReq * req = (FsCloseReq *)signal->getDataPtrSend();
req->filePointer = filePtr.p->filePointer;
req->userPointer = filePtr.i;
req->userReference = reference();
req->fileFlag = 0;
FsCloseReq::setRemoveFileFlag(req->fileFlag, 1);
sendSignal(NDBFS_REF, GSN_FSCLOSEREQ, signal,
FsCloseReq::SignalLength, JBA);
return; return;
} }
} }
...@@ -4080,29 +4087,10 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr) ...@@ -4080,29 +4087,10 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr)
ndbrequire(flags & BackupFile::BF_OPEN); ndbrequire(flags & BackupFile::BF_OPEN);
ndbrequire(flags & BackupFile::BF_FILE_THREAD); ndbrequire(flags & BackupFile::BF_FILE_THREAD);
ndbrequire(! (flags & BackupFile::BF_CLOSING));
filePtr.p->m_flags |= BackupFile::BF_CLOSING;
FsCloseReq * req = (FsCloseReq *)signal->getDataPtrSend();
req->filePointer = filePtr.p->filePointer;
req->userPointer = filePtr.i;
req->userReference = reference();
req->fileFlag = 0;
BackupRecordPtr ptr; BackupRecordPtr ptr;
c_backupPool.getPtr(ptr, filePtr.p->backupPtr); c_backupPool.getPtr(ptr, filePtr.p->backupPtr);
closeFile(signal, ptr, filePtr);
if (ptr.p->errorCode)
{
FsCloseReq::setRemoveFileFlag(req->fileFlag, 1);
}
#ifdef DEBUG_ABORT
ndbout_c("***** a FSCLOSEREQ filePtr.i = %u run=%d cl=%d", filePtr.i,
running, closing);
#endif
sendSignal(NDBFS_REF, GSN_FSCLOSEREQ, signal, FsCloseReq::SignalLength, JBA);
} }
...@@ -4367,7 +4355,7 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr) ...@@ -4367,7 +4355,7 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr)
else else
{ {
jam(); jam();
checkFile(sig, filePtr); // make sure we write everything before closing closeFile(sig, ptr, filePtr);
} }
} }
...@@ -4377,6 +4365,33 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr) ...@@ -4377,6 +4365,33 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr)
}//if }//if
} }
void
Backup::closeFile(Signal* signal, BackupRecordPtr ptr, BackupFilePtr filePtr)
{
ndbrequire(filePtr.p->m_flags & BackupFile::BF_OPEN);
ndbrequire(! (filePtr.p->m_flags & BackupFile::BF_OPENING));
ndbrequire(! (filePtr.p->m_flags & BackupFile::BF_CLOSING));
filePtr.p->m_flags |= BackupFile::BF_CLOSING;
FsCloseReq * req = (FsCloseReq *)signal->getDataPtrSend();
req->filePointer = filePtr.p->filePointer;
req->userPointer = filePtr.i;
req->userReference = reference();
req->fileFlag = 0;
if (ptr.p->errorCode)
{
FsCloseReq::setRemoveFileFlag(req->fileFlag, 1);
}
#ifdef DEBUG_ABORT
ndbout_c("***** a FSCLOSEREQ filePtr.i = %u flags: %x",
filePtr.i, filePtr.p->m_flags);
#endif
sendSignal(NDBFS_REF, GSN_FSCLOSEREQ, signal, FsCloseReq::SignalLength, JBA);
}
void void
Backup::execFSCLOSEREF(Signal* signal) Backup::execFSCLOSEREF(Signal* signal)
{ {
......
...@@ -582,6 +582,7 @@ public: ...@@ -582,6 +582,7 @@ public:
void openFiles(Signal* signal, BackupRecordPtr ptr); void openFiles(Signal* signal, BackupRecordPtr ptr);
void openFilesReply(Signal*, BackupRecordPtr ptr, BackupFilePtr); void openFilesReply(Signal*, BackupRecordPtr ptr, BackupFilePtr);
void closeFiles(Signal*, BackupRecordPtr ptr); void closeFiles(Signal*, BackupRecordPtr ptr);
void closeFile(Signal*, BackupRecordPtr, BackupFilePtr);
void closeFilesDone(Signal*, BackupRecordPtr ptr); void closeFilesDone(Signal*, BackupRecordPtr ptr);
void sendDefineBackupReq(Signal *signal, BackupRecordPtr ptr); void sendDefineBackupReq(Signal *signal, BackupRecordPtr ptr);
......
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