Commit f26782ad authored by unknown's avatar unknown

Merge perch.ndb.mysql.com:/home/jonas/src/51-work

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb


storage/ndb/test/src/NDBT_Tables.cpp:
  Auto merged
parents 42f74d76 20ee9cea
...@@ -223,39 +223,35 @@ Backup::execCONTINUEB(Signal* signal) ...@@ -223,39 +223,35 @@ 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];
BackupRecordPtr ptr; BackupRecordPtr ptr;
c_backupPool.getPtr(ptr, ptr_I); c_backupPool.getPtr(ptr, ptr_I);
if (tabPtr_I == RNIL)
{
closeFiles(signal, ptr);
return;
}
jam();
TablePtr tabPtr; TablePtr tabPtr;
ptr.p->tables.getPtr(tabPtr, tabPtr_I); ptr.p->tables.getPtr(tabPtr, tabPtr_I);
jam();
if(tabPtr.p->fragments.getSize()) if (fragPtr_I != tabPtr.p->fragments.getSize())
{ {
jam();
FragmentPtr fragPtr; FragmentPtr fragPtr;
tabPtr.p->fragments.getPtr(fragPtr, fragPtr_I); tabPtr.p->fragments.getPtr(fragPtr, fragPtr_I);
BackupFilePtr filePtr; BackupFilePtr filePtr;
ptr.p->files.getPtr(filePtr, ptr.p->ctlFilePtr); ptr.p->files.getPtr(filePtr, ptr.p->ctlFilePtr);
const Uint32 sz = sizeof(BackupFormat::CtlFile::FragmentInfo) >> 2; const Uint32 sz = sizeof(BackupFormat::CtlFile::FragmentInfo) >> 2;
Uint32 * dst; Uint32 * dst;
if (!filePtr.p->operation.dataBuffer.getWritePtr(&dst, sz)) if (!filePtr.p->operation.dataBuffer.getWritePtr(&dst, sz))
{ {
sendSignalWithDelay(BACKUP_REF, GSN_CONTINUEB, signal, 100, 4); sendSignalWithDelay(BACKUP_REF, GSN_CONTINUEB, signal, 100, 4);
return; return;
} }
BackupFormat::CtlFile::FragmentInfo * fragInfo = BackupFormat::CtlFile::FragmentInfo * fragInfo =
(BackupFormat::CtlFile::FragmentInfo*)dst; (BackupFormat::CtlFile::FragmentInfo*)dst;
fragInfo->SectionType = htonl(BackupFormat::FRAGMENT_INFO); fragInfo->SectionType = htonl(BackupFormat::FRAGMENT_INFO);
fragInfo->SectionLength = htonl(sz); fragInfo->SectionLength = htonl(sz);
fragInfo->TableId = htonl(fragPtr.p->tableId); fragInfo->TableId = htonl(fragPtr.p->tableId);
...@@ -264,26 +260,28 @@ Backup::execCONTINUEB(Signal* signal) ...@@ -264,26 +260,28 @@ Backup::execCONTINUEB(Signal* signal)
fragInfo->NoOfRecordsHigh = htonl(fragPtr.p->noOfRecords >> 32); fragInfo->NoOfRecordsHigh = htonl(fragPtr.p->noOfRecords >> 32);
fragInfo->FilePosLow = htonl(0); fragInfo->FilePosLow = htonl(0);
fragInfo->FilePosHigh = htonl(0); fragInfo->FilePosHigh = htonl(0);
filePtr.p->operation.dataBuffer.updateWritePtr(sz); filePtr.p->operation.dataBuffer.updateWritePtr(sz);
fragPtr_I++; 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;
...@@ -2048,19 +2046,20 @@ Backup::sendDropTrig(Signal* signal, BackupRecordPtr ptr) ...@@ -2048,19 +2046,20 @@ Backup::sendDropTrig(Signal* signal, BackupRecordPtr ptr)
{ {
TablePtr tabPtr; TablePtr tabPtr;
ptr.p->tables.first(tabPtr); if (ptr.p->tables.first(tabPtr))
{
if(tabPtr.i == RNIL) jam();
{ signal->theData[0] = BackupContinueB::BACKUP_FRAGMENT_INFO;
closeFiles(signal, ptr); signal->theData[1] = ptr.i;
return; signal->theData[2] = tabPtr.i;
} signal->theData[3] = 0;
sendSignal(BACKUP_REF, GSN_CONTINUEB, signal, 4, JBB);
signal->theData[0] = BackupContinueB::BACKUP_FRAGMENT_INFO; }
signal->theData[1] = ptr.i; else
signal->theData[2] = tabPtr.i; {
signal->theData[3] = 0; jam();
sendSignal(BACKUP_REF, GSN_CONTINUEB, signal, 4, JBB); closeFiles(signal, ptr);
}
} }
} }
} }
...@@ -2379,19 +2378,10 @@ Backup::defineBackupRef(Signal* signal, BackupRecordPtr ptr, Uint32 errCode) ...@@ -2379,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;
} }
} }
...@@ -4097,29 +4087,10 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr) ...@@ -4097,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);
} }
...@@ -4384,7 +4355,7 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr) ...@@ -4384,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);
} }
} }
...@@ -4394,6 +4365,33 @@ Backup::closeFiles(Signal* sig, BackupRecordPtr ptr) ...@@ -4394,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);
......
...@@ -14706,6 +14706,8 @@ void Dblqh::execSr(Signal* signal) ...@@ -14706,6 +14706,8 @@ void Dblqh::execSr(Signal* signal)
LogFileRecordPtr nextLogFilePtr; LogFileRecordPtr nextLogFilePtr;
LogPageRecordPtr tmpLogPagePtr; LogPageRecordPtr tmpLogPagePtr;
Uint32 logWord; Uint32 logWord;
Uint32 line;
const char * crash_msg = 0;
jamEntry(); jamEntry();
logPartPtr.i = signal->theData[0]; logPartPtr.i = signal->theData[0];
...@@ -14916,8 +14918,14 @@ void Dblqh::execSr(Signal* signal) ...@@ -14916,8 +14918,14 @@ void Dblqh::execSr(Signal* signal)
/* PLACE THAN IN THE FIRST PAGE OF A NEW FILE IN THE FIRST POSITION AFTER THE*/ /* PLACE THAN IN THE FIRST PAGE OF A NEW FILE IN THE FIRST POSITION AFTER THE*/
/* HEADER. */ /* HEADER. */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
ndbrequire(logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] == if (unlikely(logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] !=
(ZPAGE_HEADER_SIZE + ZPOS_NO_FD)); (ZPAGE_HEADER_SIZE + ZPOS_NO_FD)))
{
line = __LINE__;
logWord = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
crash_msg = "ZFD_TYPE at incorrect position!";
goto crash;
}
{ {
Uint32 noFdDescriptors = Uint32 noFdDescriptors =
logPagePtr.p->logPageWord[ZPAGE_HEADER_SIZE + ZPOS_NO_FD]; logPagePtr.p->logPageWord[ZPAGE_HEADER_SIZE + ZPOS_NO_FD];
...@@ -14954,19 +14962,10 @@ void Dblqh::execSr(Signal* signal) ...@@ -14954,19 +14962,10 @@ void Dblqh::execSr(Signal* signal)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* SEND A SIGNAL TO THE SIGNAL LOG AND THEN CRASH THE SYSTEM. */ /* SEND A SIGNAL TO THE SIGNAL LOG AND THEN CRASH THE SYSTEM. */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
signal->theData[0] = RNIL; line = __LINE__;
signal->theData[1] = logPartPtr.i; logWord = ZNEXT_MBYTE_TYPE;
Uint32 tmp = logFilePtr.p->fileName[3]; crash_msg = "end of log wo/ having found last GCI";
tmp = (tmp >> 8) & 0xff;// To get the Directory, DXX. goto crash;
signal->theData[2] = tmp;
signal->theData[3] = logFilePtr.p->fileNo;
signal->theData[4] = logFilePtr.p->currentFilepage;
signal->theData[5] = logFilePtr.p->currentMbyte;
signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
signal->theData[7] = ~0;
signal->theData[8] = __LINE__;
sendSignal(cownref, GSN_DEBUG_SIG, signal, 9, JBA);
return;
}//if }//if
}//if }//if
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -15021,19 +15020,9 @@ void Dblqh::execSr(Signal* signal) ...@@ -15021,19 +15020,9 @@ void Dblqh::execSr(Signal* signal)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* SEND A SIGNAL TO THE SIGNAL LOG AND THEN CRASH THE SYSTEM. */ /* SEND A SIGNAL TO THE SIGNAL LOG AND THEN CRASH THE SYSTEM. */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
signal->theData[0] = RNIL; line = __LINE__;
signal->theData[1] = logPartPtr.i; crash_msg = "Invalid logword";
Uint32 tmp = logFilePtr.p->fileName[3]; goto crash;
tmp = (tmp >> 8) & 0xff;// To get the Directory, DXX.
signal->theData[2] = tmp;
signal->theData[3] = logFilePtr.p->fileNo;
signal->theData[4] = logFilePtr.p->currentMbyte;
signal->theData[5] = logFilePtr.p->currentFilepage;
signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
signal->theData[7] = logWord;
signal->theData[8] = __LINE__;
sendSignal(cownref, GSN_DEBUG_SIG, signal, 9, JBA);
return;
break; break;
}//switch }//switch
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -15041,6 +15030,35 @@ void Dblqh::execSr(Signal* signal) ...@@ -15041,6 +15030,35 @@ void Dblqh::execSr(Signal* signal)
// that we reach a new page. // that we reach a new page.
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
} while (1); } while (1);
return;
crash:
signal->theData[0] = RNIL;
signal->theData[1] = logPartPtr.i;
Uint32 tmp = logFilePtr.p->fileName[3];
tmp = (tmp >> 8) & 0xff;// To get the Directory, DXX.
signal->theData[2] = tmp;
signal->theData[3] = logFilePtr.p->fileNo;
signal->theData[4] = logFilePtr.p->currentMbyte;
signal->theData[5] = logFilePtr.p->currentFilepage;
signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
signal->theData[7] = logWord;
signal->theData[8] = line;
char buf[255];
BaseString::snprintf(buf, sizeof(buf),
"Error while reading REDO log. from %d\n"
"D=%d, F=%d Mb=%d FP=%d W1=%d W2=%d : %s",
signal->theData[8],
signal->theData[2],
signal->theData[3],
signal->theData[4],
signal->theData[5],
signal->theData[6],
signal->theData[7],
crash_msg ? crash_msg : "");
progError(__LINE__, NDBD_EXIT_SR_REDOLOG, buf);
}//Dblqh::execSr() }//Dblqh::execSr()
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -15056,8 +15074,8 @@ void Dblqh::execDEBUG_SIG(Signal* signal) ...@@ -15056,8 +15074,8 @@ void Dblqh::execDEBUG_SIG(Signal* signal)
UintR tdebug; UintR tdebug;
jamEntry(); jamEntry();
logPagePtr.i = signal->theData[0]; //logPagePtr.i = signal->theData[0];
tdebug = logPagePtr.p->logPageWord[0]; //tdebug = logPagePtr.p->logPageWord[0];
char buf[100]; char buf[100];
BaseString::snprintf(buf, 100, BaseString::snprintf(buf, 100,
......
...@@ -124,6 +124,7 @@ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -124,6 +124,7 @@ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){
result = NDBT_FAILED; \ result = NDBT_FAILED; \
continue; } continue; }
static
int int
restart_cluster(NDBT_Context* ctx, NDBT_Step* step, NdbRestarter& restarter) restart_cluster(NDBT_Context* ctx, NDBT_Step* step, NdbRestarter& restarter)
{ {
...@@ -177,6 +178,7 @@ restart_cluster(NDBT_Context* ctx, NDBT_Step* step, NdbRestarter& restarter) ...@@ -177,6 +178,7 @@ restart_cluster(NDBT_Context* ctx, NDBT_Step* step, NdbRestarter& restarter)
return result; return result;
} }
static
ndb_mgm_node_state* ndb_mgm_node_state*
select_node_to_stop(Vector<ndb_mgm_node_state>& nodes) select_node_to_stop(Vector<ndb_mgm_node_state>& nodes)
{ {
...@@ -215,6 +217,7 @@ select_node_to_stop(Vector<ndb_mgm_node_state>& nodes) ...@@ -215,6 +217,7 @@ select_node_to_stop(Vector<ndb_mgm_node_state>& nodes)
} }
} }
static
ndb_mgm_node_state* ndb_mgm_node_state*
select_node_to_start(Vector<ndb_mgm_node_state>& nodes) select_node_to_start(Vector<ndb_mgm_node_state>& nodes)
{ {
...@@ -294,23 +297,27 @@ runMixRestart(NDBT_Context* ctx, NDBT_Step* step) ...@@ -294,23 +297,27 @@ runMixRestart(NDBT_Context* ctx, NDBT_Step* step)
goto loop; goto loop;
if (action == AA_RestartNode) if (action == AA_RestartNode)
{
g_err << "Restarting " << node->node_id << endl; g_err << "Restarting " << node->node_id << endl;
if (restarter.restartOneDbNode(node->node_id, false, false, true)) else
return NDBT_FAILED;
}
if (action == AA_StopNode)
{
g_err << "Stopping " << node->node_id << endl; g_err << "Stopping " << node->node_id << endl;
if (restarter.restartOneDbNode(node->node_id, false, true, true))
return NDBT_FAILED; if (restarter.restartOneDbNode(node->node_id, false, true, true))
node->node_status = NDB_MGM_NODE_STATUS_NOT_STARTED; return NDBT_FAILED;
}
break; if (restarter.waitNodesNoStart(&node->node_id, 1))
return NDBT_FAILED;
node->node_status = NDB_MGM_NODE_STATUS_NOT_STARTED;
if (action == AA_StopNode)
break;
else
goto start;
} }
case AA_StartNode: case AA_StartNode:
if ((node = select_node_to_start(nodes)) == 0) if ((node = select_node_to_start(nodes)) == 0)
goto loop; goto loop;
start:
g_err << "Starting " << node->node_id << endl; g_err << "Starting " << node->node_id << endl;
if (restarter.startNodes(&node->node_id, 1)) if (restarter.startNodes(&node->node_id, 1))
return NDBT_FAILED; return NDBT_FAILED;
...@@ -321,7 +328,26 @@ runMixRestart(NDBT_Context* ctx, NDBT_Step* step) ...@@ -321,7 +328,26 @@ runMixRestart(NDBT_Context* ctx, NDBT_Step* step)
break; break;
} }
} }
Vector<int> not_started;
{
ndb_mgm_node_state* node = 0;
while((node = select_node_to_start(nodes)))
{
not_started.push_back(node->node_id);
node->node_status = NDB_MGM_NODE_STATUS_STARTED;
}
}
if (not_started.size())
{
g_err << "Starting stopped nodes " << endl;
if (restarter.startNodes(not_started.getBase(), not_started.size()))
return NDBT_FAILED;
if (restarter.waitClusterStarted())
return NDBT_FAILED;
}
ctx->stopTest(); ctx->stopTest();
return NDBT_OK; return NDBT_OK;
} }
......
...@@ -985,7 +985,7 @@ NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp, ...@@ -985,7 +985,7 @@ NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp,
loop: loop:
r = pNdb->getDictionary()->createTable(tmpTab); r = pNdb->getDictionary()->createTable(tmpTab);
if(r == -1){ if(r == -1){
if(pNdb->getDictionary()->getNdbError().code == 723) if(pNdb->getDictionary()->getNdbError().code == 755)
{ {
if (create_default_tablespace(pNdb) == 0) if (create_default_tablespace(pNdb) == 0)
{ {
......
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