Commit a8fef668 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.1-telco-gca

into  ymer.(none):/usr/local/mysql/mysql-5.1-telco-gca


storage/ndb/test/include/HugoOperations.hpp:
  Auto merged
storage/ndb/test/run-test/daily-basic-tests.txt:
  Auto merged
storage/ndb/test/src/HugoOperations.cpp:
  Auto merged
storage/ndb/test/ndbapi/testBasic.cpp:
  SCCS merged
parents 88a10dba 7f48dfa0
...@@ -440,6 +440,13 @@ insert into t1 values(7,'x'); ...@@ -440,6 +440,13 @@ insert into t1 values(7,'x');
insert into t1 values(8,'x'); insert into t1 values(8,'x');
delete from t1 where a = 0; delete from t1 where a = 0;
commit; commit;
delete from t1;
begin;
insert into t1 values (1, 'x');
select * from t1;
a b
1 x
rollback;
set autocommit = 1; set autocommit = 1;
drop table t1; drop table t1;
create table test.t1 (f1 varchar(50) primary key, f2 text,f3 int) create table test.t1 (f1 varchar(50) primary key, f2 text,f3 int)
......
...@@ -24,6 +24,33 @@ nid nom prenom ...@@ -24,6 +24,33 @@ nid nom prenom
select * from t1 order by nid; select * from t1 order by nid;
nid nom prenom nid nom prenom
1 XYZ2 ABC2 1 XYZ2 ABC2
delete from t1;
insert into t1 values(1,"AA", "AA");
insert into t1 values(2,"BB", "BB");
insert into t1 values(3,"CC", "CC");
insert into t1 values(4,"DD", "DD");
begin;
delete from t1 where nid = 1;
insert into t1 values (1,"A2", "A2");
update t1 set nom="B2" where nid = 2;
delete from t1 where nid = 2;
update t1 set nom = "D2" where nid = 4;
delete from t1 where nid = 4;
insert into t1 values (4, "D3", "D3");
update t1 set nom = "D4" where nid = 4;
insert into t1 values (5, "EE", "EE");
delete from t1 where nid = 5;
commit;
select * from t1 order by 1;
nid nom prenom
1 A2 A2
3 CC CC
4 D4 D3
select * from t1 order by 1;
nid nom prenom
1 A2 A2
3 CC CC
4 D4 D3
DROP table t1; DROP table t1;
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL, `nom` char(4) default NULL,
......
...@@ -367,8 +367,16 @@ insert into t1 values(7,'x'); ...@@ -367,8 +367,16 @@ insert into t1 values(7,'x');
insert into t1 values(8,'x'); insert into t1 values(8,'x');
delete from t1 where a = 0; delete from t1 where a = 0;
commit; commit;
delete from t1;
begin;
insert into t1 values (1, 'x');
select * from t1;
rollback;
set autocommit = 1; set autocommit = 1;
drop table t1; drop table t1;
############################# #############################
# Customer posted order by test case # Customer posted order by test case
......
...@@ -35,6 +35,37 @@ select * from t1 order by nid; ...@@ -35,6 +35,37 @@ select * from t1 order by nid;
# Bug #11087 would have row with nid 2 missing # Bug #11087 would have row with nid 2 missing
select * from t1 order by nid; select * from t1 order by nid;
--connection master
delete from t1;
insert into t1 values(1,"AA", "AA");
insert into t1 values(2,"BB", "BB");
insert into t1 values(3,"CC", "CC");
insert into t1 values(4,"DD", "DD");
begin;
# delete+insert = update
delete from t1 where nid = 1;
insert into t1 values (1,"A2", "A2");
# update+delete = delete
update t1 set nom="B2" where nid = 2;
delete from t1 where nid = 2;
# multi-update
update t1 set nom = "D2" where nid = 4;
delete from t1 where nid = 4;
insert into t1 values (4, "D3", "D3");
update t1 set nom = "D4" where nid = 4;
# insert+delete = nothing
insert into t1 values (5, "EE", "EE");
delete from t1 where nid = 5;
commit;
select * from t1 order by 1;
--sync_slave_with_master
--connection slave
select * from t1 order by 1;
--connection master --connection master
DROP table t1; DROP table t1;
......
...@@ -7771,7 +7771,7 @@ ndb_get_table_statistics(ha_ndbcluster* file, bool report_error, Ndb* ndb, const ...@@ -7771,7 +7771,7 @@ ndb_get_table_statistics(ha_ndbcluster* file, bool report_error, Ndb* ndb, const
NdbError error; NdbError error;
int retries= 10; int retries= 10;
int reterr= 0; int reterr= 0;
int retry_sleep= 30 * 1000; /* 30 milliseconds */ int retry_sleep= 30; /* 30 milliseconds, transaction */
char buff[22], buff2[22], buff3[22], buff4[22]; char buff[22], buff2[22], buff3[22], buff4[22];
DBUG_ENTER("ndb_get_table_statistics"); DBUG_ENTER("ndb_get_table_statistics");
DBUG_PRINT("enter", ("table: %s", ndbtab->getName())); DBUG_PRINT("enter", ("table: %s", ndbtab->getName()));
......
...@@ -1024,6 +1024,7 @@ ndbcluster_update_slock(THD *thd, ...@@ -1024,6 +1024,7 @@ ndbcluster_update_slock(THD *thd,
const NDBTAB *ndbtab= ndbtab_g.get_table(); const NDBTAB *ndbtab= ndbtab_g.get_table();
NdbTransaction *trans= 0; NdbTransaction *trans= 0;
int retries= 100; int retries= 100;
int retry_sleep= 10; /* 10 milliseconds, transaction */
const NDBCOL *col[SCHEMA_SIZE]; const NDBCOL *col[SCHEMA_SIZE];
unsigned sz[SCHEMA_SIZE]; unsigned sz[SCHEMA_SIZE];
...@@ -1125,6 +1126,7 @@ ndbcluster_update_slock(THD *thd, ...@@ -1125,6 +1126,7 @@ ndbcluster_update_slock(THD *thd,
{ {
if (trans) if (trans)
ndb->closeTransaction(trans); ndb->closeTransaction(trans);
my_sleep(retry_sleep);
continue; // retry continue; // retry
} }
} }
...@@ -1323,6 +1325,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, ...@@ -1323,6 +1325,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
const NDBTAB *ndbtab= ndbtab_g.get_table(); const NDBTAB *ndbtab= ndbtab_g.get_table();
NdbTransaction *trans= 0; NdbTransaction *trans= 0;
int retries= 100; int retries= 100;
int retry_sleep= 10; /* 10 milliseconds, transaction */
const NDBCOL *col[SCHEMA_SIZE]; const NDBCOL *col[SCHEMA_SIZE];
unsigned sz[SCHEMA_SIZE]; unsigned sz[SCHEMA_SIZE];
...@@ -1427,6 +1430,7 @@ err: ...@@ -1427,6 +1430,7 @@ err:
{ {
if (trans) if (trans)
ndb->closeTransaction(trans); ndb->closeTransaction(trans);
my_sleep(retry_sleep);
continue; // retry continue; // retry
} }
} }
...@@ -2715,6 +2719,11 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, ...@@ -2715,6 +2719,11 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
TABLE *table= share->table; TABLE *table= share->table;
int retries= 100; int retries= 100;
/*
100 milliseconds, temporary error on schema operation can
take some time to be resolved
*/
int retry_sleep= 100;
while (1) while (1)
{ {
pthread_mutex_lock(&injector_mutex); pthread_mutex_lock(&injector_mutex);
...@@ -2843,7 +2852,10 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, ...@@ -2843,7 +2852,10 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
ndb->dropEventOperation(op); ndb->dropEventOperation(op);
pthread_mutex_unlock(&injector_mutex); pthread_mutex_unlock(&injector_mutex);
if (retries) if (retries)
{
my_sleep(retry_sleep);
continue; continue;
}
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
pthread_mutex_unlock(&injector_mutex); pthread_mutex_unlock(&injector_mutex);
......
...@@ -46,6 +46,8 @@ public: ...@@ -46,6 +46,8 @@ public:
STATIC_CONST( ROW_GCI = 0xFFF5 ); STATIC_CONST( ROW_GCI = 0xFFF5 );
STATIC_CONST( FRAGMENT_VARSIZED_MEMORY = 0xFFF4 ); STATIC_CONST( FRAGMENT_VARSIZED_MEMORY = 0xFFF4 );
STATIC_CONST( COPY_ROWID = 0xFFF1 );
// NOTE: in 5.1 ctors and init take size in bytes // NOTE: in 5.1 ctors and init take size in bytes
/** Initialize AttributeHeader at location aHeaderPtr */ /** Initialize AttributeHeader at location aHeaderPtr */
......
...@@ -67,6 +67,7 @@ private: ...@@ -67,6 +67,7 @@ private:
enum ErrorCode enum ErrorCode
{ {
ZNODE_ALREADY_STARTING_ERROR = 305, ZNODE_ALREADY_STARTING_ERROR = 305,
ZNODE_START_DISALLOWED_ERROR = 309,
InitialStartRequired = 320 InitialStartRequired = 320
}; };
}; };
......
...@@ -119,7 +119,8 @@ struct SubStartRef { ...@@ -119,7 +119,8 @@ struct SubStartRef {
Undefined = 1, Undefined = 1,
NF_FakeErrorREF = 11, NF_FakeErrorREF = 11,
Busy = 701, Busy = 701,
NotMaster = 702 NotMaster = 702,
PartiallyConnected = 1421
}; };
STATIC_CONST( SignalLength = 7 ); STATIC_CONST( SignalLength = 7 );
......
...@@ -534,6 +534,7 @@ public: ...@@ -534,6 +534,7 @@ public:
static const Column * RECORDS_IN_RANGE; static const Column * RECORDS_IN_RANGE;
static const Column * ROWID; static const Column * ROWID;
static const Column * ROW_GCI; static const Column * ROW_GCI;
static const Column * COPY_ROWID;
int getSizeInBytes() const; int getSizeInBytes() const;
#endif #endif
......
...@@ -6,7 +6,7 @@ Next DBTUP 4029 ...@@ -6,7 +6,7 @@ Next DBTUP 4029
Next DBLQH 5045 Next DBLQH 5045
Next DBDICT 6007 Next DBDICT 6007
Next DBDIH 7183 Next DBDIH 7183
Next DBTC 8039 Next DBTC 8040
Next CMVMI 9000 Next CMVMI 9000
Next BACKUP 10038 Next BACKUP 10038
Next DBUTIL 11002 Next DBUTIL 11002
...@@ -327,6 +327,8 @@ Test Crashes in handling node restarts ...@@ -327,6 +327,8 @@ Test Crashes in handling node restarts
7170: Crash when receiving START_PERMREF (InitialStartRequired) 7170: Crash when receiving START_PERMREF (InitialStartRequired)
8039: DBTC delay INCL_NODECONF and kill starting node
7174: Crash starting node before sending DICT_LOCK_REQ 7174: Crash starting node before sending DICT_LOCK_REQ
7175: Master sends one fake START_PERMREF (ZNODE_ALREADY_STARTING_ERROR) 7175: Master sends one fake START_PERMREF (ZNODE_ALREADY_STARTING_ERROR)
7176: Slave NR pretends master does not support DICT lock (rolling upgrade) 7176: Slave NR pretends master does not support DICT lock (rolling upgrade)
......
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
#define ZWRONG_FAILURE_NUMBER_ERROR 302 #define ZWRONG_FAILURE_NUMBER_ERROR 302
#define ZWRONG_START_NODE_ERROR 303 #define ZWRONG_START_NODE_ERROR 303
#define ZNO_REPLICA_FOUND_ERROR 304 #define ZNO_REPLICA_FOUND_ERROR 304
#define ZNODE_START_DISALLOWED_ERROR 309
// -------------------------------------- // --------------------------------------
// Codes from LQH // Codes from LQH
...@@ -1643,6 +1642,8 @@ private: ...@@ -1643,6 +1642,8 @@ private:
// NR // NR
Uint32 c_dictLockSlavePtrI_nodeRestart; // userPtr for NR Uint32 c_dictLockSlavePtrI_nodeRestart; // userPtr for NR
void recvDictLockConf_nodeRestart(Signal* signal, Uint32 data, Uint32 ret); void recvDictLockConf_nodeRestart(Signal* signal, Uint32 data, Uint32 ret);
Uint32 c_error_7181_ref;
}; };
#if (DIH_CDATA_SIZE < _SYSFILE_SIZE32) #if (DIH_CDATA_SIZE < _SYSFILE_SIZE32)
......
...@@ -1709,7 +1709,8 @@ void Dbdih::execSTART_PERMREF(Signal* signal) ...@@ -1709,7 +1709,8 @@ void Dbdih::execSTART_PERMREF(Signal* signal)
{ {
jamEntry(); jamEntry();
Uint32 errorCode = signal->theData[1]; Uint32 errorCode = signal->theData[1];
if (errorCode == StartPermRef::ZNODE_ALREADY_STARTING_ERROR) { if (errorCode == StartPermRef::ZNODE_ALREADY_STARTING_ERROR ||
errorCode == StartPermRef::ZNODE_START_DISALLOWED_ERROR) {
jam(); jam();
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
// The master was busy adding another node. We will wait for a second and // The master was busy adding another node. We will wait for a second and
...@@ -2056,49 +2057,45 @@ void Dbdih::execINCL_NODECONF(Signal* signal) ...@@ -2056,49 +2057,45 @@ void Dbdih::execINCL_NODECONF(Signal* signal)
TstartNode_or_blockref = signal->theData[0]; TstartNode_or_blockref = signal->theData[0];
TsendNodeId = signal->theData[1]; TsendNodeId = signal->theData[1];
if (TstartNode_or_blockref == clocallqhblockref) { Uint32 blocklist[6];
jam(); blocklist[0] = clocallqhblockref;
/*-----------------------------------------------------------------------*/ blocklist[1] = clocaltcblockref;
// THIS SIGNAL CAME FROM THE LOCAL LQH BLOCK. blocklist[2] = cdictblockref;
// WE WILL NOW SEND INCLUDE TO THE TC BLOCK. blocklist[3] = numberToRef(BACKUP, getOwnNodeId());
/*-----------------------------------------------------------------------*/ blocklist[4] = numberToRef(SUMA, getOwnNodeId());
signal->theData[0] = reference(); blocklist[5] = 0;
signal->theData[1] = c_nodeStartSlave.nodeId;
sendSignal(clocaltcblockref, GSN_INCL_NODEREQ, signal, 2, JBB); for (Uint32 i = 0; blocklist[i] != 0; i++)
return; {
}//if if (TstartNode_or_blockref == blocklist[i])
if (TstartNode_or_blockref == clocaltcblockref) { {
jam(); jam();
/*----------------------------------------------------------------------*/ if (getNodeStatus(c_nodeStartSlave.nodeId) == NodeRecord::ALIVE &&
// THIS SIGNAL CAME FROM THE LOCAL LQH BLOCK. blocklist[i+1] != 0)
// WE WILL NOW SEND INCLUDE TO THE DICT BLOCK. {
/*----------------------------------------------------------------------*/ /**
signal->theData[0] = reference(); * Send to next in block list
signal->theData[1] = c_nodeStartSlave.nodeId; */
sendSignal(cdictblockref, GSN_INCL_NODEREQ, signal, 2, JBB); jam();
return; signal->theData[0] = reference();
}//if signal->theData[1] = c_nodeStartSlave.nodeId;
if (TstartNode_or_blockref == cdictblockref) { sendSignal(blocklist[i+1], GSN_INCL_NODEREQ, signal, 2, JBB);
jam(); return;
/*-----------------------------------------------------------------------*/ }
// THIS SIGNAL CAME FROM THE LOCAL DICT BLOCK. WE WILL NOW SEND CONF TO THE else
// BACKUP. {
/*-----------------------------------------------------------------------*/ /**
signal->theData[0] = reference(); * All done, reply to master
signal->theData[1] = c_nodeStartSlave.nodeId; */
sendSignal(BACKUP_REF, GSN_INCL_NODEREQ, signal, 2, JBB); jam();
signal->theData[0] = c_nodeStartSlave.nodeId;
// Suma will not send response to this for now, later... signal->theData[1] = cownNodeId;
sendSignal(SUMA_REF, GSN_INCL_NODEREQ, signal, 2, JBB); sendSignal(cmasterdihref, GSN_INCL_NODECONF, signal, 2, JBB);
return;
}//if c_nodeStartSlave.nodeId = 0;
if (TstartNode_or_blockref == numberToRef(BACKUP, getOwnNodeId())){ return;
jam(); }
signal->theData[0] = c_nodeStartSlave.nodeId; }
signal->theData[1] = cownNodeId;
sendSignal(cmasterdihref, GSN_INCL_NODECONF, signal, 2, JBB);
c_nodeStartSlave.nodeId = 0;
return;
} }
ndbrequire(cmasterdihref = reference()); ndbrequire(cmasterdihref = reference());
...@@ -2217,7 +2214,7 @@ void Dbdih::execSTART_INFOREQ(Signal* signal) ...@@ -2217,7 +2214,7 @@ void Dbdih::execSTART_INFOREQ(Signal* signal)
StartInfoRef *const ref =(StartInfoRef*)&signal->theData[0]; StartInfoRef *const ref =(StartInfoRef*)&signal->theData[0];
ref->startingNodeId = startNode; ref->startingNodeId = startNode;
ref->sendingNodeId = cownNodeId; ref->sendingNodeId = cownNodeId;
ref->errorCode = ZNODE_START_DISALLOWED_ERROR; ref->errorCode = StartPermRef::ZNODE_START_DISALLOWED_ERROR;
sendSignal(cmasterdihref, GSN_START_INFOREF, signal, sendSignal(cmasterdihref, GSN_START_INFOREF, signal,
StartInfoRef::SignalLength, JBB); StartInfoRef::SignalLength, JBB);
return; return;
...@@ -5033,6 +5030,7 @@ void Dbdih::execMASTER_GCPREQ(Signal* signal) ...@@ -5033,6 +5030,7 @@ void Dbdih::execMASTER_GCPREQ(Signal* signal)
{ {
ndbout_c("execGCP_TCFINISHED in MASTER_GCPREQ"); ndbout_c("execGCP_TCFINISHED in MASTER_GCPREQ");
CLEAR_ERROR_INSERT_VALUE; CLEAR_ERROR_INSERT_VALUE;
signal->theData[0] = c_error_7181_ref;
signal->theData[1] = coldgcp; signal->theData[1] = coldgcp;
execGCP_TCFINISHED(signal); execGCP_TCFINISHED(signal);
} }
...@@ -5108,6 +5106,7 @@ void Dbdih::execMASTER_GCPREQ(Signal* signal) ...@@ -5108,6 +5106,7 @@ void Dbdih::execMASTER_GCPREQ(Signal* signal)
{ {
ndbout_c("execGCP_TCFINISHED in MASTER_GCPREQ"); ndbout_c("execGCP_TCFINISHED in MASTER_GCPREQ");
CLEAR_ERROR_INSERT_VALUE; CLEAR_ERROR_INSERT_VALUE;
signal->theData[0] = c_error_7181_ref;
signal->theData[1] = coldgcp; signal->theData[1] = coldgcp;
execGCP_TCFINISHED(signal); execGCP_TCFINISHED(signal);
} }
...@@ -8010,6 +8009,7 @@ void Dbdih::execGCP_COMMIT(Signal* signal) ...@@ -8010,6 +8009,7 @@ void Dbdih::execGCP_COMMIT(Signal* signal)
cgckptflag = false; cgckptflag = false;
emptyverificbuffer(signal, true); emptyverificbuffer(signal, true);
cgcpParticipantState = GCP_PARTICIPANT_COMMIT_RECEIVED; cgcpParticipantState = GCP_PARTICIPANT_COMMIT_RECEIVED;
signal->theData[0] = calcDihBlockRef(masterNodeId);
signal->theData[1] = coldgcp; signal->theData[1] = coldgcp;
sendSignal(clocaltcblockref, GSN_GCP_NOMORETRANS, signal, 2, JBB); sendSignal(clocaltcblockref, GSN_GCP_NOMORETRANS, signal, 2, JBB);
return; return;
...@@ -8019,11 +8019,13 @@ void Dbdih::execGCP_TCFINISHED(Signal* signal) ...@@ -8019,11 +8019,13 @@ void Dbdih::execGCP_TCFINISHED(Signal* signal)
{ {
jamEntry(); jamEntry();
CRASH_INSERTION(7007); CRASH_INSERTION(7007);
Uint32 retRef = signal->theData[0];
Uint32 gci = signal->theData[1]; Uint32 gci = signal->theData[1];
ndbrequire(gci == coldgcp); ndbrequire(gci == coldgcp);
if (ERROR_INSERTED(7181) || ERROR_INSERTED(7182)) if (ERROR_INSERTED(7181) || ERROR_INSERTED(7182))
{ {
c_error_7181_ref = retRef; // Save ref
ndbout_c("killing %d", refToNode(cmasterdihref)); ndbout_c("killing %d", refToNode(cmasterdihref));
signal->theData[0] = 9999; signal->theData[0] = 9999;
sendSignal(numberToRef(CMVMI, refToNode(cmasterdihref)), sendSignal(numberToRef(CMVMI, refToNode(cmasterdihref)),
...@@ -8035,7 +8037,7 @@ void Dbdih::execGCP_TCFINISHED(Signal* signal) ...@@ -8035,7 +8037,7 @@ void Dbdih::execGCP_TCFINISHED(Signal* signal)
signal->theData[0] = cownNodeId; signal->theData[0] = cownNodeId;
signal->theData[1] = coldgcp; signal->theData[1] = coldgcp;
signal->theData[2] = cfailurenr; signal->theData[2] = cfailurenr;
sendSignal(cmasterdihref, GSN_GCP_NODEFINISH, signal, 3, JBB); sendSignal(retRef, GSN_GCP_NODEFINISH, signal, 3, JBB);
}//Dbdih::execGCP_TCFINISHED() }//Dbdih::execGCP_TCFINISHED()
/*****************************************************************************/ /*****************************************************************************/
......
...@@ -1952,5 +1952,8 @@ private: ...@@ -1952,5 +1952,8 @@ private:
// those variables should be removed and exchanged for stack // those variables should be removed and exchanged for stack
// variable communication. // variable communication.
/**************************************************************************/ /**************************************************************************/
Uint32 c_gcp_ref;
}; };
#endif #endif
...@@ -311,6 +311,19 @@ void Dbtc::execINCL_NODEREQ(Signal* signal) ...@@ -311,6 +311,19 @@ void Dbtc::execINCL_NODEREQ(Signal* signal)
hostptr.p->hostStatus = HS_ALIVE; hostptr.p->hostStatus = HS_ALIVE;
signal->theData[0] = cownref; signal->theData[0] = cownref;
c_alive_nodes.set(hostptr.i); c_alive_nodes.set(hostptr.i);
if (ERROR_INSERTED(8039))
{
CLEAR_ERROR_INSERT_VALUE;
Uint32 save = signal->theData[0];
signal->theData[0] = 9999;
sendSignal(numberToRef(CMVMI, hostptr.i),
GSN_NDB_TAMPER, signal, 1, JBB);
signal->theData[0] = save;
sendSignalWithDelay(tblockref, GSN_INCL_NODECONF, signal, 5000, 1);
return;
}
sendSignal(tblockref, GSN_INCL_NODECONF, signal, 1, JBB); sendSignal(tblockref, GSN_INCL_NODECONF, signal, 1, JBB);
} }
...@@ -6880,6 +6893,7 @@ void Dbtc::timeOutFoundFragLab(Signal* signal, UintR TscanConPtr) ...@@ -6880,6 +6893,7 @@ void Dbtc::timeOutFoundFragLab(Signal* signal, UintR TscanConPtr)
void Dbtc::execGCP_NOMORETRANS(Signal* signal) void Dbtc::execGCP_NOMORETRANS(Signal* signal)
{ {
jamEntry(); jamEntry();
c_gcp_ref = signal->theData[0];
tcheckGcpId = signal->theData[1]; tcheckGcpId = signal->theData[1];
if (cfirstgcp != RNIL) { if (cfirstgcp != RNIL) {
jam(); jam();
...@@ -9916,6 +9930,7 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) { ...@@ -9916,6 +9930,7 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) {
void Dbtc::gcpTcfinished(Signal* signal) void Dbtc::gcpTcfinished(Signal* signal)
{ {
signal->theData[0] = c_gcp_ref;
signal->theData[1] = tcheckGcpId; signal->theData[1] = tcheckGcpId;
sendSignal(cdihblockref, GSN_GCP_TCFINISHED, signal, 2, JBB); sendSignal(cdihblockref, GSN_GCP_TCFINISHED, signal, 2, JBB);
}//Dbtc::gcpTcfinished() }//Dbtc::gcpTcfinished()
......
...@@ -107,8 +107,7 @@ void Dbtup::removeActiveOpList(Operationrec* const regOperPtr, ...@@ -107,8 +107,7 @@ void Dbtup::removeActiveOpList(Operationrec* const regOperPtr,
/** /**
* Release copy tuple * Release copy tuple
*/ */
if(regOperPtr->op_struct.op_type != ZDELETE && if(!regOperPtr->m_copy_tuple_location.isNull())
!regOperPtr->m_copy_tuple_location.isNull())
c_undo_buffer.free_copy_tuple(&regOperPtr->m_copy_tuple_location); c_undo_buffer.free_copy_tuple(&regOperPtr->m_copy_tuple_location);
if (regOperPtr->op_struct.in_active_list) { if (regOperPtr->op_struct.in_active_list) {
......
...@@ -486,6 +486,13 @@ Uint32 Dbtup::leafPageRangeFull(Fragrecord* const regFragPtr, PageRangePtr curr ...@@ -486,6 +486,13 @@ Uint32 Dbtup::leafPageRangeFull(Fragrecord* const regFragPtr, PageRangePtr curr
ptrCheckGuard(parentPageRangePtr, cnoOfPageRangeRec, pageRange); ptrCheckGuard(parentPageRangePtr, cnoOfPageRangeRec, pageRange);
if (parentPageRangePtr.p->currentIndexPos < 3) { if (parentPageRangePtr.p->currentIndexPos < 3) {
ljam(); ljam();
if (c_noOfFreePageRanges < tiprNoLevels)
{
ljam();
return RNIL;
}//if
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* WE HAVE FOUND AN EMPTY ENTRY IN A PAGE RANGE RECORD. */ /* WE HAVE FOUND AN EMPTY ENTRY IN A PAGE RANGE RECORD. */
/* ALLOCATE A NEW PAGE RANGE RECORD, FILL IN THE START RANGE, */ /* ALLOCATE A NEW PAGE RANGE RECORD, FILL IN THE START RANGE, */
......
...@@ -1198,6 +1198,10 @@ Dbtup::read_pseudo(Uint32 attrId, ...@@ -1198,6 +1198,10 @@ Dbtup::read_pseudo(Uint32 attrId,
return 2; return 2;
} }
return 0; return 0;
case AttributeHeader::COPY_ROWID:
outBuffer[0] = operPtr.p->m_copy_tuple_location.m_page_no;
outBuffer[1] = operPtr.p->m_copy_tuple_location.m_page_idx;
return 2;
default: default:
return 0; return 0;
} }
......
...@@ -61,11 +61,15 @@ Dbtup::execACC_SCANREQ(Signal* signal) ...@@ -61,11 +61,15 @@ Dbtup::execACC_SCANREQ(Signal* signal)
jam(); jam();
break; break;
} }
#if BUG_27776_FIXED
if (!AccScanReq::getNoDiskScanFlag(req->requestInfo) if (!AccScanReq::getNoDiskScanFlag(req->requestInfo)
&& tablePtr.p->m_no_of_disk_attributes) && tablePtr.p->m_no_of_disk_attributes)
{ {
bits |= ScanOp::SCAN_DD; bits |= ScanOp::SCAN_DD;
} }
#endif
bool mm = (bits & ScanOp::SCAN_DD); bool mm = (bits & ScanOp::SCAN_DD);
if (tablePtr.p->m_attributes[mm].m_no_of_varsize > 0) { if (tablePtr.p->m_attributes[mm].m_no_of_varsize > 0) {
bits |= ScanOp::SCAN_VS; bits |= ScanOp::SCAN_VS;
...@@ -593,7 +597,6 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr) ...@@ -593,7 +597,6 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr)
const bool mm = (bits & ScanOp::SCAN_DD); const bool mm = (bits & ScanOp::SCAN_DD);
const bool lcp = (bits & ScanOp::SCAN_LCP); const bool lcp = (bits & ScanOp::SCAN_LCP);
const bool dirty = (bits & ScanOp::SCAN_LOCK) == 0;
Uint32 lcp_list = fragPtr.p->m_lcp_keep_list; Uint32 lcp_list = fragPtr.p->m_lcp_keep_list;
Uint32 size = table.m_offsets[mm].m_fix_header_size + Uint32 size = table.m_offsets[mm].m_fix_header_size +
...@@ -764,8 +767,7 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr) ...@@ -764,8 +767,7 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr)
jam(); jam();
if (! (thbits & Tuple_header::FREE)) if (! (thbits & Tuple_header::FREE))
{ {
if (! ((thbits & Tuple_header::ALLOC) && dirty)) goto found_tuple;
goto found_tuple;
} }
} }
else else
......
...@@ -813,17 +813,14 @@ void ...@@ -813,17 +813,14 @@ void
Suma::execINCL_NODEREQ(Signal* signal){ Suma::execINCL_NODEREQ(Signal* signal){
jamEntry(); jamEntry();
//const Uint32 senderRef = signal->theData[0]; const Uint32 senderRef = signal->theData[0];
const Uint32 nodeId = signal->theData[1]; const Uint32 nodeId = signal->theData[1];
ndbrequire(!c_alive_nodes.get(nodeId)); ndbrequire(!c_alive_nodes.get(nodeId));
c_alive_nodes.set(nodeId); c_alive_nodes.set(nodeId);
#if 0 // if we include this DIH's got to be prepared, later if needed...
signal->theData[0] = reference(); signal->theData[0] = reference();
sendSignal(senderRef, GSN_INCL_NODECONF, signal, 1, JBB); sendSignal(senderRef, GSN_INCL_NODECONF, signal, 1, JBB);
#endif
} }
void void
...@@ -953,6 +950,15 @@ Suma::execDUMP_STATE_ORD(Signal* signal){ ...@@ -953,6 +950,15 @@ Suma::execDUMP_STATE_ORD(Signal* signal){
CLEAR_ERROR_INSERT_VALUE; CLEAR_ERROR_INSERT_VALUE;
} }
if (tCase == 8010)
{
char buf1[255], buf2[255];
c_subscriber_nodes.getText(buf1);
c_connected_nodes.getText(buf2);
infoEvent("c_subscriber_nodes: %s", buf1);
infoEvent("c_connected_nodes: %s", buf2);
}
if (tCase == 8009) if (tCase == 8009)
{ {
if (ERROR_INSERTED(13030)) if (ERROR_INSERTED(13030))
...@@ -2388,6 +2394,16 @@ Suma::execSUB_START_REQ(Signal* signal){ ...@@ -2388,6 +2394,16 @@ Suma::execSUB_START_REQ(Signal* signal){
sendSubStartRef(signal, 1412); sendSubStartRef(signal, 1412);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
if (c_startup.m_restart_server_node_id == 0 &&
!c_connected_nodes.get(refToNode(subscriberRef)))
{
jam();
sendSubStartRef(signal, SubStartRef::PartiallyConnected);
return;
}
DBUG_PRINT("info",("c_subscriberPool size: %d free: %d", DBUG_PRINT("info",("c_subscriberPool size: %d free: %d",
c_subscriberPool.getSize(), c_subscriberPool.getSize(),
c_subscriberPool.getNoOfFree())); c_subscriberPool.getNoOfFree()));
......
...@@ -669,7 +669,7 @@ InitConfigFileParser::store_in_properties(Vector<struct my_option>& options, ...@@ -669,7 +669,7 @@ InitConfigFileParser::store_in_properties(Vector<struct my_option>& options,
if (options[i].var_type == GET_INT) if (options[i].var_type == GET_INT)
ctx.m_currentSection->put(options[i].name, (Uint32)value_int); ctx.m_currentSection->put(options[i].name, (Uint32)value_int);
else else
ctx.m_currentSection->put(options[i].name, value_int); ctx.m_currentSection->put64(options[i].name, value_int);
} }
} }
return true; return true;
......
...@@ -378,6 +378,11 @@ NdbColumnImpl::create_pseudo(const char * name){ ...@@ -378,6 +378,11 @@ NdbColumnImpl::create_pseudo(const char * name){
col->m_impl.m_attrSize = 8; col->m_impl.m_attrSize = 8;
col->m_impl.m_arraySize = 1; col->m_impl.m_arraySize = 1;
col->m_impl.m_nullable = true; col->m_impl.m_nullable = true;
} else if(!strcmp(name, "NDB$COPY_ROWID")){
col->setType(NdbDictionary::Column::Bigunsigned);
col->m_impl.m_attrId = AttributeHeader::COPY_ROWID;
col->m_impl.m_attrSize = 4;
col->m_impl.m_arraySize = 2;
} else { } else {
abort(); abort();
} }
...@@ -5089,3 +5094,4 @@ const NdbDictionary::Column * NdbDictionary::Column::DISK_REF = 0; ...@@ -5089,3 +5094,4 @@ const NdbDictionary::Column * NdbDictionary::Column::DISK_REF = 0;
const NdbDictionary::Column * NdbDictionary::Column::RECORDS_IN_RANGE = 0; const NdbDictionary::Column * NdbDictionary::Column::RECORDS_IN_RANGE = 0;
const NdbDictionary::Column * NdbDictionary::Column::ROWID = 0; const NdbDictionary::Column * NdbDictionary::Column::ROWID = 0;
const NdbDictionary::Column * NdbDictionary::Column::ROW_GCI = 0; const NdbDictionary::Column * NdbDictionary::Column::ROW_GCI = 0;
const NdbDictionary::Column * NdbDictionary::Column::COPY_ROWID = 0;
...@@ -979,7 +979,7 @@ NdbEventOperationImpl::printAll() ...@@ -979,7 +979,7 @@ NdbEventOperationImpl::printAll()
NdbEventBuffer::NdbEventBuffer(Ndb *ndb) : NdbEventBuffer::NdbEventBuffer(Ndb *ndb) :
m_system_nodes(ndb->theImpl->theNoOfDBnodes), m_system_nodes(ndb->theImpl->theNoOfDBnodes),
m_ndb(ndb), m_ndb(ndb),
m_latestGCI(0), m_latestGCI(0), m_latest_complete_GCI(0),
m_total_alloc(0), m_total_alloc(0),
m_free_thresh(10), m_free_thresh(10),
m_min_free_thresh(10), m_min_free_thresh(10),
...@@ -1470,7 +1470,7 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) ...@@ -1470,7 +1470,7 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep)
, m_flush_gci , m_flush_gci
#endif #endif
); );
Uint32 idx = bucket - (Gci_container*)m_active_gci.getBase();
if (unlikely(bucket == 0)) if (unlikely(bucket == 0))
{ {
/** /**
...@@ -1515,8 +1515,20 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) ...@@ -1515,8 +1515,20 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep)
} }
reportStatus(); reportStatus();
bzero(bucket, sizeof(Gci_container)); bzero(bucket, sizeof(Gci_container));
bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE; if (likely(idx < ACTIVE_GCI_DIRECTORY_SIZE))
bucket->m_gcp_complete_rep_count = m_system_nodes; {
/**
* Only "prepare" next GCI if we're in
* the first 4 highest GCI's...else
* this is somekind of "late" GCI...
* which is only initialized to 0
*
* This to make sure we dont get several buckets with same GCI
*/
bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE;
bucket->m_gcp_complete_rep_count = m_system_nodes;
}
if(unlikely(m_latest_complete_GCI > gci)) if(unlikely(m_latest_complete_GCI > gci))
{ {
complete_outof_order_gcis(); complete_outof_order_gcis();
......
...@@ -326,6 +326,8 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char * ...@@ -326,6 +326,8 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
NdbColumnImpl::create_pseudo("NDB$ROWID"); NdbColumnImpl::create_pseudo("NDB$ROWID");
NdbDictionary::Column::ROW_GCI= NdbDictionary::Column::ROW_GCI=
NdbColumnImpl::create_pseudo("NDB$ROW_GCI"); NdbColumnImpl::create_pseudo("NDB$ROW_GCI");
NdbDictionary::Column::COPY_ROWID=
NdbColumnImpl::create_pseudo("NDB$COPY_ROWID");
} }
NdbMutex_Unlock(g_ndb_connection_mutex); NdbMutex_Unlock(g_ndb_connection_mutex);
...@@ -391,6 +393,9 @@ Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl() ...@@ -391,6 +393,9 @@ Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
NdbDictionary::Column::RECORDS_IN_RANGE= 0; NdbDictionary::Column::RECORDS_IN_RANGE= 0;
NdbDictionary::Column::ROWID= 0; NdbDictionary::Column::ROWID= 0;
NdbDictionary::Column::ROW_GCI= 0; NdbDictionary::Column::ROW_GCI= 0;
delete NdbDictionary::Column::COPY_ROWID;
NdbDictionary::Column::COPY_ROWID = 0;
} }
NdbMutex_Unlock(g_ndb_connection_mutex); NdbMutex_Unlock(g_ndb_connection_mutex);
......
...@@ -490,6 +490,7 @@ ErrorBundle ErrorCodes[] = { ...@@ -490,6 +490,7 @@ ErrorBundle ErrorCodes[] = {
{ 1419, DMEC, SE, "Subscription already dropped" }, { 1419, DMEC, SE, "Subscription already dropped" },
{ 1420, DMEC, TR, "Subscriber manager busy with adding/removing a table" }, { 1420, DMEC, TR, "Subscriber manager busy with adding/removing a table" },
{ 1421, DMEC, SE, "Partially connected API in NdbOperation::execute()" },
{ 4004, DMEC, AE, "Attribute name or id not found in the table" }, { 4004, DMEC, AE, "Attribute name or id not found in the table" },
......
...@@ -84,6 +84,8 @@ public: ...@@ -84,6 +84,8 @@ public:
int equalForAttr(NdbOperation*, int equalForAttr(NdbOperation*,
int attrId, int attrId,
int rowId); int rowId);
int equalForRow(NdbOperation*, int rowid);
int setValues(NdbOperation*, int rowId, int updateId); int setValues(NdbOperation*, int rowId, int updateId);
......
...@@ -27,15 +27,34 @@ public: ...@@ -27,15 +27,34 @@ public:
int getDbNodeId(int _i); int getDbNodeId(int _i);
enum RestartFlags {
NRRF_INITIAL = 0x1,
NRRF_NOSTART = 0x2,
NRRF_ABORT = 0x4
};
int restartOneDbNode(int _nodeId, int restartOneDbNode(int _nodeId,
bool initial = false, bool initial = false,
bool nostart = false, bool nostart = false,
bool abort = false); bool abort = false);
int restartOneDbNode2(int _nodeId, Uint32 flags){
return restartOneDbNode(_nodeId,
flags & NRRF_INITIAL,
flags & NRRF_NOSTART,
flags & NRRF_ABORT);
}
int restartAll(bool initial = false, int restartAll(bool initial = false,
bool nostart = false, bool nostart = false,
bool abort = false); bool abort = false);
int restartAll2(Uint32 flags){
return restartAll(flags & NRRF_INITIAL,
flags & NRRF_NOSTART,
flags & NRRF_ABORT);
}
int startAll(); int startAll();
int startNodes(const int * _nodes, int _num_nodes); int startNodes(const int * _nodes, int _num_nodes);
int waitClusterStarted(unsigned int _timeout = 120); int waitClusterStarted(unsigned int _timeout = 120);
......
...@@ -1340,6 +1340,64 @@ runBug28073(NDBT_Context *ctx, NDBT_Step* step) ...@@ -1340,6 +1340,64 @@ runBug28073(NDBT_Context *ctx, NDBT_Step* step)
return result; return result;
} }
int
runBug27756(NDBT_Context* ctx, NDBT_Step* step)
{
Ndb* pNdb = GETNDB(step);
NdbDictionary::Dictionary * dict = pNdb->getDictionary();
HugoOperations ops(*ctx->getTab());
int loops = ctx->getNumLoops();
const int rows = ctx->getNumRecords();
Vector<Uint64> copies;
while (loops--)
{
ops.startTransaction(pNdb);
ops.pkInsertRecord(pNdb, 1, 1);
ops.execute_NoCommit(pNdb);
NdbTransaction* pTrans = ops.getTransaction();
NdbOperation* op = pTrans->getNdbOperation(ctx->getTab()->getName());
op->interpretedUpdateTuple();
ops.equalForRow(op, 1);
NdbRecAttr* attr = op->getValue(NdbDictionary::Column::COPY_ROWID);
ops.execute_NoCommit(pNdb);
copies.push_back(attr->u_64_value());
ndbout_c("copy at: %llx", copies.back());
ops.execute_NoCommit(pNdb);
ops.pkDeleteRecord(pNdb, 1, 1);
ops.execute_NoCommit(pNdb);
if (loops & 1)
{
ops.execute_Rollback(pNdb);
ops.closeTransaction(pNdb);
}
else
{
ops.execute_Commit(pNdb);
ops.closeTransaction(pNdb);
ops.clearTable(pNdb, 100);
}
}
for (Uint32 i = 0; i<copies.size(); i++)
if (copies[i] != copies.back())
{
ndbout_c("Memleak detected");
return NDBT_FAILED;
}
return NDBT_OK;
}
template class Vector<Uint64>;
NDBT_TESTSUITE(testBasic); NDBT_TESTSUITE(testBasic);
TESTCASE("PkInsert", TESTCASE("PkInsert",
"Verify that we can insert and delete from this table using PK" "Verify that we can insert and delete from this table using PK"
...@@ -1614,6 +1672,10 @@ TESTCASE("Bug28073", ...@@ -1614,6 +1672,10 @@ TESTCASE("Bug28073",
"Infinite loop in lock queue" ){ "Infinite loop in lock queue" ){
STEP(runBug28073); STEP(runBug28073);
} }
TESTCASE("Bug27756",
"Verify what happens when we fill the db" ){
STEP(runBug27756);
}
NDBT_TESTSUITE_END(testBasic); NDBT_TESTSUITE_END(testBasic);
#if 0 #if 0
......
...@@ -1364,7 +1364,7 @@ runBug27003(NDBT_Context* ctx, NDBT_Step* step) ...@@ -1364,7 +1364,7 @@ runBug27003(NDBT_Context* ctx, NDBT_Step* step)
return NDBT_FAILED; return NDBT_FAILED;
res.startNodes(&node, 1); res.startNodes(&node, 1);
res.waitNodesStartPhase(&node, 1, 2); NdbSleep_SecSleep(3);
pos++; pos++;
} }
pos = 0; pos = 0;
...@@ -1423,6 +1423,122 @@ runBug27283(NDBT_Context* ctx, NDBT_Step* step) ...@@ -1423,6 +1423,122 @@ runBug27283(NDBT_Context* ctx, NDBT_Step* step)
return NDBT_OK; return NDBT_OK;
} }
int
runBug27466(NDBT_Context* ctx, NDBT_Step* step)
{
int result = NDBT_OK;
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
NdbRestarter res;
if (res.getNumDbNodes() < 2)
{
return NDBT_OK;
}
Uint32 pos = 0;
for (Uint32 i = 0; i<loops; i++)
{
int node1 = res.getDbNodeId(rand() % res.getNumDbNodes());
int node2 = node1;
while (node1 == node2)
{
node2 = res.getDbNodeId(rand() % res.getNumDbNodes());
}
if (res.restartOneDbNode(node1, false, true, true))
return NDBT_FAILED;
if (res.waitNodesNoStart(&node1, 1))
return NDBT_FAILED;
int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
if (res.dumpStateOneNode(node1, val2, 2))
return NDBT_FAILED;
if (res.insertErrorInNode(node2, 8039))
return NDBT_FAILED;
res.startNodes(&node1, 1);
NdbSleep_SecSleep(3);
if (res.waitNodesNoStart(&node1, 1))
return NDBT_FAILED;
NdbSleep_SecSleep(5); // Wait for delayed INCL_NODECONF to arrive
res.startNodes(&node1, 1);
if (res.waitClusterStarted())
return NDBT_FAILED;
}
return NDBT_OK;
}
int
runBug28023(NDBT_Context* ctx, NDBT_Step* step)
{
int result = NDBT_OK;
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
Ndb* pNdb = GETNDB(step);
NdbRestarter res;
if (res.getNumDbNodes() < 2)
{
return NDBT_OK;
}
HugoTransactions hugoTrans(*ctx->getTab());
if (hugoTrans.loadTable(pNdb, records) != 0){
return NDBT_FAILED;
}
if (hugoTrans.clearTable(pNdb, records) != 0)
{
return NDBT_FAILED;
}
for (Uint32 i = 0; i<loops; i++)
{
int node1 = res.getDbNodeId(rand() % res.getNumDbNodes());
if (res.restartOneDbNode2(node1,
NdbRestarter::NRRF_ABORT |
NdbRestarter::NRRF_NOSTART))
return NDBT_FAILED;
if (res.waitNodesNoStart(&node1, 1))
return NDBT_FAILED;
if (hugoTrans.loadTable(pNdb, records) != 0){
return NDBT_FAILED;
}
if (hugoTrans.clearTable(pNdb, records) != 0)
{
return NDBT_FAILED;
}
res.startNodes(&node1, 1);
if (res.waitClusterStarted())
return NDBT_FAILED;
if (hugoTrans.loadTable(pNdb, records) != 0){
return NDBT_FAILED;
}
if (hugoTrans.scanUpdateRecords(pNdb, records) != 0)
return NDBT_FAILED;
if (hugoTrans.clearTable(pNdb, records) != 0)
{
return NDBT_FAILED;
}
}
return NDBT_OK;
}
NDBT_TESTSUITE(testNodeRestart); NDBT_TESTSUITE(testNodeRestart);
TESTCASE("NoLoad", TESTCASE("NoLoad",
"Test that one node at a time can be stopped and then restarted "\ "Test that one node at a time can be stopped and then restarted "\
...@@ -1774,6 +1890,12 @@ TESTCASE("Bug27003", ""){ ...@@ -1774,6 +1890,12 @@ TESTCASE("Bug27003", ""){
TESTCASE("Bug27283", ""){ TESTCASE("Bug27283", ""){
INITIALIZER(runBug27283); INITIALIZER(runBug27283);
} }
TESTCASE("Bug27466", ""){
INITIALIZER(runBug27466);
}
TESTCASE("Bug28023", ""){
INITIALIZER(runBug28023);
}
NDBT_TESTSUITE_END(testNodeRestart); NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){ int main(int argc, const char** argv){
......
...@@ -235,6 +235,10 @@ max-time: 500 ...@@ -235,6 +235,10 @@ max-time: 500
cmd: testBasic cmd: testBasic
args: -n Bug25090 T1 args: -n Bug25090 T1
max-time: 1000
cmd: testBasic
args: -n Bug27756
max-time: 500 max-time: 500
cmd: testBasic cmd: testBasic
args: -n Bug28073 args: -n Bug28073
...@@ -473,6 +477,10 @@ max-time: 1000 ...@@ -473,6 +477,10 @@ max-time: 1000
cmd: testNodeRestart cmd: testNodeRestart
args: -n Bug27283 T1 args: -n Bug27283 T1
max-time: 1000
cmd: testNodeRestart
args: -n Bug28023 T7 D2
max-time: 500 max-time: 500
cmd: testScan cmd: testScan
args: -n ScanVariants args: -n ScanVariants
...@@ -800,6 +808,10 @@ max-time: 1000 ...@@ -800,6 +808,10 @@ max-time: 1000
cmd: testNodeRestart cmd: testNodeRestart
args: -n Bug25468 T1 args: -n Bug25468 T1
max-time: 1000
cmd: testNodeRestart
args: -n Bug27466 T1
max-time: 1000 max-time: 1000
cmd: test_event cmd: test_event
args: -l 10 -n Bug27169 T1 args: -l 10 -n Bug27169 T1
......
...@@ -188,14 +188,11 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, ...@@ -188,14 +188,11 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb,
// Read // Read
// Define primary keys // Define primary keys
check = pOp->readTupleExclusive(); check = pOp->readTupleExclusive();
for (a = 0; a < tab.getNoOfColumns(); a++) { if (equalForRow(pOp, cReadRecords) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true) { {
if (equalForAttr(pOp, a, cReadRecords) != 0){ ERR(transactions[t]->getNdbError());
ERR(transactions[t]->getNdbError()); pNdb->closeTransaction(transactions[t]);
pNdb->closeTransaction(transactions[t]); return NDBT_FAILED;
return NDBT_FAILED;
}
}
} }
// Define attributes to read // Define attributes to read
for (a = 0; a < tab.getNoOfColumns(); a++) { for (a = 0; a < tab.getNoOfColumns(); a++) {
...@@ -259,15 +256,12 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, ...@@ -259,15 +256,12 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb,
} }
// Set search condition for the record // Set search condition for the record
for (a = 0; a < tab.getNoOfColumns(); a++) { if (equalForRow(pOp, cReadRecords) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true) { {
if (equalForAttr(pOp, a, cRecords) != 0) { ERR(transactions[t]->getNdbError());
ERR(transactions[t]->getNdbError()); pNdb->closeTransaction(transactions[t]);
pNdb->closeTransaction(transactions[t]); return NDBT_FAILED;
return NDBT_FAILED; }
}
}
}
// Update the record // Update the record
for (a = 0; a < tab.getNoOfColumns(); a++) { for (a = 0; a < tab.getNoOfColumns(); a++) {
...@@ -396,15 +390,12 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, ...@@ -396,15 +390,12 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb,
case NO_READ: case NO_READ:
// Define primary keys // Define primary keys
check = pOp->readTuple(); check = pOp->readTuple();
for (a = 0; a < tab.getNoOfColumns(); a++) { if (equalForRow(pOp, cRecords) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true) { {
if (equalForAttr(pOp, a, cRecords) != 0){ ERR(transactions[t]->getNdbError());
ERR(transactions[t]->getNdbError()); pNdb->closeTransaction(transactions[t]);
pNdb->closeTransaction(transactions[t]); return NDBT_FAILED;
return NDBT_FAILED; }
}
}
}
// Define attributes to read // Define attributes to read
for (a = 0; a < tab.getNoOfColumns(); a++) { for (a = 0; a < tab.getNoOfColumns(); a++) {
if ((rows[cIndex]->attributeStore(a) = if ((rows[cIndex]->attributeStore(a) =
...@@ -425,15 +416,12 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, ...@@ -425,15 +416,12 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb,
} }
// Define primary keys // Define primary keys
for (a = 0; a < tab.getNoOfColumns(); a++) { if (equalForRow(pOp, cRecords) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ {
if (equalForAttr(pOp, a, cRecords) != 0) { ERR(transactions[t]->getNdbError());
ERR(transactions[t]->getNdbError()); pNdb->closeTransaction(transactions[t]);
pNdb->closeTransaction(transactions[t]); return NDBT_FAILED;
return NDBT_FAILED; }
}
}
}
break; break;
default: default:
// Should not happen... // Should not happen...
......
...@@ -113,14 +113,8 @@ rand_lock_mode: ...@@ -113,14 +113,8 @@ rand_lock_mode:
} }
// Define primary keys // Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r+recordNo) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ return NDBT_FAILED;
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
if(pIndexScanOp) if(pIndexScanOp)
pIndexScanOp->end_of_bound(r); pIndexScanOp->end_of_bound(r);
...@@ -145,7 +139,6 @@ int HugoOperations::pkUpdateRecord(Ndb* pNdb, ...@@ -145,7 +139,6 @@ int HugoOperations::pkUpdateRecord(Ndb* pNdb,
int recordNo, int recordNo,
int numRecords, int numRecords,
int updatesValue){ int updatesValue){
int a;
allocRows(numRecords); allocRows(numRecords);
int check; int check;
for(int r=0; r < numRecords; r++){ for(int r=0; r < numRecords; r++){
...@@ -174,14 +167,8 @@ HugoOperations::setValues(NdbOperation* pOp, int rowId, int updateId) ...@@ -174,14 +167,8 @@ HugoOperations::setValues(NdbOperation* pOp, int rowId, int updateId)
{ {
// Define primary keys // Define primary keys
int a; int a;
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, rowId) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ return NDBT_FAILED;
if(equalForAttr(pOp, a, rowId) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
for(a = 0; a<tab.getNoOfColumns(); a++){ for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == false){ if (tab.getColumn(a)->getPrimaryKey() == false){
...@@ -200,7 +187,7 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb, ...@@ -200,7 +187,7 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb,
int numRecords, int numRecords,
int updatesValue){ int updatesValue){
int a, check; int check;
for(int r=0; r < numRecords; r++){ for(int r=0; r < numRecords; r++){
NdbOperation* pOp = getOperation(pTrans, NdbOperation::InsertRequest); NdbOperation* pOp = getOperation(pTrans, NdbOperation::InsertRequest);
if (pOp == NULL) { if (pOp == NULL) {
...@@ -242,14 +229,8 @@ int HugoOperations::pkWriteRecord(Ndb* pNdb, ...@@ -242,14 +229,8 @@ int HugoOperations::pkWriteRecord(Ndb* pNdb,
} }
// Define primary keys // Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r+recordNo) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ return NDBT_FAILED;
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
// Define attributes to update // Define attributes to update
for(a = 0; a<tab.getNoOfColumns(); a++){ for(a = 0; a<tab.getNoOfColumns(); a++){
...@@ -268,7 +249,7 @@ int HugoOperations::pkWritePartialRecord(Ndb* pNdb, ...@@ -268,7 +249,7 @@ int HugoOperations::pkWritePartialRecord(Ndb* pNdb,
int recordNo, int recordNo,
int numRecords){ int numRecords){
int a, check; int check;
for(int r=0; r < numRecords; r++){ for(int r=0; r < numRecords; r++){
NdbOperation* pOp = pTrans->getNdbOperation(tab.getName()); NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
if (pOp == NULL) { if (pOp == NULL) {
...@@ -283,14 +264,8 @@ int HugoOperations::pkWritePartialRecord(Ndb* pNdb, ...@@ -283,14 +264,8 @@ int HugoOperations::pkWritePartialRecord(Ndb* pNdb,
} }
// Define primary keys // Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r+recordNo) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ return NDBT_FAILED;
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
} }
return NDBT_OK; return NDBT_OK;
} }
...@@ -299,7 +274,7 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb, ...@@ -299,7 +274,7 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb,
int recordNo, int recordNo,
int numRecords){ int numRecords){
int a, check; int check;
for(int r=0; r < numRecords; r++){ for(int r=0; r < numRecords; r++){
NdbOperation* pOp = getOperation(pTrans, NdbOperation::DeleteRequest); NdbOperation* pOp = getOperation(pTrans, NdbOperation::DeleteRequest);
if (pOp == NULL) { if (pOp == NULL) {
...@@ -314,14 +289,8 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb, ...@@ -314,14 +289,8 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb,
} }
// Define primary keys // Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r+recordNo) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ return NDBT_FAILED;
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
} }
return NDBT_OK; return NDBT_OK;
} }
...@@ -520,6 +489,22 @@ HugoOperations::~HugoOperations(){ ...@@ -520,6 +489,22 @@ HugoOperations::~HugoOperations(){
} }
} }
int
HugoOperations::equalForRow(NdbOperation* pOp, int row)
{
for(int a = 0; a<tab.getNoOfColumns(); a++)
{
if (tab.getColumn(a)->getPrimaryKey() == true)
{
if(equalForAttr(pOp, a, row) != 0)
{
ERR(pOp->getNdbError());
return NDBT_FAILED;
}
}
}
return NDBT_OK;
}
int HugoOperations::equalForAttr(NdbOperation* pOp, int HugoOperations::equalForAttr(NdbOperation* pOp,
int attrId, int attrId,
...@@ -678,14 +663,8 @@ int HugoOperations::indexReadRecords(Ndb*, const char * idxName, int recordNo, ...@@ -678,14 +663,8 @@ int HugoOperations::indexReadRecords(Ndb*, const char * idxName, int recordNo,
} }
// Define primary keys // Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r+recordNo) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ return NDBT_FAILED;
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
// Define attributes to read // Define attributes to read
for(a = 0; a<tab.getNoOfColumns(); a++){ for(a = 0; a<tab.getNoOfColumns(); a++){
...@@ -722,14 +701,8 @@ HugoOperations::indexUpdateRecord(Ndb*, ...@@ -722,14 +701,8 @@ HugoOperations::indexUpdateRecord(Ndb*,
} }
// Define primary keys // Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r+recordNo) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ return NDBT_FAILED;
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
// Define attributes to update // Define attributes to update
for(a = 0; a<tab.getNoOfColumns(); a++){ for(a = 0; a<tab.getNoOfColumns(); a++){
......
...@@ -520,10 +520,9 @@ HugoTransactions::loadTable(Ndb* pNdb, ...@@ -520,10 +520,9 @@ HugoTransactions::loadTable(Ndb* pNdb,
bool oneTrans, bool oneTrans,
int value, int value,
bool abort){ bool abort){
int check, a; int check;
int retryAttempt = 0; int retryAttempt = 0;
int retryMax = 5; int retryMax = 5;
NdbOperation *pOp;
bool first_batch = true; bool first_batch = true;
const int org = batch; const int org = batch;
...@@ -667,10 +666,9 @@ HugoTransactions::loadTable(Ndb* pNdb, ...@@ -667,10 +666,9 @@ HugoTransactions::loadTable(Ndb* pNdb,
int int
HugoTransactions::fillTable(Ndb* pNdb, HugoTransactions::fillTable(Ndb* pNdb,
int batch){ int batch){
int check, a, b; int check;
int retryAttempt = 0; int retryAttempt = 0;
int retryMax = 5; int retryMax = 5;
NdbOperation *pOp;
const int org = batch; const int org = batch;
const int cols = tab.getNoOfColumns(); const int cols = tab.getNoOfColumns();
...@@ -791,7 +789,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb, ...@@ -791,7 +789,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
int reads = 0; int reads = 0;
int r = 0; int r = 0;
int retryAttempt = 0; int retryAttempt = 0;
int check, a; int check;
if (batch == 0) { if (batch == 0) {
g_info << "ERROR: Argument batch == 0 in pkReadRecords(). Not allowed." << endl; g_info << "ERROR: Argument batch == 0 in pkReadRecords(). Not allowed." << endl;
...@@ -910,8 +908,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb, ...@@ -910,8 +908,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
int updated = 0; int updated = 0;
int r = 0; int r = 0;
int retryAttempt = 0; int retryAttempt = 0;
int check, a, b; int check, b;
NdbOperation *pOp;
allocRows(batch); allocRows(batch);
...@@ -1097,14 +1094,10 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, ...@@ -1097,14 +1094,10 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
} }
// Define primary keys // Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ {
if(equalForAttr(pOp, a, r) != 0){ closeTransaction(pNdb);
ERR(pTrans->getNdbError()); return NDBT_FAILED;
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
} }
// Read update value // Read update value
...@@ -1153,14 +1146,10 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, ...@@ -1153,14 +1146,10 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
} }
// PKs // PKs
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ {
if(equalForAttr(pUpdOp, a, r) != 0){ closeTransaction(pNdb);
ERR(pTrans->getNdbError()); return NDBT_FAILED;
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
} }
// Update col // Update col
...@@ -1236,8 +1225,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb, ...@@ -1236,8 +1225,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb,
int deleted = 0; int deleted = 0;
int r = 0; int r = 0;
int retryAttempt = 0; int retryAttempt = 0;
int check, a; int check;
NdbOperation *pOp;
g_info << "|- Deleting records..." << endl; g_info << "|- Deleting records..." << endl;
while (r < records){ while (r < records){
...@@ -1335,8 +1323,7 @@ HugoTransactions::lockRecords(Ndb* pNdb, ...@@ -1335,8 +1323,7 @@ HugoTransactions::lockRecords(Ndb* pNdb,
// and lock som other records // and lock som other records
int r = 0; int r = 0;
int retryAttempt = 0; int retryAttempt = 0;
int check, a, b; int check;
NdbOperation *pOp;
NdbOperation::LockMode lm = NdbOperation::LM_Exclusive; NdbOperation::LockMode lm = NdbOperation::LM_Exclusive;
// Calculate how many records to lock in each batch // Calculate how many records to lock in each batch
...@@ -1522,14 +1509,10 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, ...@@ -1522,14 +1509,10 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
} }
// Define primary keys // Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r+b) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ {
if(equalForAttr(pOp, a, r+b) != 0){ closeTransaction(pNdb);
ERR(pTrans->getNdbError()); return NDBT_FAILED;
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
} }
// Define attributes to read // Define attributes to read
...@@ -1663,14 +1646,10 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, ...@@ -1663,14 +1646,10 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
} }
// Define primary keys // Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){ if (equalForRow(pOp, r+b) != 0)
if (tab.getColumn(a)->getPrimaryKey() == true){ {
if(equalForAttr(pOp, a, r+b) != 0){ closeTransaction(pNdb);
ERR(pTrans->getNdbError()); return NDBT_FAILED;
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
} }
// Define attributes to read // Define attributes to read
...@@ -1733,16 +1712,13 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, ...@@ -1733,16 +1712,13 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
if(!ordered){ if(!ordered)
for(a = 0; a<tab.getNoOfColumns(); a++){ {
if (tab.getColumn(a)->getPrimaryKey() == true){ if (equalForRow(pOp, r+b) != 0)
if(equalForAttr(pUpdOp, a, r+b) != 0){ {
ERR(pTrans->getNdbError()); closeTransaction(pNdb);
closeTransaction(pNdb); return NDBT_FAILED;
return NDBT_FAILED; }
}
}
}
} }
for(a = 0; a<tab.getNoOfColumns(); a++){ for(a = 0; a<tab.getNoOfColumns(); a++){
......
...@@ -630,8 +630,8 @@ int restartNFDuringNR(NdbRestarter& _restarter, ...@@ -630,8 +630,8 @@ int restartNFDuringNR(NdbRestarter& _restarter,
int nodeId = _restarter.getDbNodeId(randomId); int nodeId = _restarter.getDbNodeId(randomId);
int error = NFDuringNR_codes[i]; int error = NFDuringNR_codes[i];
g_info << _restart->m_name << ": node = " << nodeId g_err << _restart->m_name << ": node = " << nodeId
<< " error code = " << error << endl; << " error code = " << error << endl;
CHECK(_restarter.restartOneDbNode(nodeId, false, true, true) == 0, CHECK(_restarter.restartOneDbNode(nodeId, false, true, true) == 0,
"Could not restart node "<< nodeId); "Could not restart node "<< nodeId);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc listen_event rep_latency ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc listen_event rep_latency eventlog
# transproxy # transproxy
...@@ -33,6 +33,7 @@ copy_tab_SOURCES = copy_tab.cpp ...@@ -33,6 +33,7 @@ copy_tab_SOURCES = copy_tab.cpp
create_index_SOURCES = create_index.cpp create_index_SOURCES = create_index.cpp
ndb_cpcc_SOURCES = cpcc.cpp ndb_cpcc_SOURCES = cpcc.cpp
listen_event_SOURCES = listen.cpp listen_event_SOURCES = listen.cpp
eventlog_SOURCES = log_listner.cpp
rep_latency_SOURCES = rep_latency.cpp rep_latency_SOURCES = rep_latency.cpp
include $(top_srcdir)/storage/ndb/config/common.mk.am include $(top_srcdir)/storage/ndb/config/common.mk.am
......
#include <mgmapi.h>
#include <ndb_global.h>
#include <ndb_opts.h>
#include <NDBT.hpp>
NDB_STD_OPTS_VARS;
static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_logevent_listen"),
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void usage()
{
char desc[] =
"tabname\n"\
"This program list all properties of table(s) in NDB Cluster.\n"\
" ex: desc T1 T2 T4\n";
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP,
15, NDB_MGM_EVENT_CATEGORY_CONNECTION,
15, NDB_MGM_EVENT_CATEGORY_NODE_RESTART,
15, NDB_MGM_EVENT_CATEGORY_STARTUP,
15, NDB_MGM_EVENT_CATEGORY_SHUTDOWN,
15, NDB_MGM_EVENT_CATEGORY_STATISTIC,
15, NDB_MGM_EVENT_CATEGORY_ERROR,
15, NDB_MGM_EVENT_CATEGORY_CHECKPOINT,
15, NDB_MGM_EVENT_CATEGORY_CONGESTION,
0 };
int
main(int argc, char** argv)
{
NDB_INIT(argv[0]);
const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv);
int ho_error;
#ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_desc.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS);
NdbMgmHandle handle= ndb_mgm_create_handle();
ndb_mgm_set_connectstring(handle, opt_connect_str);
while (true)
{
if (ndb_mgm_connect(handle,0,0,0) == -1)
{
ndbout_c("Failed to connect");
exit(0);
}
NdbLogEventHandle le = ndb_mgm_create_logevent_handle(handle, filter);
if (le == 0)
{
ndbout_c("Failed to create logevent handle");
exit(0);
}
struct ndb_logevent event;
while (true)
{
int r= ndb_logevent_get_next(le, &event,5000);
if (r < 0)
{
ndbout_c("Error while getting next event");
break;
}
if (r == 0)
{
continue;
}
ndbout_c("Got event: %d", event.type);
}
ndb_mgm_destroy_logevent_handle(&le);
ndb_mgm_disconnect(handle);
}
return 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