Commit 9364181b authored by jonas@perch.ndb.mysql.com's avatar jonas@perch.ndb.mysql.com

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-new-ndb

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb
parents 77ee8eab 3edab3e4
......@@ -146,6 +146,7 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification;
#define NDBD_EXIT_AFS_READ_UNDERFLOW 2816
#define NDBD_EXIT_INVALID_LCP_FILE 2352
#define NDBD_EXIT_INSUFFICENT_NODES 2353
const char *
ndbd_exit_message(int faultId, ndbd_exit_classification *cl);
......
......@@ -1194,11 +1194,58 @@ void Dbdih::execTAB_COMMITREQ(Signal* signal)
void Dbdih::execDIH_RESTARTREQ(Signal* signal)
{
jamEntry();
cntrlblockref = signal->theData[0];
if(m_ctx.m_config.getInitialStart()){
sendSignal(cntrlblockref, GSN_DIH_RESTARTREF, signal, 1, JBB);
} else {
readGciFileLab(signal);
if (signal->theData[0])
{
jam();
cntrlblockref = signal->theData[0];
if(m_ctx.m_config.getInitialStart()){
sendSignal(cntrlblockref, GSN_DIH_RESTARTREF, signal, 1, JBB);
} else {
readGciFileLab(signal);
}
}
else
{
/**
* Precondition, (not checked)
* atleast 1 node in each node group
*/
Uint32 i;
NdbNodeBitmask mask;
mask.assign(NdbNodeBitmask::Size, signal->theData + 1);
Uint32 *node_gcis = signal->theData+1+NdbNodeBitmask::Size;
Uint32 node_group_gcis[MAX_NDB_NODES+1];
bzero(node_group_gcis, sizeof(node_group_gcis));
for (i = 0; i<MAX_NDB_NODES; i++)
{
if (mask.get(i))
{
jam();
Uint32 ng = Sysfile::getNodeGroup(i, SYSFILE->nodeGroups);
ndbrequire(ng < MAX_NDB_NODES);
Uint32 gci = node_gcis[i];
if (gci > node_group_gcis[ng])
{
jam();
node_group_gcis[ng] = gci;
}
}
}
for (i = 0; i<MAX_NDB_NODES && node_group_gcis[i] == 0; i++);
Uint32 gci = node_group_gcis[i];
for (i++ ; i<MAX_NDB_NODES; i++)
{
jam();
if (node_group_gcis[i] && node_group_gcis[i] != gci)
{
jam();
signal->theData[0] = i;
return;
}
}
signal->theData[0] = MAX_NDB_NODES;
return;
}
return;
}//Dbdih::execDIH_RESTARTREQ()
......@@ -12391,7 +12438,7 @@ void Dbdih::makeNodeGroups(Uint32 nodeArray[])
(buf, sizeof(buf),
"Illegal initial start, no alive node in nodegroup %u", i);
progError(__LINE__,
NDBD_EXIT_SR_RESTARTCONFLICT,
NDBD_EXIT_INSUFFICENT_NODES,
buf);
}
......
......@@ -129,6 +129,7 @@ public:
Uint32 m_president_candidate_gci;
Uint16 m_regReqReqSent;
Uint16 m_regReqReqRecv;
Uint32 m_node_gci[MAX_NDB_NODES];
} c_start;
NdbNodeBitmask c_definedNodes; // DB nodes in config
......
......@@ -1092,7 +1092,8 @@ void Qmgr::execCM_REGREF(Signal* signal)
jam();
c_start.m_starting_nodes_w_log.set(TaddNodeno);
}
c_start.m_node_gci[TaddNodeno] = node_gci;
skip_nodes.bitAND(c_definedNodes);
c_start.m_skip_nodes.bitOR(skip_nodes);
......@@ -1241,6 +1242,7 @@ Qmgr::check_startup(Signal* signal)
wait.bitANDC(tmp);
Uint32 retVal = 0;
Uint32 incompleteng = MAX_NDB_NODES; // Illegal value
NdbNodeBitmask report_mask;
if ((c_start.m_latest_gci == 0) ||
......@@ -1325,7 +1327,7 @@ Qmgr::check_startup(Signal* signal)
report_mask.assign(c_definedNodes);
report_mask.bitANDC(c_start.m_starting_nodes);
retVal = 1;
goto start_report;
goto check_log;
case CheckNodeGroups::Partitioning:
ndbrequire(result != CheckNodeGroups::Lose);
signal->theData[1] =
......@@ -1333,7 +1335,7 @@ Qmgr::check_startup(Signal* signal)
report_mask.assign(c_definedNodes);
report_mask.bitANDC(c_start.m_starting_nodes);
retVal = 1;
goto start_report;
goto check_log;
}
}
......@@ -1357,12 +1359,7 @@ Qmgr::check_startup(Signal* signal)
case CheckNodeGroups::Partitioning:
if (now < partitioned_timeout && result != CheckNodeGroups::Win)
{
signal->theData[1] = c_restartPartionedTimeout == (Uint32) ~0 ? 4 : 5;
signal->theData[2] = Uint32((partitioned_timeout - now + 500) / 1000);
report_mask.assign(c_definedNodes);
report_mask.bitANDC(c_start.m_starting_nodes);
retVal = 0;
goto start_report;
goto missinglog;
}
// Fall through...
case CheckNodeGroups::Win:
......@@ -1370,12 +1367,61 @@ Qmgr::check_startup(Signal* signal)
all ? 0x8001 : (result == CheckNodeGroups::Win ? 0x8002 : 0x8003);
report_mask.assign(c_definedNodes);
report_mask.bitANDC(c_start.m_starting_nodes);
retVal = 1;
goto start_report;
retVal = 2;
goto check_log;
}
}
ndbrequire(false);
check_log:
jam();
{
Uint32 save[4+4*NdbNodeBitmask::Size];
memcpy(save, signal->theData, sizeof(save));
signal->theData[0] = 0;
c_start.m_starting_nodes.copyto(NdbNodeBitmask::Size, signal->theData+1);
memcpy(signal->theData+1+NdbNodeBitmask::Size, c_start.m_node_gci,
4*MAX_NDB_NODES);
EXECUTE_DIRECT(DBDIH, GSN_DIH_RESTARTREQ, signal,
1+NdbNodeBitmask::Size+MAX_NDB_NODES);
incompleteng = signal->theData[0];
memcpy(signal->theData, save, sizeof(save));
if (incompleteng != MAX_NDB_NODES)
{
jam();
if (retVal == 1)
{
jam();
goto incomplete_log;
}
else if (retVal == 2)
{
if (now <= partitioned_timeout)
{
jam();
goto missinglog;
}
else
{
goto incomplete_log;
}
}
ndbrequire(false);
}
}
goto start_report;
missinglog:
signal->theData[1] = c_restartPartionedTimeout == (Uint32) ~0 ? 4 : 5;
signal->theData[2] = Uint32((partitioned_timeout - now + 500) / 1000);
report_mask.assign(c_definedNodes);
report_mask.bitANDC(c_start.m_starting_nodes);
retVal = 0;
goto start_report;
start_report:
jam();
{
......@@ -1394,17 +1440,32 @@ start_report:
missing_nodegroup:
jam();
char buf[100], mask1[100], mask2[100];
c_start.m_starting_nodes.getText(mask1);
tmp.assign(c_start.m_starting_nodes);
tmp.bitANDC(c_start.m_starting_nodes_w_log);
tmp.getText(mask2);
BaseString::snprintf(buf, sizeof(buf),
"Unable to start missing node group! "
" starting: %s (missing fs for: %s)",
mask1, mask2);
progError(__LINE__, NDBD_EXIT_SR_RESTARTCONFLICT, buf);
return 0; // Deadcode
{
char buf[100], mask1[100], mask2[100];
c_start.m_starting_nodes.getText(mask1);
tmp.assign(c_start.m_starting_nodes);
tmp.bitANDC(c_start.m_starting_nodes_w_log);
tmp.getText(mask2);
BaseString::snprintf(buf, sizeof(buf),
"Unable to start missing node group! "
" starting: %s (missing fs for: %s)",
mask1, mask2);
progError(__LINE__, NDBD_EXIT_INSUFFICENT_NODES, buf);
return 0; // Deadcode
}
incomplete_log:
jam();
{
char buf[100], mask1[100];
c_start.m_starting_nodes.getText(mask1);
BaseString::snprintf(buf, sizeof(buf),
"Incomplete log for node group: %d! "
" starting nodes: %s",
incompleteng, mask1);
progError(__LINE__, NDBD_EXIT_INSUFFICENT_NODES, buf);
return 0; // Deadcode
}
}
void
......
......@@ -160,6 +160,7 @@ static const ErrStruct errArray[] =
{NDBD_EXIT_AFS_READ_UNDERFLOW , XFI, "Read underflow"},
{NDBD_EXIT_INVALID_LCP_FILE, XFI, "Invalid LCP" },
{NDBD_EXIT_INSUFFICENT_NODES, XRE, "Insufficent nodes for system restart" },
/* Sentinel */
{0, XUE,
......
......@@ -94,7 +94,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
}
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError){
......@@ -245,7 +245,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
}
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError){
......@@ -421,7 +421,7 @@ restart:
}
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
ERR(err);
......@@ -474,7 +474,7 @@ restart:
} while((check = pOp->nextResult(false)) == 0);
if(check != -1){
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
if(check != -1)
m_latest_gci = pTrans->getGCI();
pTrans->restart();
......@@ -587,14 +587,14 @@ HugoTransactions::loadTable(Ndb* pNdb,
closeTrans = false;
if (!abort)
{
check = pTrans->execute( Commit );
check = pTrans->execute(Commit, AbortOnError);
if(check != -1)
m_latest_gci = pTrans->getGCI();
pTrans->restart();
}
else
{
check = pTrans->execute( NoCommit );
check = pTrans->execute(NoCommit, AbortOnError);
if (check != -1)
{
check = pTrans->execute( Rollback );
......@@ -603,7 +603,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
}
} else {
closeTrans = false;
check = pTrans->execute( NoCommit );
check = pTrans->execute(NoCommit, AbortOnError);
}
if(check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -717,7 +717,7 @@ HugoTransactions::fillTable(Ndb* pNdb,
}
// Execute the transaction and insert the record
check = pTrans->execute( Commit, CommitAsMuchAsPossible );
check = pTrans->execute(Commit, CommitAsMuchAsPossible);
if(check == -1 ) {
const NdbError err = pTrans->getNdbError();
closeTransaction(pNdb);
......@@ -829,7 +829,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
return NDBT_FAILED;
}
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -950,7 +950,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
return NDBT_FAILED;
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -991,7 +991,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
if(check != 2)
break;
if((check = pTrans->execute(NoCommit)) != 0)
if((check = pTrans->execute(NoCommit, AbortOnError)) != 0)
break;
}
if(check != 1 || rows_found != batch)
......@@ -1019,7 +1019,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
return NDBT_FAILED;
}
}
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
}
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -1119,7 +1119,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
}
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -1194,7 +1194,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -1274,7 +1274,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb,
return NDBT_FAILED;
}
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
if( check == -1) {
const NdbError err = pTrans->getNdbError();
......@@ -1387,7 +1387,7 @@ HugoTransactions::lockRecords(Ndb* pNdb,
int lockCount = lockTime / sleepInterval;
int commitCount = 0;
do {
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1) {
const NdbError err = pTrans->getNdbError();
......@@ -1413,7 +1413,7 @@ HugoTransactions::lockRecords(Ndb* pNdb,
} while (commitCount < lockCount);
// Really commit the trans, puuh!
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
if( check == -1) {
const NdbError err = pTrans->getNdbError();
......@@ -1543,7 +1543,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
}
}
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
check = (check == -1 ? -1 : !ordered ? check : sOp->nextResult(true));
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -1684,7 +1684,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
}
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
check = (check == -1 ? -1 : !ordered ? check : sOp->nextResult(true));
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -1756,7 +1756,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
}
}
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
ERR(err);
......
......@@ -121,7 +121,7 @@ UtilTransactions::clearTable3(Ndb* pNdb,
goto failed;
}
if(pTrans->execute(NoCommit) != 0){
if(pTrans->execute(NoCommit, AbortOnError) != 0){
err = pTrans->getNdbError();
if(err.status == NdbError::TemporaryError){
ERR(err);
......@@ -141,7 +141,7 @@ UtilTransactions::clearTable3(Ndb* pNdb,
} while((check = pOp->nextResult(false)) == 0);
if(check != -1){
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
pTrans->restart();
}
......@@ -245,7 +245,7 @@ UtilTransactions::copyTableData(Ndb* pNdb,
}
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
......@@ -262,7 +262,7 @@ UtilTransactions::copyTableData(Ndb* pNdb,
}
} while((eof = pOp->nextResult(false)) == 0);
check = pTrans->execute(Commit);
check = pTrans->execute(Commit, AbortOnError);
pTrans->restart();
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -414,7 +414,7 @@ UtilTransactions::scanReadRecords(Ndb* pNdb,
}
// *************************************************
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -520,7 +520,7 @@ UtilTransactions::selectCount(Ndb* pNdb,
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
......@@ -693,7 +693,7 @@ restart:
}
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -956,7 +956,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
printf("\n");
#endif
scanTrans->refresh();
check = pTrans1->execute(Commit);
check = pTrans1->execute(Commit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans1->getNdbError();
......@@ -1078,7 +1078,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
abort();
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
......@@ -1137,7 +1137,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
goto error;
}
check = pTrans->execute(NoCommit);
check = pTrans->execute(NoCommit, AbortOnError);
if(check)
goto error;
......@@ -1376,7 +1376,7 @@ loop:
}
}
if( pTrans->execute(NoCommit) == -1 ) {
if( pTrans->execute(NoCommit, AbortOnError) == -1 ) {
ERR(err= pTrans->getNdbError());
goto error;
}
......@@ -1398,7 +1398,8 @@ loop:
ERR(err= cmp.getTransaction()->getNdbError());
goto error;
}
if(cmp.execute_Commit(pNdb) != NDBT_OK)
if(cmp.execute_Commit(pNdb) != NDBT_OK ||
cmp.getTransaction()->getNdbError().code)
{
ERR(err= cmp.getTransaction()->getNdbError());
goto error;
......
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