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

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.0-ndb
This commit is contained in:
jonas@perch.ndb.mysql.com 2006-12-01 11:35:12 +01:00
commit 115643aab5
22 changed files with 279 additions and 48 deletions

View File

@ -136,7 +136,7 @@ NdbSqlUtil::m_typeList[] = {
},
{ // 22
Type::Bit,
NULL,
cmpBit,
NULL
},
{ // 23
@ -678,6 +678,17 @@ NdbSqlUtil::cmpText(const void* info, const void* p1, unsigned n1, const void* p
return 0;
}
int
NdbSqlUtil::cmpBit(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
Uint32 n = (n1 < n2) ? n1 : n2;
char* c1 = (char*)p1;
char* c2 = (char*)p2;
int ret = memcmp(p1, p2, n);
return ret;
}
int
NdbSqlUtil::cmpTime(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
@ -698,12 +709,6 @@ NdbSqlUtil::cmpTime(const void* info, const void* p1, unsigned n1, const void* p
}
// not yet
int
NdbSqlUtil::cmpBit(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
assert(false);
return 0;
}
int
NdbSqlUtil::cmpLongvarchar(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)

View File

@ -6,7 +6,7 @@ Next DBTUP 4014
Next DBLQH 5043
Next DBDICT 6007
Next DBDIH 7178
Next DBTC 8038
Next DBTC 8039
Next CMVMI 9000
Next BACKUP 10022
Next DBUTIL 11002
@ -287,6 +287,11 @@ ABORT OF TCKEYREQ
8037 : Invalid schema version in TCINDXREQ
------
8038 : Simulate API disconnect just after SCAN_TAB_REQ
CMVMI
-----
9000 Set RestartOnErrorInsert to restart -n

View File

@ -91,6 +91,7 @@ Cmvmi::Cmvmi(const Configuration & conf) :
addRecSignal(GSN_DUMP_STATE_ORD, &Cmvmi::execDUMP_STATE_ORD);
addRecSignal(GSN_TESTSIG, &Cmvmi::execTESTSIG);
addRecSignal(GSN_NODE_START_REP, &Cmvmi::execNODE_START_REP, true);
subscriberPool.setSize(5);
@ -340,6 +341,16 @@ void Cmvmi::execSTTOR(Signal* signal)
jamEntry();
if (theStartPhase == 1){
jam();
if(theConfig.lockPagesInMainMemory())
{
int res = NdbMem_MemLockAll();
if(res != 0){
g_eventLogger.warning("Failed to memlock pages");
warningEvent("Failed to memlock pages");
}
}
sendSTTORRY(signal);
return;
} else if (theStartPhase == 3) {
@ -359,18 +370,6 @@ void Cmvmi::execSTTOR(Signal* signal)
signal->theData[2] = NodeInfo::REP;
execOPEN_COMREQ(signal);
globalData.theStartLevel = NodeState::SL_STARTED;
sendSTTORRY(signal);
} else {
jam();
if(theConfig.lockPagesInMainMemory()){
int res = NdbMem_MemLockAll();
if(res != 0){
g_eventLogger.warning("Failed to memlock pages");
warningEvent("Failed to memlock pages");
}
}
sendSTTORRY(signal);
}
}
@ -425,7 +424,8 @@ void Cmvmi::execOPEN_COMREQ(Signal* signal)
if(len == 2){
#ifdef ERROR_INSERT
if (! (ERROR_INSERTED(9000) && c_error_9000_nodes_mask.get(tStartingNode)))
if (! ((ERROR_INSERTED(9000) || ERROR_INSERTED(9002))
&& c_error_9000_nodes_mask.get(tStartingNode)))
#endif
{
globalTransporterRegistry.do_connect(tStartingNode);
@ -446,7 +446,8 @@ void Cmvmi::execOPEN_COMREQ(Signal* signal)
jam();
#ifdef ERROR_INSERT
if (ERROR_INSERTED(9000) && c_error_9000_nodes_mask.get(i))
if ((ERROR_INSERTED(9000) || ERROR_INSERTED(9002))
&& c_error_9000_nodes_mask.get(i))
continue;
#endif
@ -1145,9 +1146,9 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal)
}
#ifdef ERROR_INSERT
if (arg == 9000)
if (arg == 9000 || arg == 9002)
{
SET_ERROR_INSERT_VALUE(9000);
SET_ERROR_INSERT_VALUE(arg);
for (Uint32 i = 1; i<signal->getLength(); i++)
c_error_9000_nodes_mask.set(signal->theData[i]);
}
@ -1194,6 +1195,17 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal)
#endif
}//Cmvmi::execDUMP_STATE_ORD()
void
Cmvmi::execNODE_START_REP(Signal* signal)
{
#ifdef ERROR_INSERT
if (ERROR_INSERTED(9002) && signal->theData[0] == getOwnNodeId())
{
signal->theData[0] = 9001;
execDUMP_STATE_ORD(signal);
}
#endif
}
BLOCK_FUNCTIONS(Cmvmi)

View File

@ -72,7 +72,8 @@ private:
void handleSET_VAR_REQ(Signal* signal);
void execTESTSIG(Signal* signal);
void execNODE_START_REP(Signal* signal);
char theErrorMessage[256];
void sendSTTORRY(Signal* signal);

View File

@ -1602,7 +1602,7 @@ private:
void startInfoReply(Signal *, Uint32 nodeId);
// DIH specifics for execNODE_START_REP (sendDictUnlockOrd)
void exec_node_start_rep(Signal* signal);
void execNODE_START_REP(Signal* signal);
/*
* Lock master DICT. Only current use is by starting node

View File

@ -269,7 +269,8 @@ Dbdih::Dbdih(const class Configuration & config):
addRecSignal(GSN_DICT_LOCK_CONF, &Dbdih::execDICT_LOCK_CONF);
addRecSignal(GSN_DICT_LOCK_REF, &Dbdih::execDICT_LOCK_REF);
addRecSignal(GSN_NODE_START_REP, &Dbdih::execNODE_START_REP, true);
apiConnectRecord = 0;
connectRecord = 0;
fileRecord = 0;

View File

@ -1390,7 +1390,7 @@ void Dbdih::execNDB_STTOR(Signal* signal)
}//Dbdih::execNDB_STTOR()
void
Dbdih::exec_node_start_rep(Signal* signal)
Dbdih::execNODE_START_REP(Signal* signal)
{
/*
* Send DICT_UNLOCK_ORD when this node is SL_STARTED.

View File

@ -236,6 +236,7 @@
#define ZOPERATION_EVENT_REP 19
#define ZPREP_DROP_TABLE 20
#define ZENABLE_EXPAND_CHECK 21
#define ZRETRY_TCKEYREF 22
/* ------------------------------------------------------------------------- */
/* NODE STATE DURING SYSTEM RESTART, VARIABLES CNODES_SR_STATE */
@ -2276,6 +2277,7 @@ private:
void releaseScanrec(Signal* signal);
void seizeScanrec(Signal* signal);
Uint32 sendKeyinfo20(Signal* signal, ScanRecord *, TcConnectionrec *);
void sendTCKEYREF(Signal*, Uint32 dst, Uint32 route, Uint32 cnt);
void sendScanFragConf(Signal* signal, Uint32 scanCompleted);
void initCopyrec(Signal* signal);
void initCopyTc(Signal* signal);

View File

@ -464,6 +464,22 @@ void Dblqh::execCONTINUEB(Signal* signal)
return;
}
}
case ZRETRY_TCKEYREF:
{
jam();
Uint32 cnt = signal->theData[1];
Uint32 ref = signal->theData[2];
if (cnt < (10 * 60 * 5))
{
jam();
/**
* Only retry for 5 minutes...then hope that API has handled it..somehow
*/
memmove(signal->theData, signal->theData+3, 4*TcKeyRef::SignalLength);
sendTCKEYREF(signal, ref, 0, cnt);
}
return;
}
default:
ndbrequire(false);
break;
@ -2370,7 +2386,7 @@ void Dblqh::noFreeRecordLab(Signal* signal,
tcKeyRef->transId[0] = transid1;
tcKeyRef->transId[1] = transid2;
tcKeyRef->errorCode = errCode;
sendSignal(apiRef, GSN_TCKEYREF, signal, TcKeyRef::SignalLength, JBB);
sendTCKEYREF(signal, apiRef, signal->getSendersBlockRef(), 0);
} else {
jam();
@ -6576,8 +6592,7 @@ void Dblqh::continueAfterLogAbortWriteLab(Signal* signal)
tcKeyRef->transId[0] = regTcPtr->transid[0];
tcKeyRef->transId[1] = regTcPtr->transid[1];
tcKeyRef->errorCode = regTcPtr->errorCode;
sendSignal(regTcPtr->applRef,
GSN_TCKEYREF, signal, TcKeyRef::SignalLength, JBB);
sendTCKEYREF(signal, regTcPtr->applRef, regTcPtr->clientBlockref, 0);
cleanUp(signal);
return;
}//if
@ -6612,6 +6627,29 @@ void Dblqh::continueAfterLogAbortWriteLab(Signal* signal)
cleanUp(signal);
}//Dblqh::continueAfterLogAbortWriteLab()
void
Dblqh::sendTCKEYREF(Signal* signal, Uint32 ref, Uint32 routeRef, Uint32 cnt)
{
const Uint32 nodeId = refToNode(ref);
const bool connectedToNode = getNodeInfo(nodeId).m_connected;
if (likely(connectedToNode))
{
jam();
sendSignal(ref, GSN_TCKEYREF, signal, TcKeyRef::SignalLength, JBB);
}
else
{
jam();
memmove(signal->theData + 3, signal->theData, 4*TcKeyRef::SignalLength);
signal->theData[0] = ZRETRY_TCKEYREF;
signal->theData[1] = cnt + 1;
signal->theData[2] = ref;
sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100,
TcKeyRef::SignalLength + 3);
}
}
/* ##########################################################################
* ####### MODULE TO HANDLE TC FAILURE #######
*

View File

@ -942,7 +942,8 @@ public:
NF_CHECK_SCAN = 0x2,
NF_CHECK_TRANSACTION = 0x4,
NF_CHECK_DROP_TAB = 0x8,
NF_NODE_FAIL_BITS = 0xF // All bits...
NF_NODE_FAIL_BITS = 0xF, // All bits...
NF_STARTED = 0x10
};
Uint32 m_nf_bits;
NdbNodeBitmask m_lqh_trans_conf;
@ -1319,6 +1320,7 @@ private:
void execCOMMITCONF(Signal* signal);
void execABORTCONF(Signal* signal);
void execNODE_FAILREP(Signal* signal);
void execNODE_START_REP(Signal* signal);
void execINCL_NODEREQ(Signal* signal);
void execTIME_SIGNAL(Signal* signal);
void execAPI_FAILREQ(Signal* signal);

View File

@ -290,7 +290,8 @@ Dbtc::Dbtc(const class Configuration & conf):
addRecSignal(GSN_WAIT_DROP_TAB_CONF, &Dbtc::execWAIT_DROP_TAB_CONF);
addRecSignal(GSN_ALTER_TAB_REQ, &Dbtc::execALTER_TAB_REQ);
addRecSignal(GSN_NODE_START_REP, &Dbtc::execNODE_START_REP, true);
cacheRecord = 0;
apiConnectRecord = 0;
tcConnectRecord = 0;

View File

@ -3068,7 +3068,28 @@ void Dbtc::tckeyreq050Lab(Signal* signal)
}//if
}//for
}
}//if
if (regTcPtr->tcNodedata[0] != getOwnNodeId())
{
jam();
for (Uint32 i = 0; i < tnoOfBackup + 1; i++)
{
HostRecordPtr hostPtr;
hostPtr.i = regTcPtr->tcNodedata[i];
ptrCheckGuard(hostPtr, chostFilesize, hostRecord);
if (hostPtr.p->m_nf_bits & HostRecord::NF_STARTED)
{
jam();
if (i != 0)
{
jam();
regTcPtr->tcNodedata[0] = hostPtr.i;
}
break;
}
}
}//if
}
jam();
regTcPtr->lastReplicaNo = 0;
regTcPtr->noOfNodes = 1;
@ -7002,6 +7023,19 @@ void Dbtc::execNODE_FAILREP(Signal* signal)
}
}//Dbtc::execNODE_FAILREP()
void
Dbtc::execNODE_START_REP(Signal* signal)
{
Uint32 nodeId = signal->theData[0];
hostptr.i = nodeId;
ptrCheckGuard(hostptr, chostFilesize, hostRecord);
if (hostptr.p->m_nf_bits == 0)
{
jam();
hostptr.p->m_nf_bits |= HostRecord::NF_STARTED;
}
}
void
Dbtc::checkNodeFailComplete(Signal* signal,
Uint32 failedNodeId,
@ -8701,6 +8735,20 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
* IF ANY TO RECEIVE.
**********************************************************/
scanptr.p->scanState = ScanRecord::WAIT_AI;
if (ERROR_INSERTED(8038))
{
/**
* Force API_FAILREQ
*/
DisconnectRep * const rep = (DisconnectRep *)signal->getDataPtrSend();
rep->nodeId = refToNode(apiConnectptr.p->ndbapiBlockref);
rep->err = 8038;
EXECUTE_DIRECT(CMVMI, GSN_DISCONNECT_REP, signal, 2);
CLEAR_ERROR_INSERT_VALUE;
}
return;
SCAN_error_check:
@ -8790,6 +8838,7 @@ void Dbtc::initScanrec(ScanRecordPtr scanptr,
jam();
ScanFragRecPtr ptr;
ndbrequire(list.seize(ptr));
ptr.p->scanFragState = ScanFragRec::IDLE;
ptr.p->scanRec = scanptr.i;
ptr.p->scanFragId = 0;
ptr.p->m_apiPtr = cdata[i];
@ -9582,9 +9631,17 @@ Dbtc::close_scan_req(Signal* signal, ScanRecordPtr scanPtr, bool req_received){
ScanRecord* scanP = scanPtr.p;
ndbrequire(scanPtr.p->scanState != ScanRecord::IDLE);
ScanRecord::ScanState old = scanPtr.p->scanState;
scanPtr.p->scanState = ScanRecord::CLOSING_SCAN;
scanPtr.p->m_close_scan_req = req_received;
if (old == ScanRecord::WAIT_FRAGMENT_COUNT)
{
jam();
scanPtr.p->scanState = old;
return; // Will continue on execDI_FCOUNTCONF
}
/**
* Queue : Action
* ============= : =================
@ -9612,11 +9669,22 @@ Dbtc::close_scan_req(Signal* signal, ScanRecordPtr scanPtr, bool req_received){
ScanFragRecPtr curr = ptr; // Remove while iterating...
running.next(ptr);
if(curr.p->scanFragState == ScanFragRec::WAIT_GET_PRIMCONF){
switch(curr.p->scanFragState){
case ScanFragRec::IDLE:
jam(); // real early abort
ndbrequire(old == ScanRecord::WAIT_AI);
running.release(curr);
continue;
case ScanFragRec::WAIT_GET_PRIMCONF:
jam();
continue;
case ScanFragRec::LQH_ACTIVE:
jam();
break;
default:
jamLine(curr.p->scanFragState);
ndbrequire(false);
}
ndbrequire(curr.p->scanFragState == ScanFragRec::LQH_ACTIVE);
curr.p->startFragTimer(ctcTimer);
curr.p->scanFragState = ScanFragRec::LQH_ACTIVE;

View File

@ -196,6 +196,7 @@
#define ZTRY_TO_UPDATE_ERROR 888
#define ZCALL_ERROR 890
#define ZTEMPORARY_RESOURCE_FAILURE 891
#define ZUNSUPPORTED_BRANCH 892
#define ZSTORED_SEIZE_ATTRINBUFREC_ERROR 873 // Part of Scan

View File

@ -444,6 +444,11 @@ int Dbtup::TUPKEY_abort(Signal* signal, int error_type)
}//if
break;
case 40:
ljam();
terrorCode = ZUNSUPPORTED_BRANCH;
break;
default:
ndbrequire(false);
break;

View File

@ -1876,6 +1876,11 @@ int Dbtup::interpreterNextLab(Signal* signal,
// NULL==NULL and NULL<not-NULL
res1 = r1_null && r2_null ? 0 : r1_null ? -1 : 1;
} else {
jam();
if (unlikely(sqlType.m_cmp == 0))
{
return TUPKEY_abort(signal, 40);
}
res1 = (*sqlType.m_cmp)(cs, s1, attrLen, s2, argLen, true);
}
} else {
@ -1883,6 +1888,11 @@ int Dbtup::interpreterNextLab(Signal* signal,
// NULL like NULL is true (has no practical use)
res1 = r1_null && r2_null ? 0 : -1;
} else {
jam();
if (unlikely(sqlType.m_like == 0))
{
return TUPKEY_abort(signal, 40);
}
res1 = (*sqlType.m_like)(cs, s1, attrLen, s2, argLen);
}
}

View File

@ -918,15 +918,6 @@ SimulatedBlock::execCONTINUE_FRAGMENTED(Signal * signal){
void
SimulatedBlock::execNODE_START_REP(Signal* signal)
{
// common stuff for all blocks
// block specific stuff by virtual method override (default empty)
exec_node_start_rep(signal);
}
void
SimulatedBlock::exec_node_start_rep(Signal* signal)
{
}

View File

@ -424,7 +424,6 @@ private:
void execSIGNAL_DROPPED_REP(Signal* signal);
void execCONTINUE_FRAGMENTED(Signal* signal);
void execNODE_START_REP(Signal* signal);
virtual void exec_node_start_rep(Signal* signal);
Uint32 c_fragmentIdCounter;
ArrayPool<FragmentInfo> c_fragmentInfoPool;

View File

@ -923,7 +923,10 @@ NdbTransaction::release(){
* The user did not perform any rollback but simply closed the
* transaction. We must rollback Ndb since Ndb have been contacted.
************************************************************************/
execute(Rollback);
if (!theSimpleState)
{
execute(Rollback);
}
}//if
theMagicNumber = 0xFE11DC;
theInUseState = false;

View File

@ -278,6 +278,7 @@ ErrorBundle ErrorCodes[] = {
{ 885, AE, "Stack underflow in interpreter" },
{ 886, AE, "More than 65535 instructions executed in interpreter" },
{ 897, AE, "Update attempt of primary key via ndbcluster internal api (if this occurs via the MySQL server it is a bug, please report)" },
{ 892, AE, "Unsupported type in scan filter" },
{ 4256, AE, "Must call Ndb::init() before this function" },
{ 4257, AE, "Tried to read too much - too many getValue calls" },

View File

@ -23,6 +23,7 @@
#include <Vector.hpp>
#include <signaldata/DumpStateOrd.hpp>
#include <Bitmask.hpp>
#include <RefConvert.hpp>
int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){
@ -919,6 +920,41 @@ int runBug20185(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
int runBug24717(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
NdbRestarter restarter;
Ndb* pNdb = GETNDB(step);
HugoTransactions hugoTrans(*ctx->getTab());
int dump[] = { 9002, 0 } ;
Uint32 ownNode = refToNode(pNdb->getReference());
dump[1] = ownNode;
for (; loops; loops --)
{
int nodeId = restarter.getRandomNotMasterNodeId(rand());
restarter.restartOneDbNode(nodeId, false, true, true);
restarter.waitNodesNoStart(&nodeId, 1);
if (restarter.dumpStateOneNode(nodeId, dump, 2))
return NDBT_FAILED;
restarter.startNodes(&nodeId, 1);
for (Uint32 i = 0; i < 100; i++)
{
hugoTrans.pkReadRecords(pNdb, 100, 1, NdbOperation::LM_CommittedRead);
}
restarter.waitClusterStarted();
}
return NDBT_OK;
}
NDBT_TESTSUITE(testNodeRestart);
TESTCASE("NoLoad",
@ -1232,6 +1268,9 @@ TESTCASE("Bug20185",
STEP(runBug20185);
FINALIZER(runClearTable);
}
TESTCASE("Bug24717", ""){
INITIALIZER(runBug24717);
}
NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){

View File

@ -630,7 +630,7 @@ int runRestarter(NDBT_Context* ctx, NDBT_Step* step){
int nodeId = restarter.getDbNodeId(lastId);
lastId = (lastId + 1) % restarter.getNumDbNodes();
if(restarter.restartOneDbNode(nodeId) != 0){
if(restarter.restartOneDbNode(nodeId, false, false, true) != 0){
g_err << "Failed to restartNextDbNode" << endl;
result = NDBT_FAILED;
break;
@ -1125,6 +1125,39 @@ runScanParallelism(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
int
runBug24447(NDBT_Context* ctx, NDBT_Step* step){
int loops = 1; //ctx->getNumLoops();
int records = ctx->getNumRecords();
int abort = ctx->getProperty("AbortProb", 15);
NdbRestarter restarter;
HugoTransactions hugoTrans(*ctx->getTab());
int i = 0;
while (i<loops && !ctx->isTestStopped())
{
g_info << i++ << ": ";
int nodeId = restarter.getRandomNotMasterNodeId(rand());
if (nodeId == -1)
nodeId = restarter.getMasterNodeId();
if (restarter.insertErrorInNode(nodeId, 8038) != 0)
{
ndbout << "Could not insert error in node="<<nodeId<<endl;
return NDBT_FAILED;
}
for (Uint32 j = 0; i<10; i++)
{
hugoTrans.scanReadRecords(GETNDB(step), records, abort, 0,
NdbOperation::LM_CommittedRead);
}
}
restarter.insertErrorInAllNodes(0);
return NDBT_OK;
}
NDBT_TESTSUITE(testScan);
TESTCASE("ScanRead",
"Verify scan requirement: It should be possible "\
@ -1603,6 +1636,12 @@ TESTCASE("ScanParallelism",
STEP(runScanParallelism);
FINALIZER(runClearTable);
}
TESTCASE("Bug24447",
""){
INITIALIZER(runLoadTable);
STEP(runBug24447);
FINALIZER(runClearTable);
}
NDBT_TESTSUITE_END(testScan);
int main(int argc, const char** argv){

View File

@ -413,6 +413,10 @@ max-time: 500
cmd: testScan
args: -n ScanParallelism
max-time: 500
cmd: testScan
args: -n Bug24447 T1
max-time: 500
cmd: testNodeRestart
args: -n Bug15587 T1
@ -453,6 +457,10 @@ max-time: 1000
cmd: testIndex
args: -n Bug21384
max-time: 1000
cmd: testNodeRestart
args: -n Bug24717 T1
# OLD FLEX
max-time: 500
cmd: flexBench