Commit 46c2981e authored by tomas@poseidon.mysql.com's avatar tomas@poseidon.mysql.com

Merge poseidon.mysql.com:/home/tomas/mysql-5.0-telco-gca-single-user

into  poseidon.mysql.com:/home/tomas/mysql-5.0-ndb
parents 433d3e6c 47f37fb3
...@@ -1838,9 +1838,14 @@ private: ...@@ -1838,9 +1838,14 @@ private:
Uint32 transid2); Uint32 transid2);
void removeMarkerForFailedAPI(Signal* signal, Uint32 nodeId, Uint32 bucket); void removeMarkerForFailedAPI(Signal* signal, Uint32 nodeId, Uint32 bucket);
bool getAllowStartTransaction() const { bool getAllowStartTransaction(Uint32 nodeId) const {
if(getNodeState().getSingleUserMode()) if (unlikely(getNodeState().getSingleUserMode()))
return true; {
if (getNodeState().getSingleUserApi() == nodeId)
return true;
else
return false;
}
return getNodeState().startLevel < NodeState::SL_STOPPING_2; return getNodeState().startLevel < NodeState::SL_STOPPING_2;
} }
......
...@@ -1199,16 +1199,14 @@ void Dbtc::execTCSEIZEREQ(Signal* signal) ...@@ -1199,16 +1199,14 @@ void Dbtc::execTCSEIZEREQ(Signal* signal)
const NodeId senderNodeId = refToNode(tapiBlockref); const NodeId senderNodeId = refToNode(tapiBlockref);
const bool local = senderNodeId == getOwnNodeId() || senderNodeId == 0; const bool local = senderNodeId == getOwnNodeId() || senderNodeId == 0;
if(!(senderNodeId == getNodeState().getSingleUserApi()) && {
!getNodeState().getSingleUserMode()) { {
if(!(sl==NodeState::SL_SINGLEUSER &&
senderNodeId == getNodeState().getSingleUserApi())) {
if (!(sl == NodeState::SL_STARTED || if (!(sl == NodeState::SL_STARTED ||
(sl == NodeState::SL_STARTING && local == true))) { (sl == NodeState::SL_STARTING && local == true))) {
jam(); jam();
Uint32 errCode; Uint32 errCode = 0;
if(!(sl == NodeState::SL_SINGLEUSER && local)) if(!local)
{ {
switch(sl){ switch(sl){
case NodeState::SL_STARTING: case NodeState::SL_STARTING:
...@@ -1216,6 +1214,9 @@ void Dbtc::execTCSEIZEREQ(Signal* signal) ...@@ -1216,6 +1214,9 @@ void Dbtc::execTCSEIZEREQ(Signal* signal)
break; break;
case NodeState::SL_STOPPING_1: case NodeState::SL_STOPPING_1:
case NodeState::SL_STOPPING_2: case NodeState::SL_STOPPING_2:
if (getNodeState().getSingleUserMode() &&
getNodeState().getSingleUserApi() == senderNodeId)
break;
case NodeState::SL_STOPPING_3: case NodeState::SL_STOPPING_3:
case NodeState::SL_STOPPING_4: case NodeState::SL_STOPPING_4:
if(getNodeState().stopping.systemShutdown) if(getNodeState().stopping.systemShutdown)
...@@ -1224,16 +1225,21 @@ void Dbtc::execTCSEIZEREQ(Signal* signal) ...@@ -1224,16 +1225,21 @@ void Dbtc::execTCSEIZEREQ(Signal* signal)
errCode = ZNODE_SHUTDOWN_IN_PROGRESS; errCode = ZNODE_SHUTDOWN_IN_PROGRESS;
break; break;
case NodeState::SL_SINGLEUSER: case NodeState::SL_SINGLEUSER:
if (getNodeState().getSingleUserApi() == senderNodeId)
break;
errCode = ZCLUSTER_IN_SINGLEUSER_MODE; errCode = ZCLUSTER_IN_SINGLEUSER_MODE;
break; break;
default: default:
errCode = ZWRONG_STATE; errCode = ZWRONG_STATE;
break; break;
} }
signal->theData[0] = tapiPointer; if (errCode)
signal->theData[1] = errCode; {
sendSignal(tapiBlockref, GSN_TCSEIZEREF, signal, 2, JBB); signal->theData[0] = tapiPointer;
return; signal->theData[1] = errCode;
sendSignal(tapiBlockref, GSN_TCSEIZEREF, signal, 2, JBB);
return;
}
}//if (!(sl == SL_SINGLEUSER)) }//if (!(sl == SL_SINGLEUSER))
} //if } //if
} }
...@@ -1720,8 +1726,14 @@ Dbtc::TCKEY_abort(Signal* signal, int place) ...@@ -1720,8 +1726,14 @@ Dbtc::TCKEY_abort(Signal* signal, int place)
* Initialize object before starting error handling * Initialize object before starting error handling
*/ */
initApiConnectRec(signal, apiConnectptr.p, true); initApiConnectRec(signal, apiConnectptr.p, true);
start_failure:
switch(getNodeState().startLevel){ switch(getNodeState().startLevel){
case NodeState::SL_STOPPING_2: case NodeState::SL_STOPPING_2:
if (getNodeState().getSingleUserMode())
{
terrorCode = ZCLUSTER_IN_SINGLEUSER_MODE;
break;
}
case NodeState::SL_STOPPING_3: case NodeState::SL_STOPPING_3:
case NodeState::SL_STOPPING_4: case NodeState::SL_STOPPING_4:
if(getNodeState().stopping.systemShutdown) if(getNodeState().stopping.systemShutdown)
...@@ -1732,6 +1744,12 @@ Dbtc::TCKEY_abort(Signal* signal, int place) ...@@ -1732,6 +1744,12 @@ Dbtc::TCKEY_abort(Signal* signal, int place)
case NodeState::SL_SINGLEUSER: case NodeState::SL_SINGLEUSER:
terrorCode = ZCLUSTER_IN_SINGLEUSER_MODE; terrorCode = ZCLUSTER_IN_SINGLEUSER_MODE;
break; break;
case NodeState::SL_STOPPING_1:
if (getNodeState().getSingleUserMode())
{
terrorCode = ZCLUSTER_IN_SINGLEUSER_MODE;
break;
}
default: default:
terrorCode = ZWRONG_STATE; terrorCode = ZWRONG_STATE;
break; break;
...@@ -1753,6 +1771,13 @@ Dbtc::TCKEY_abort(Signal* signal, int place) ...@@ -1753,6 +1771,13 @@ Dbtc::TCKEY_abort(Signal* signal, int place)
return; return;
} }
case 60:
{
jam();
initApiConnectRec(signal, apiConnectptr.p, true);
apiConnectptr.p->m_exec_flag = 1;
goto start_failure;
}
default: default:
jam(); jam();
systemErrorLab(signal, __LINE__); systemErrorLab(signal, __LINE__);
...@@ -2481,6 +2506,7 @@ Dbtc::seizeCacheRecord(Signal* signal) ...@@ -2481,6 +2506,7 @@ Dbtc::seizeCacheRecord(Signal* signal)
/*****************************************************************************/ /*****************************************************************************/
void Dbtc::execTCKEYREQ(Signal* signal) void Dbtc::execTCKEYREQ(Signal* signal)
{ {
Uint32 sendersNodeId = refToNode(signal->getSendersBlockRef());
UintR compare_transid1, compare_transid2; UintR compare_transid1, compare_transid2;
UintR titcLenAiInTckeyreq; UintR titcLenAiInTckeyreq;
UintR TkeyLength; UintR TkeyLength;
...@@ -2526,7 +2552,7 @@ void Dbtc::execTCKEYREQ(Signal* signal) ...@@ -2526,7 +2552,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
regApiPtr->m_exec_flag |= TexecFlag; regApiPtr->m_exec_flag |= TexecFlag;
switch (regApiPtr->apiConnectstate) { switch (regApiPtr->apiConnectstate) {
case CS_CONNECTED:{ case CS_CONNECTED:{
if (TstartFlag == 1 && getAllowStartTransaction() == true){ if (TstartFlag == 1 && getAllowStartTransaction(sendersNodeId) == true){
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Initialise API connect record if transaction is started. // Initialise API connect record if transaction is started.
//--------------------------------------------------------------------- //---------------------------------------------------------------------
...@@ -2534,7 +2560,7 @@ void Dbtc::execTCKEYREQ(Signal* signal) ...@@ -2534,7 +2560,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
initApiConnectRec(signal, regApiPtr); initApiConnectRec(signal, regApiPtr);
regApiPtr->m_exec_flag = TexecFlag; regApiPtr->m_exec_flag = TexecFlag;
} else { } else {
if(getAllowStartTransaction() == true){ if(getAllowStartTransaction(sendersNodeId) == true){
/*------------------------------------------------------------------ /*------------------------------------------------------------------
* WE EXPECTED A START TRANSACTION. SINCE NO OPERATIONS HAVE BEEN * WE EXPECTED A START TRANSACTION. SINCE NO OPERATIONS HAVE BEEN
* RECEIVED WE INDICATE THIS BY SETTING FIRST_TC_CONNECT TO RNIL TO * RECEIVED WE INDICATE THIS BY SETTING FIRST_TC_CONNECT TO RNIL TO
...@@ -2544,9 +2570,9 @@ void Dbtc::execTCKEYREQ(Signal* signal) ...@@ -2544,9 +2570,9 @@ void Dbtc::execTCKEYREQ(Signal* signal)
return; return;
} else { } else {
/** /**
* getAllowStartTransaction() == false * getAllowStartTransaction(sendersNodeId) == false
*/ */
TCKEY_abort(signal, 57); TCKEY_abort(signal, TexecFlag ? 60 : 57);
return; return;
}//if }//if
} }
...@@ -6161,9 +6187,11 @@ and otherwise we spread it out 310 ms. ...@@ -6161,9 +6187,11 @@ and otherwise we spread it out 310 ms.
void Dbtc::timeOutLoopStartLab(Signal* signal, Uint32 api_con_ptr) void Dbtc::timeOutLoopStartLab(Signal* signal, Uint32 api_con_ptr)
{ {
Uint32 end_ptr, time_passed, time_out_value, mask_value; Uint32 end_ptr, time_passed, time_out_value, mask_value;
Uint32 old_mask_value= 0;
const Uint32 api_con_sz= capiConnectFilesize; const Uint32 api_con_sz= capiConnectFilesize;
const Uint32 tc_timer= ctcTimer; const Uint32 tc_timer= ctcTimer;
const Uint32 time_out_param= ctimeOutValue; const Uint32 time_out_param= ctimeOutValue;
const Uint32 old_time_out_param= c_abortRec.oldTimeOutValue;
ctimeOutCheckHeartbeat = tc_timer; ctimeOutCheckHeartbeat = tc_timer;
...@@ -6184,11 +6212,39 @@ void Dbtc::timeOutLoopStartLab(Signal* signal, Uint32 api_con_ptr) ...@@ -6184,11 +6212,39 @@ void Dbtc::timeOutLoopStartLab(Signal* signal, Uint32 api_con_ptr)
jam(); jam();
mask_value= 31; mask_value= 31;
} }
if (time_out_param != old_time_out_param &&
getNodeState().getSingleUserMode())
{
// abort during single user mode, use old_mask_value as flag
// and calculate value to be used for connections with allowed api
if (old_time_out_param > 300) {
jam();
old_mask_value= 63;
} else if (old_time_out_param < 30) {
jam();
old_mask_value= 7;
} else {
jam();
old_mask_value= 31;
}
}
for ( ; api_con_ptr < end_ptr; api_con_ptr++) { for ( ; api_con_ptr < end_ptr; api_con_ptr++) {
Uint32 api_timer= getApiConTimer(api_con_ptr); Uint32 api_timer= getApiConTimer(api_con_ptr);
jam(); jam();
if (api_timer != 0) { if (api_timer != 0) {
time_out_value= time_out_param + (api_con_ptr & mask_value); time_out_value= time_out_param + (api_con_ptr & mask_value);
if (unlikely(old_mask_value)) // abort during single user mode
{
apiConnectptr.i = api_con_ptr;
ptrCheckGuard(apiConnectptr, capiConnectFilesize, apiConnectRecord);
if (getNodeState().getSingleUserApi() ==
refToNode(apiConnectptr.p->ndbapiBlockref))
{
// api allowed during single user, use original timeout
time_out_value=
old_time_out_param + (api_con_ptr & old_mask_value);
}
}
time_passed= tc_timer - api_timer; time_passed= tc_timer - api_timer;
if (time_passed > time_out_value) if (time_passed > time_out_value)
{ {
...@@ -6805,6 +6861,33 @@ void Dbtc::timeOutFoundFragLab(Signal* signal, UintR TscanConPtr) ...@@ -6805,6 +6861,33 @@ void Dbtc::timeOutFoundFragLab(Signal* signal, UintR TscanConPtr)
c_scan_frag_pool.getPtr(ptr, TscanConPtr); c_scan_frag_pool.getPtr(ptr, TscanConPtr);
DEBUG(TscanConPtr << " timeOutFoundFragLab: scanFragState = "<< ptr.p->scanFragState); DEBUG(TscanConPtr << " timeOutFoundFragLab: scanFragState = "<< ptr.p->scanFragState);
const Uint32 time_out_param= ctimeOutValue;
const Uint32 old_time_out_param= c_abortRec.oldTimeOutValue;
if (unlikely(time_out_param != old_time_out_param &&
getNodeState().getSingleUserMode()))
{
jam();
ScanRecordPtr scanptr;
scanptr.i = ptr.p->scanRec;
ptrCheckGuard(scanptr, cscanrecFileSize, scanRecord);
ApiConnectRecordPtr TlocalApiConnectptr;
TlocalApiConnectptr.i = scanptr.p->scanApiRec;
ptrCheckGuard(TlocalApiConnectptr, capiConnectFilesize, apiConnectRecord);
if (refToNode(TlocalApiConnectptr.p->ndbapiBlockref) ==
getNodeState().getSingleUserApi())
{
jam();
Uint32 val = ctcTimer - ptr.p->scanFragTimer;
if (val <= old_time_out_param)
{
jam();
goto next;
}
}
}
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
// The scan fragment has expired its timeout. Check its state to decide // The scan fragment has expired its timeout. Check its state to decide
// what to do. // what to do.
...@@ -6866,6 +6949,7 @@ void Dbtc::timeOutFoundFragLab(Signal* signal, UintR TscanConPtr) ...@@ -6866,6 +6949,7 @@ void Dbtc::timeOutFoundFragLab(Signal* signal, UintR TscanConPtr)
break; break;
}//switch }//switch
next:
signal->theData[0] = TcContinueB::ZCONTINUE_TIME_OUT_FRAG_CONTROL; signal->theData[0] = TcContinueB::ZCONTINUE_TIME_OUT_FRAG_CONTROL;
signal->theData[1] = TscanConPtr + 1; signal->theData[1] = TscanConPtr + 1;
sendSignal(cownref, GSN_CONTINUEB, signal, 2, JBB); sendSignal(cownref, GSN_CONTINUEB, signal, 2, JBB);
...@@ -8695,6 +8779,14 @@ void Dbtc::execSCAN_TABREQ(Signal* signal) ...@@ -8695,6 +8779,14 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
} }
} }
if (getNodeState().startLevel == NodeState::SL_SINGLEUSER &&
getNodeState().getSingleUserApi() !=
refToNode(apiConnectptr.p->ndbapiBlockref))
{
errCode = ZCLUSTER_IN_SINGLEUSER_MODE;
goto SCAN_TAB_error;
}
seizeTcConnect(signal); seizeTcConnect(signal);
tcConnectptr.p->apiConnect = apiConnectptr.i; tcConnectptr.p->apiConnect = apiConnectptr.i;
tcConnectptr.p->tcConnectstate = OS_WAIT_SCAN; tcConnectptr.p->tcConnectstate = OS_WAIT_SCAN;
...@@ -11007,7 +11099,7 @@ void Dbtc::execABORT_ALL_REQ(Signal* signal) ...@@ -11007,7 +11099,7 @@ void Dbtc::execABORT_ALL_REQ(Signal* signal)
const Uint32 senderData = req->senderData; const Uint32 senderData = req->senderData;
const BlockReference senderRef = req->senderRef; const BlockReference senderRef = req->senderRef;
if(getAllowStartTransaction() == true && !getNodeState().getSingleUserMode()){ if(getAllowStartTransaction(refToNode(senderRef)) == true && !getNodeState().getSingleUserMode()){
jam(); jam();
ref->senderData = senderData; ref->senderData = senderData;
...@@ -11435,6 +11527,17 @@ void Dbtc::execTCINDXREQ(Signal* signal) ...@@ -11435,6 +11527,17 @@ void Dbtc::execTCINDXREQ(Signal* signal)
regApiPtr->transid[1] = tcIndxReq->transId2; regApiPtr->transid[1] = tcIndxReq->transId2;
}//if }//if
if (getNodeState().startLevel == NodeState::SL_SINGLEUSER &&
getNodeState().getSingleUserApi() !=
refToNode(regApiPtr->ndbapiBlockref))
{
terrorCode = ZCLUSTER_IN_SINGLEUSER_MODE;
regApiPtr->m_exec_flag |= TcKeyReq::getExecuteFlag(tcIndxRequestInfo);
apiConnectptr = transPtr;
abortErrorLab(signal);
return;
}
if (ERROR_INSERTED(8036) || !seizeIndexOperation(regApiPtr, indexOpPtr)) { if (ERROR_INSERTED(8036) || !seizeIndexOperation(regApiPtr, indexOpPtr)) {
jam(); jam();
// Failed to allocate index operation // Failed to allocate index operation
......
...@@ -405,7 +405,7 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){ ...@@ -405,7 +405,7 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
node.m_state = apiRegConf->nodeState; node.m_state = apiRegConf->nodeState;
if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED || if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED ||
node.m_state.startLevel == NodeState::SL_SINGLEUSER)){ node.m_state.getSingleUserMode())){
set_node_alive(node, true); set_node_alive(node, true);
} else { } else {
set_node_alive(node, false); set_node_alive(node, false);
......
...@@ -56,6 +56,8 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode) ...@@ -56,6 +56,8 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode)
// We have connections now to the desired node. Return // We have connections now to the desired node. Return
//**************************************************************************** //****************************************************************************
DBUG_RETURN(getConnectedNdbTransaction(tConNode)); DBUG_RETURN(getConnectedNdbTransaction(tConNode));
} else if (TretCode < 0) {
DBUG_RETURN(NULL);
} else if (TretCode != 0) { } else if (TretCode != 0) {
tAnyAlive = 1; tAnyAlive = 1;
}//if }//if
...@@ -79,6 +81,8 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode) ...@@ -79,6 +81,8 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode)
// We have connections now to the desired node. Return // We have connections now to the desired node. Return
//**************************************************************************** //****************************************************************************
DBUG_RETURN(getConnectedNdbTransaction(tNode)); DBUG_RETURN(getConnectedNdbTransaction(tNode));
} else if (TretCode < 0) {
DBUG_RETURN(NULL);
} else if (TretCode != 0) { } else if (TretCode != 0) {
tAnyAlive= 1; tAnyAlive= 1;
}//if }//if
...@@ -107,6 +111,8 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode) ...@@ -107,6 +111,8 @@ NdbTransaction* Ndb::doConnect(Uint32 tConNode)
// We have connections now to the desired node. Return // We have connections now to the desired node. Return
//**************************************************************************** //****************************************************************************
DBUG_RETURN(getConnectedNdbTransaction(tNode)); DBUG_RETURN(getConnectedNdbTransaction(tNode));
} else if (TretCode < 0) {
DBUG_RETURN(NULL);
} else if (TretCode != 0) { } else if (TretCode != 0) {
tAnyAlive= 1; tAnyAlive= 1;
}//if }//if
...@@ -207,6 +213,11 @@ Ndb::NDB_connect(Uint32 tNode) ...@@ -207,6 +213,11 @@ Ndb::NDB_connect(Uint32 tNode)
DBUG_PRINT("info", DBUG_PRINT("info",
("unsuccessful connect tReturnCode %d, tNdbCon->Status() %d", ("unsuccessful connect tReturnCode %d, tNdbCon->Status() %d",
tReturnCode, tNdbCon->Status())); tReturnCode, tNdbCon->Status()));
if (theError.code == 299)
{
// single user mode so no need to retry with other node
DBUG_RETURN(-1);
}
DBUG_RETURN(3); DBUG_RETURN(3);
}//if }//if
}//Ndb::NDB_connect() }//Ndb::NDB_connect()
......
...@@ -55,7 +55,7 @@ NdbRecAttr::setup(const NdbColumnImpl* anAttrInfo, char* aValue) ...@@ -55,7 +55,7 @@ NdbRecAttr::setup(const NdbColumnImpl* anAttrInfo, char* aValue)
if (theStorageX) if (theStorageX)
delete[] theStorageX; delete[] theStorageX;
// check alignment to signal data // check alignment to signal data
// a future version could check alignment per data type as well // a future version could check alignment per data type as well
...@@ -181,7 +181,7 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) ...@@ -181,7 +181,7 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
out << "[NULL]"; out << "[NULL]";
return out; return out;
} }
const NdbDictionary::Column* c = r.getColumn(); const NdbDictionary::Column* c = r.getColumn();
uint length = c->getLength(); uint length = c->getLength();
if (length > 1) if (length > 1)
...@@ -192,196 +192,200 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) ...@@ -192,196 +192,200 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
if (j > 0) if (j > 0)
out << " "; out << " ";
switch(r.getType()) switch(r.getType()){
{ case NdbDictionary::Column::Bigunsigned:
case NdbDictionary::Column::Bigunsigned: out << r.u_64_value();
out << r.u_64_value(); break;
break; case NdbDictionary::Column::Bit:
case NdbDictionary::Column::Bit: out << hex << "H'" << r.u_32_value() << dec;
out << hex << "H'" << r.u_32_value() << dec; break;
break; case NdbDictionary::Column::Unsigned:
case NdbDictionary::Column::Unsigned: out << r.u_32_value();
out << r.u_32_value(); break;
break; case NdbDictionary::Column::Smallunsigned:
case NdbDictionary::Column::Smallunsigned: out << r.u_short_value();
out << r.u_short_value(); break;
break; case NdbDictionary::Column::Tinyunsigned:
case NdbDictionary::Column::Tinyunsigned: out << (unsigned) r.u_char_value();
out << (unsigned) r.u_char_value(); break;
break; case NdbDictionary::Column::Bigint:
case NdbDictionary::Column::Bigint: out << r.int64_value();
out << r.int64_value(); break;
break; case NdbDictionary::Column::Int:
case NdbDictionary::Column::Int: out << r.int32_value();
out << r.int32_value();
break;
case NdbDictionary::Column::Smallint:
out << r.short_value();
break;
case NdbDictionary::Column::Tinyint:
out << (int) r.char_value();
break;
case NdbDictionary::Column::Binary:
ndbrecattr_print_string(out,"Binary",r.aRef(),r.arraySize());
j = r.arraySize();
break;
case NdbDictionary::Column::Char:
ndbrecattr_print_string(out,"Char",r.aRef(),r.arraySize());
j = length;
break;
case NdbDictionary::Column::Varchar:
{
unsigned len = *(const unsigned char*)r.aRef();
ndbrecattr_print_string(out,"Varchar", r.aRef()+1,len);
j = length;
}
break;
case NdbDictionary::Column::Varbinary:
{
unsigned len = *(const unsigned char*)r.aRef();
ndbrecattr_print_string(out,"Varbinary", r.aRef()+1,len);
j = length;
}
break;
case NdbDictionary::Column::Float:
out << r.float_value();
break;
case NdbDictionary::Column::Double:
out << r.double_value();
break;
case NdbDictionary::Column::Olddecimal:
{
short len = 1 + c->getPrecision() + (c->getScale() > 0);
out.print("%.*s", len, r.aRef());
}
break;
case NdbDictionary::Column::Olddecimalunsigned:
{
short len = 0 + c->getPrecision() + (c->getScale() > 0);
out.print("%.*s", len, r.aRef());
}
break;
case NdbDictionary::Column::Decimal:
case NdbDictionary::Column::Decimalunsigned:
goto unknown; // TODO
break;
// for dates cut-and-paste from field.cc
case NdbDictionary::Column::Datetime:
{
ulonglong tmp=r.u_64_value();
long part1,part2,part3;
part1=(long) (tmp/LL(1000000));
part2=(long) (tmp - (ulonglong) part1*LL(1000000));
char buf[40];
char* pos=(char*) buf+19;
*pos--=0;
*pos--= (char) ('0'+(char) (part2%10)); part2/=10;
*pos--= (char) ('0'+(char) (part2%10)); part3= (int) (part2 / 10);
*pos--= ':';
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= ':';
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= (char) ('0'+(char) part3);
*pos--= '/';
*pos--= (char) ('0'+(char) (part1%10)); part1/=10;
*pos--= (char) ('0'+(char) (part1%10)); part1/=10;
*pos--= '-';
*pos--= (char) ('0'+(char) (part1%10)); part1/=10;
*pos--= (char) ('0'+(char) (part1%10)); part3= (int) (part1/10);
*pos--= '-';
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos=(char) ('0'+(char) part3);
out << buf;
}
break;
case NdbDictionary::Column::Date:
{
uint32 tmp=(uint32) uint3korr(r.aRef());
int part;
char buf[40];
char *pos=(char*) buf+10;
*pos--=0;
part=(int) (tmp & 31);
*pos--= (char) ('0'+part%10);
*pos--= (char) ('0'+part/10);
*pos--= '-';
part=(int) (tmp >> 5 & 15);
*pos--= (char) ('0'+part%10);
*pos--= (char) ('0'+part/10);
*pos--= '-';
part=(int) (tmp >> 9);
*pos--= (char) ('0'+part%10); part/=10;
*pos--= (char) ('0'+part%10); part/=10;
*pos--= (char) ('0'+part%10); part/=10;
*pos= (char) ('0'+part);
out << buf;
}
break;
case NdbDictionary::Column::Time:
{
long tmp=(long) sint3korr(r.aRef());
int hour=(uint) (tmp/10000);
int minute=(uint) (tmp/100 % 100);
int second=(uint) (tmp % 100);
char buf[40];
sprintf(buf, "%02d:%02d:%02d", hour, minute, second);
out << buf;
}
break;
case NdbDictionary::Column::Year:
{
uint year = 1900 + r.u_char_value();
char buf[40];
sprintf(buf, "%04d", year);
out << buf;
}
break;
case NdbDictionary::Column::Timestamp:
{
time_t time = r.u_32_value();
out << (uint)time;
}
break;
case NdbDictionary::Column::Blob:
case NdbDictionary::Column::Text:
{
// user defined aRef() may not be aligned to Uint64
NdbBlob::Head head;
memcpy(&head, r.aRef(), sizeof(head));
out << head.length << ":";
const unsigned char* p = (const unsigned char*)r.aRef() + sizeof(head);
if (r.arraySize() < sizeof(head))
out << "***error***"; // really cannot happen
else {
unsigned n = r.arraySize() - sizeof(head);
for (unsigned k = 0; k < n && k < head.length; k++) {
if (r.getType() == NdbDictionary::Column::Blob)
out.print("%02X", (int)p[k]);
else
out.print("%c", (int)p[k]);
}
}
j = length;
}
break; break;
case NdbDictionary::Column::Longvarchar: case NdbDictionary::Column::Smallint:
{ out << r.short_value();
unsigned len = uint2korr(r.aRef()); break;
ndbrecattr_print_string(out,"Longvarchar", r.aRef()+2,len); case NdbDictionary::Column::Tinyint:
j = length; out << (int) r.char_value();
break;
case NdbDictionary::Column::Binary:
j = r.arraySize();
ndbrecattr_print_string(out,"Binary", r.aRef(), j);
break;
case NdbDictionary::Column::Char:
j = length;
ndbrecattr_print_string(out,"Char", r.aRef(), r.arraySize());
break;
case NdbDictionary::Column::Varchar:
{
unsigned len = *(const unsigned char*)r.aRef();
ndbrecattr_print_string(out,"Varchar", r.aRef()+1,len);
j = length;
}
break;
case NdbDictionary::Column::Varbinary:
{
unsigned len = *(const unsigned char*)r.aRef();
ndbrecattr_print_string(out,"Varbinary", r.aRef()+1,len);
j = length;
}
break;
case NdbDictionary::Column::Float:
out << r.float_value();
break;
case NdbDictionary::Column::Double:
out << r.double_value();
break;
case NdbDictionary::Column::Olddecimal:
{
short len = 1 + c->getPrecision() + (c->getScale() > 0);
out.print("%.*s", len, r.aRef());
}
break;
case NdbDictionary::Column::Olddecimalunsigned:
{
short len = 0 + c->getPrecision() + (c->getScale() > 0);
out.print("%.*s", len, r.aRef());
}
break;
case NdbDictionary::Column::Decimal:
case NdbDictionary::Column::Decimalunsigned:
goto unknown; // TODO
break;
// for dates cut-and-paste from field.cc
case NdbDictionary::Column::Datetime:
{
ulonglong tmp=r.u_64_value();
long part1,part2,part3;
part1=(long) (tmp/LL(1000000));
part2=(long) (tmp - (ulonglong) part1*LL(1000000));
char buf[40];
char* pos=(char*) buf+19;
*pos--=0;
*pos--= (char) ('0'+(char) (part2%10)); part2/=10;
*pos--= (char) ('0'+(char) (part2%10)); part3= (int) (part2 / 10);
*pos--= ':';
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= ':';
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= (char) ('0'+(char) part3);
*pos--= '/';
*pos--= (char) ('0'+(char) (part1%10)); part1/=10;
*pos--= (char) ('0'+(char) (part1%10)); part1/=10;
*pos--= '-';
*pos--= (char) ('0'+(char) (part1%10)); part1/=10;
*pos--= (char) ('0'+(char) (part1%10)); part3= (int) (part1/10);
*pos--= '-';
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
*pos=(char) ('0'+(char) part3);
out << buf;
}
break;
case NdbDictionary::Column::Date:
{
uint32 tmp=(uint32) uint3korr(r.aRef());
int part;
char buf[40];
char *pos=(char*) buf+10;
*pos--=0;
part=(int) (tmp & 31);
*pos--= (char) ('0'+part%10);
*pos--= (char) ('0'+part/10);
*pos--= '-';
part=(int) (tmp >> 5 & 15);
*pos--= (char) ('0'+part%10);
*pos--= (char) ('0'+part/10);
*pos--= '-';
part=(int) (tmp >> 9);
*pos--= (char) ('0'+part%10); part/=10;
*pos--= (char) ('0'+part%10); part/=10;
*pos--= (char) ('0'+part%10); part/=10;
*pos= (char) ('0'+part);
out << buf;
}
break;
case NdbDictionary::Column::Time:
{
long tmp=(long) sint3korr(r.aRef());
int hour=(uint) (tmp/10000);
int minute=(uint) (tmp/100 % 100);
int second=(uint) (tmp % 100);
char buf[40];
sprintf(buf, "%02d:%02d:%02d", hour, minute, second);
out << buf;
}
break;
case NdbDictionary::Column::Year:
{
uint year = 1900 + r.u_char_value();
char buf[40];
sprintf(buf, "%04d", year);
out << buf;
}
break;
case NdbDictionary::Column::Timestamp:
{
time_t time = r.u_32_value();
out << (uint)time;
}
break;
case NdbDictionary::Column::Blob:
case NdbDictionary::Column::Text:
{
// user defined aRef() may not be aligned to Uint64
NdbBlob::Head head;
memcpy(&head, r.aRef(), sizeof(head));
out << head.length << ":";
const unsigned char* p = (const unsigned char*)r.aRef() + sizeof(head);
if (r.arraySize() < sizeof(head))
out << "***error***"; // really cannot happen
else {
unsigned n = r.arraySize() - sizeof(head);
for (unsigned k = 0; k < n && k < head.length; k++) {
if (r.getType() == NdbDictionary::Column::Blob)
out.print("%02X", (int)p[k]);
else
out.print("%c", (int)p[k]);
} }
break;
unknown:
default: /* no print functions for the rest, just print type */
out << (int) r.getType();
j = length;
if (j > 1)
out << " " << j << " times";
break;
} }
j = length;
}
break;
case NdbDictionary::Column::Longvarchar:
{
unsigned len = uint2korr(r.aRef());
ndbrecattr_print_string(out,"Longvarchar", r.aRef()+2,len);
j = length;
}
break;
case NdbDictionary::Column::Undefined:
case NdbDictionary::Column::Mediumint:
case NdbDictionary::Column::Mediumunsigned:
case NdbDictionary::Column::Longvarbinary:
unknown:
//default: /* no print functions for the rest, just print type */
out << (int) r.getType();
j = length;
if (j > 1)
out << " " << j << " times";
break;
}
} }
if (length > 1) if (length > 1)
......
...@@ -315,7 +315,8 @@ inline ...@@ -315,7 +315,8 @@ inline
bool bool
TransporterFacade::get_node_stopping(NodeId n) const { TransporterFacade::get_node_stopping(NodeId n) const {
const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n); const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n);
return ((node.m_state.startLevel == NodeState::SL_STOPPING_1) || return (!node.m_state.getSingleUserMode() &&
(node.m_state.startLevel == NodeState::SL_STOPPING_1) ||
(node.m_state.startLevel == NodeState::SL_STOPPING_2)); (node.m_state.startLevel == NodeState::SL_STOPPING_2));
} }
...@@ -326,16 +327,9 @@ TransporterFacade::getIsNodeSendable(NodeId n) const { ...@@ -326,16 +327,9 @@ TransporterFacade::getIsNodeSendable(NodeId n) const {
const Uint32 startLevel = node.m_state.startLevel; const Uint32 startLevel = node.m_state.startLevel;
if (node.m_info.m_type == NodeInfo::DB) { if (node.m_info.m_type == NodeInfo::DB) {
if(node.m_state.singleUserMode && return node.compatible && (startLevel == NodeState::SL_STARTED ||
ownId() == node.m_state.singleUserApi) { startLevel == NodeState::SL_STOPPING_1 ||
return (node.compatible && node.m_state.getSingleUserMode());
(node.m_state.startLevel == NodeState::SL_STOPPING_1 ||
node.m_state.startLevel == NodeState::SL_STARTED ||
node.m_state.startLevel == NodeState::SL_SINGLEUSER));
}
else
return node.compatible && (startLevel == NodeState::SL_STARTED ||
startLevel == NodeState::SL_STOPPING_1);
} else if (node.m_info.m_type == NodeInfo::REP) { } else if (node.m_info.m_type == NodeInfo::REP) {
/** /**
* @todo Check that REP node actually has received API_REG_REQ * @todo Check that REP node actually has received API_REG_REQ
......
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