Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-telco-gca

into  perch.ndb.mysql.com:/home/jonas/src/51-telco-gca
This commit is contained in:
jonas@perch.ndb.mysql.com 2007-04-25 18:02:40 +02:00
commit 7b215a5762
34 changed files with 611 additions and 215 deletions

View file

@ -440,6 +440,13 @@ insert into t1 values(7,'x');
insert into t1 values(8,'x');
delete from t1 where a = 0;
commit;
delete from t1;
begin;
insert into t1 values (1, 'x');
select * from t1;
a b
1 x
rollback;
set autocommit = 1;
drop table t1;
create table test.t1 (f1 varchar(50) primary key, f2 text,f3 int)

View file

@ -24,6 +24,33 @@ nid nom prenom
select * from t1 order by nid;
nid nom prenom
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;
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL,

View file

@ -367,8 +367,16 @@ insert into t1 values(7,'x');
insert into t1 values(8,'x');
delete from t1 where a = 0;
commit;
delete from t1;
begin;
insert into t1 values (1, 'x');
select * from t1;
rollback;
set autocommit = 1;
drop table t1;
#############################
# Customer posted order by test case

View file

@ -35,6 +35,37 @@ select * from t1 order by nid;
# Bug #11087 would have row with nid 2 missing
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
DROP table t1;

View file

@ -46,6 +46,8 @@ public:
STATIC_CONST( ROW_GCI = 0xFFF5 );
STATIC_CONST( FRAGMENT_VARSIZED_MEMORY = 0xFFF4 );
STATIC_CONST( COPY_ROWID = 0xFFF1 );
// NOTE: in 5.1 ctors and init take size in bytes
/** Initialize AttributeHeader at location aHeaderPtr */

View file

@ -67,6 +67,7 @@ private:
enum ErrorCode
{
ZNODE_ALREADY_STARTING_ERROR = 305,
ZNODE_START_DISALLOWED_ERROR = 309,
InitialStartRequired = 320
};
};

View file

@ -119,7 +119,8 @@ struct SubStartRef {
Undefined = 1,
NF_FakeErrorREF = 11,
Busy = 701,
NotMaster = 702
NotMaster = 702,
PartiallyConnected = 1421
};
STATIC_CONST( SignalLength = 7 );

View file

@ -534,6 +534,7 @@ public:
static const Column * RECORDS_IN_RANGE;
static const Column * ROWID;
static const Column * ROW_GCI;
static const Column * COPY_ROWID;
int getSizeInBytes() const;
#endif

View file

@ -6,7 +6,7 @@ Next DBTUP 4029
Next DBLQH 5045
Next DBDICT 6007
Next DBDIH 7183
Next DBTC 8039
Next DBTC 8040
Next CMVMI 9000
Next BACKUP 10038
Next DBUTIL 11002
@ -327,6 +327,8 @@ Test Crashes in handling node restarts
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
7175: Master sends one fake START_PERMREF (ZNODE_ALREADY_STARTING_ERROR)
7176: Slave NR pretends master does not support DICT lock (rolling upgrade)

View file

@ -74,7 +74,6 @@
#define ZWRONG_FAILURE_NUMBER_ERROR 302
#define ZWRONG_START_NODE_ERROR 303
#define ZNO_REPLICA_FOUND_ERROR 304
#define ZNODE_START_DISALLOWED_ERROR 309
// --------------------------------------
// Codes from LQH
@ -1643,6 +1642,8 @@ private:
// NR
Uint32 c_dictLockSlavePtrI_nodeRestart; // userPtr for NR
void recvDictLockConf_nodeRestart(Signal* signal, Uint32 data, Uint32 ret);
Uint32 c_error_7181_ref;
};
#if (DIH_CDATA_SIZE < _SYSFILE_SIZE32)

View file

@ -1709,7 +1709,8 @@ void Dbdih::execSTART_PERMREF(Signal* signal)
{
jamEntry();
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();
/*-----------------------------------------------------------------------*/
// The master was busy adding another node. We will wait for a second and
@ -2056,49 +2057,45 @@ void Dbdih::execINCL_NODECONF(Signal* signal)
TstartNode_or_blockref = signal->theData[0];
TsendNodeId = signal->theData[1];
if (TstartNode_or_blockref == clocallqhblockref) {
jam();
/*-----------------------------------------------------------------------*/
// THIS SIGNAL CAME FROM THE LOCAL LQH BLOCK.
// WE WILL NOW SEND INCLUDE TO THE TC BLOCK.
/*-----------------------------------------------------------------------*/
signal->theData[0] = reference();
signal->theData[1] = c_nodeStartSlave.nodeId;
sendSignal(clocaltcblockref, GSN_INCL_NODEREQ, signal, 2, JBB);
return;
}//if
if (TstartNode_or_blockref == clocaltcblockref) {
jam();
/*----------------------------------------------------------------------*/
// THIS SIGNAL CAME FROM THE LOCAL LQH BLOCK.
// WE WILL NOW SEND INCLUDE TO THE DICT BLOCK.
/*----------------------------------------------------------------------*/
signal->theData[0] = reference();
signal->theData[1] = c_nodeStartSlave.nodeId;
sendSignal(cdictblockref, GSN_INCL_NODEREQ, signal, 2, JBB);
return;
}//if
if (TstartNode_or_blockref == cdictblockref) {
jam();
/*-----------------------------------------------------------------------*/
// THIS SIGNAL CAME FROM THE LOCAL DICT BLOCK. WE WILL NOW SEND CONF TO THE
// BACKUP.
/*-----------------------------------------------------------------------*/
signal->theData[0] = reference();
signal->theData[1] = c_nodeStartSlave.nodeId;
sendSignal(BACKUP_REF, GSN_INCL_NODEREQ, signal, 2, JBB);
// Suma will not send response to this for now, later...
sendSignal(SUMA_REF, GSN_INCL_NODEREQ, signal, 2, JBB);
return;
}//if
if (TstartNode_or_blockref == numberToRef(BACKUP, getOwnNodeId())){
jam();
signal->theData[0] = c_nodeStartSlave.nodeId;
signal->theData[1] = cownNodeId;
sendSignal(cmasterdihref, GSN_INCL_NODECONF, signal, 2, JBB);
c_nodeStartSlave.nodeId = 0;
return;
Uint32 blocklist[6];
blocklist[0] = clocallqhblockref;
blocklist[1] = clocaltcblockref;
blocklist[2] = cdictblockref;
blocklist[3] = numberToRef(BACKUP, getOwnNodeId());
blocklist[4] = numberToRef(SUMA, getOwnNodeId());
blocklist[5] = 0;
for (Uint32 i = 0; blocklist[i] != 0; i++)
{
if (TstartNode_or_blockref == blocklist[i])
{
jam();
if (getNodeStatus(c_nodeStartSlave.nodeId) == NodeRecord::ALIVE &&
blocklist[i+1] != 0)
{
/**
* Send to next in block list
*/
jam();
signal->theData[0] = reference();
signal->theData[1] = c_nodeStartSlave.nodeId;
sendSignal(blocklist[i+1], GSN_INCL_NODEREQ, signal, 2, JBB);
return;
}
else
{
/**
* All done, reply to master
*/
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());
@ -2217,7 +2214,7 @@ void Dbdih::execSTART_INFOREQ(Signal* signal)
StartInfoRef *const ref =(StartInfoRef*)&signal->theData[0];
ref->startingNodeId = startNode;
ref->sendingNodeId = cownNodeId;
ref->errorCode = ZNODE_START_DISALLOWED_ERROR;
ref->errorCode = StartPermRef::ZNODE_START_DISALLOWED_ERROR;
sendSignal(cmasterdihref, GSN_START_INFOREF, signal,
StartInfoRef::SignalLength, JBB);
return;
@ -5033,6 +5030,7 @@ void Dbdih::execMASTER_GCPREQ(Signal* signal)
{
ndbout_c("execGCP_TCFINISHED in MASTER_GCPREQ");
CLEAR_ERROR_INSERT_VALUE;
signal->theData[0] = c_error_7181_ref;
signal->theData[1] = coldgcp;
execGCP_TCFINISHED(signal);
}
@ -5108,6 +5106,7 @@ void Dbdih::execMASTER_GCPREQ(Signal* signal)
{
ndbout_c("execGCP_TCFINISHED in MASTER_GCPREQ");
CLEAR_ERROR_INSERT_VALUE;
signal->theData[0] = c_error_7181_ref;
signal->theData[1] = coldgcp;
execGCP_TCFINISHED(signal);
}
@ -8010,6 +8009,7 @@ void Dbdih::execGCP_COMMIT(Signal* signal)
cgckptflag = false;
emptyverificbuffer(signal, true);
cgcpParticipantState = GCP_PARTICIPANT_COMMIT_RECEIVED;
signal->theData[0] = calcDihBlockRef(masterNodeId);
signal->theData[1] = coldgcp;
sendSignal(clocaltcblockref, GSN_GCP_NOMORETRANS, signal, 2, JBB);
return;
@ -8019,11 +8019,13 @@ void Dbdih::execGCP_TCFINISHED(Signal* signal)
{
jamEntry();
CRASH_INSERTION(7007);
Uint32 retRef = signal->theData[0];
Uint32 gci = signal->theData[1];
ndbrequire(gci == coldgcp);
if (ERROR_INSERTED(7181) || ERROR_INSERTED(7182))
{
c_error_7181_ref = retRef; // Save ref
ndbout_c("killing %d", refToNode(cmasterdihref));
signal->theData[0] = 9999;
sendSignal(numberToRef(CMVMI, refToNode(cmasterdihref)),
@ -8035,7 +8037,7 @@ void Dbdih::execGCP_TCFINISHED(Signal* signal)
signal->theData[0] = cownNodeId;
signal->theData[1] = coldgcp;
signal->theData[2] = cfailurenr;
sendSignal(cmasterdihref, GSN_GCP_NODEFINISH, signal, 3, JBB);
sendSignal(retRef, GSN_GCP_NODEFINISH, signal, 3, JBB);
}//Dbdih::execGCP_TCFINISHED()
/*****************************************************************************/

View file

@ -1952,5 +1952,8 @@ private:
// those variables should be removed and exchanged for stack
// variable communication.
/**************************************************************************/
Uint32 c_gcp_ref;
};
#endif

View file

@ -311,6 +311,19 @@ void Dbtc::execINCL_NODEREQ(Signal* signal)
hostptr.p->hostStatus = HS_ALIVE;
signal->theData[0] = cownref;
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);
}
@ -6880,6 +6893,7 @@ void Dbtc::timeOutFoundFragLab(Signal* signal, UintR TscanConPtr)
void Dbtc::execGCP_NOMORETRANS(Signal* signal)
{
jamEntry();
c_gcp_ref = signal->theData[0];
tcheckGcpId = signal->theData[1];
if (cfirstgcp != RNIL) {
jam();
@ -9916,6 +9930,7 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) {
void Dbtc::gcpTcfinished(Signal* signal)
{
signal->theData[0] = c_gcp_ref;
signal->theData[1] = tcheckGcpId;
sendSignal(cdihblockref, GSN_GCP_TCFINISHED, signal, 2, JBB);
}//Dbtc::gcpTcfinished()

View file

@ -107,8 +107,7 @@ void Dbtup::removeActiveOpList(Operationrec* const regOperPtr,
/**
* Release copy tuple
*/
if(regOperPtr->op_struct.op_type != ZDELETE &&
!regOperPtr->m_copy_tuple_location.isNull())
if(!regOperPtr->m_copy_tuple_location.isNull())
c_undo_buffer.free_copy_tuple(&regOperPtr->m_copy_tuple_location);
if (regOperPtr->op_struct.in_active_list) {

View file

@ -486,6 +486,13 @@ Uint32 Dbtup::leafPageRangeFull(Fragrecord* const regFragPtr, PageRangePtr curr
ptrCheckGuard(parentPageRangePtr, cnoOfPageRangeRec, pageRange);
if (parentPageRangePtr.p->currentIndexPos < 3) {
ljam();
if (c_noOfFreePageRanges < tiprNoLevels)
{
ljam();
return RNIL;
}//if
/* ---------------------------------------------------------------- */
/* WE HAVE FOUND AN EMPTY ENTRY IN A PAGE RANGE RECORD. */
/* ALLOCATE A NEW PAGE RANGE RECORD, FILL IN THE START RANGE, */

View file

@ -1198,6 +1198,10 @@ Dbtup::read_pseudo(Uint32 attrId,
return 2;
}
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:
return 0;
}

View file

@ -61,11 +61,15 @@ Dbtup::execACC_SCANREQ(Signal* signal)
jam();
break;
}
#if BUG_27776_FIXED
if (!AccScanReq::getNoDiskScanFlag(req->requestInfo)
&& tablePtr.p->m_no_of_disk_attributes)
{
bits |= ScanOp::SCAN_DD;
}
#endif
bool mm = (bits & ScanOp::SCAN_DD);
if (tablePtr.p->m_attributes[mm].m_no_of_varsize > 0) {
bits |= ScanOp::SCAN_VS;
@ -593,7 +597,6 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr)
const bool mm = (bits & ScanOp::SCAN_DD);
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 size = table.m_offsets[mm].m_fix_header_size +
@ -764,8 +767,7 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr)
jam();
if (! (thbits & Tuple_header::FREE))
{
if (! ((thbits & Tuple_header::ALLOC) && dirty))
goto found_tuple;
goto found_tuple;
}
}
else

View file

@ -813,17 +813,14 @@ void
Suma::execINCL_NODEREQ(Signal* signal){
jamEntry();
//const Uint32 senderRef = signal->theData[0];
const Uint32 senderRef = signal->theData[0];
const Uint32 nodeId = signal->theData[1];
ndbrequire(!c_alive_nodes.get(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();
sendSignal(senderRef, GSN_INCL_NODECONF, signal, 1, JBB);
#endif
}
void
@ -953,6 +950,15 @@ Suma::execDUMP_STATE_ORD(Signal* signal){
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 (ERROR_INSERTED(13030))
@ -2388,6 +2394,16 @@ Suma::execSUB_START_REQ(Signal* signal){
sendSubStartRef(signal, 1412);
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",
c_subscriberPool.getSize(),
c_subscriberPool.getNoOfFree()));

View file

@ -669,7 +669,7 @@ InitConfigFileParser::store_in_properties(Vector<struct my_option>& options,
if (options[i].var_type == GET_INT)
ctx.m_currentSection->put(options[i].name, (Uint32)value_int);
else
ctx.m_currentSection->put(options[i].name, value_int);
ctx.m_currentSection->put64(options[i].name, value_int);
}
}
return true;

View file

@ -378,6 +378,11 @@ NdbColumnImpl::create_pseudo(const char * name){
col->m_impl.m_attrSize = 8;
col->m_impl.m_arraySize = 1;
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 {
abort();
}
@ -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::ROWID = 0;
const NdbDictionary::Column * NdbDictionary::Column::ROW_GCI = 0;
const NdbDictionary::Column * NdbDictionary::Column::COPY_ROWID = 0;

View file

@ -979,7 +979,7 @@ NdbEventOperationImpl::printAll()
NdbEventBuffer::NdbEventBuffer(Ndb *ndb) :
m_system_nodes(ndb->theImpl->theNoOfDBnodes),
m_ndb(ndb),
m_latestGCI(0),
m_latestGCI(0), m_latest_complete_GCI(0),
m_total_alloc(0),
m_free_thresh(10),
m_min_free_thresh(10),
@ -1470,7 +1470,7 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep)
, m_flush_gci
#endif
);
Uint32 idx = bucket - (Gci_container*)m_active_gci.getBase();
if (unlikely(bucket == 0))
{
/**
@ -1515,8 +1515,20 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep)
}
reportStatus();
bzero(bucket, sizeof(Gci_container));
bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE;
bucket->m_gcp_complete_rep_count = m_system_nodes;
if (likely(idx < ACTIVE_GCI_DIRECTORY_SIZE))
{
/**
* 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))
{
complete_outof_order_gcis();

View file

@ -326,6 +326,8 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
NdbColumnImpl::create_pseudo("NDB$ROWID");
NdbDictionary::Column::ROW_GCI=
NdbColumnImpl::create_pseudo("NDB$ROW_GCI");
NdbDictionary::Column::COPY_ROWID=
NdbColumnImpl::create_pseudo("NDB$COPY_ROWID");
}
NdbMutex_Unlock(g_ndb_connection_mutex);
@ -391,6 +393,9 @@ Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
NdbDictionary::Column::RECORDS_IN_RANGE= 0;
NdbDictionary::Column::ROWID= 0;
NdbDictionary::Column::ROW_GCI= 0;
delete NdbDictionary::Column::COPY_ROWID;
NdbDictionary::Column::COPY_ROWID = 0;
}
NdbMutex_Unlock(g_ndb_connection_mutex);

View file

@ -490,6 +490,7 @@ ErrorBundle ErrorCodes[] = {
{ 1419, DMEC, SE, "Subscription already dropped" },
{ 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" },

View file

@ -83,6 +83,8 @@ public:
int equalForAttr(NdbOperation*,
int attrId,
int rowId);
int equalForRow(NdbOperation*, int rowid);
int setValues(NdbOperation*, int rowId, int updateId);

View file

@ -27,15 +27,34 @@ public:
int getDbNodeId(int _i);
enum RestartFlags {
NRRF_INITIAL = 0x1,
NRRF_NOSTART = 0x2,
NRRF_ABORT = 0x4
};
int restartOneDbNode(int _nodeId,
bool initial = false,
bool nostart = 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,
bool nostart = false,
bool abort = false);
int restartAll2(Uint32 flags){
return restartAll(flags & NRRF_INITIAL,
flags & NRRF_NOSTART,
flags & NRRF_ABORT);
}
int startAll();
int startNodes(const int * _nodes, int _num_nodes);
int waitClusterStarted(unsigned int _timeout = 120);

View file

@ -1272,6 +1272,64 @@ runBug25090(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
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);
TESTCASE("PkInsert",
"Verify that we can insert and delete from this table using PK"
@ -1542,6 +1600,10 @@ TESTCASE("Bug25090",
"Verify what happens when we fill the db" ){
STEP(runBug25090);
}
TESTCASE("Bug27756",
"Verify what happens when we fill the db" ){
STEP(runBug27756);
}
NDBT_TESTSUITE_END(testBasic);
#if 0

View file

@ -1364,7 +1364,7 @@ runBug27003(NDBT_Context* ctx, NDBT_Step* step)
return NDBT_FAILED;
res.startNodes(&node, 1);
res.waitNodesStartPhase(&node, 1, 2);
NdbSleep_SecSleep(3);
pos++;
}
pos = 0;
@ -1423,6 +1423,122 @@ runBug27283(NDBT_Context* ctx, NDBT_Step* step)
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);
TESTCASE("NoLoad",
"Test that one node at a time can be stopped and then restarted "\
@ -1774,6 +1890,12 @@ TESTCASE("Bug27003", ""){
TESTCASE("Bug27283", ""){
INITIALIZER(runBug27283);
}
TESTCASE("Bug27466", ""){
INITIALIZER(runBug27466);
}
TESTCASE("Bug28023", ""){
INITIALIZER(runBug28023);
}
NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){

View file

@ -235,6 +235,10 @@ max-time: 500
cmd: testBasic
args: -n Bug25090 T1
max-time: 1000
cmd: testBasic
args: -n Bug27756
max-time: 500
cmd: testIndex
args: -n Bug25059 -r 3000 T1
@ -469,6 +473,10 @@ max-time: 1000
cmd: testNodeRestart
args: -n Bug27283 T1
max-time: 1000
cmd: testNodeRestart
args: -n Bug28023 T7 D2
max-time: 500
cmd: testScan
args: -n ScanVariants
@ -792,6 +800,10 @@ max-time: 1000
cmd: testNodeRestart
args: -n Bug25468 T1
max-time: 1000
cmd: testNodeRestart
args: -n Bug27466 T1
max-time: 1000
cmd: test_event
args: -l 10 -n Bug27169 T1

View file

@ -188,14 +188,11 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb,
// Read
// Define primary keys
check = pOp->readTupleExclusive();
for (a = 0; a < tab.getNoOfColumns(); a++) {
if (tab.getColumn(a)->getPrimaryKey() == true) {
if (equalForAttr(pOp, a, cReadRecords) != 0){
ERR(transactions[t]->getNdbError());
pNdb->closeTransaction(transactions[t]);
return NDBT_FAILED;
}
}
if (equalForRow(pOp, cReadRecords) != 0)
{
ERR(transactions[t]->getNdbError());
pNdb->closeTransaction(transactions[t]);
return NDBT_FAILED;
}
// Define attributes to read
for (a = 0; a < tab.getNoOfColumns(); a++) {
@ -259,15 +256,12 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb,
}
// Set search condition for the record
for (a = 0; a < tab.getNoOfColumns(); a++) {
if (tab.getColumn(a)->getPrimaryKey() == true) {
if (equalForAttr(pOp, a, cRecords) != 0) {
ERR(transactions[t]->getNdbError());
pNdb->closeTransaction(transactions[t]);
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, cReadRecords) != 0)
{
ERR(transactions[t]->getNdbError());
pNdb->closeTransaction(transactions[t]);
return NDBT_FAILED;
}
// Update the record
for (a = 0; a < tab.getNoOfColumns(); a++) {
@ -396,15 +390,12 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb,
case NO_READ:
// Define primary keys
check = pOp->readTuple();
for (a = 0; a < tab.getNoOfColumns(); a++) {
if (tab.getColumn(a)->getPrimaryKey() == true) {
if (equalForAttr(pOp, a, cRecords) != 0){
ERR(transactions[t]->getNdbError());
pNdb->closeTransaction(transactions[t]);
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, cRecords) != 0)
{
ERR(transactions[t]->getNdbError());
pNdb->closeTransaction(transactions[t]);
return NDBT_FAILED;
}
// Define attributes to read
for (a = 0; a < tab.getNoOfColumns(); a++) {
if ((rows[cIndex]->attributeStore(a) =
@ -425,15 +416,12 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb,
}
// Define primary keys
for (a = 0; a < tab.getNoOfColumns(); a++) {
if (tab.getColumn(a)->getPrimaryKey() == true){
if (equalForAttr(pOp, a, cRecords) != 0) {
ERR(transactions[t]->getNdbError());
pNdb->closeTransaction(transactions[t]);
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, cRecords) != 0)
{
ERR(transactions[t]->getNdbError());
pNdb->closeTransaction(transactions[t]);
return NDBT_FAILED;
}
break;
default:
// Should not happen...

View file

@ -111,14 +111,8 @@ rand_lock_mode:
}
// Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, r+recordNo) != 0)
return NDBT_FAILED;
if(pIndexScanOp)
pIndexScanOp->end_of_bound(r);
@ -143,7 +137,6 @@ int HugoOperations::pkUpdateRecord(Ndb* pNdb,
int recordNo,
int numRecords,
int updatesValue){
int a;
allocRows(numRecords);
int check;
for(int r=0; r < numRecords; r++){
@ -172,14 +165,8 @@ HugoOperations::setValues(NdbOperation* pOp, int rowId, int updateId)
{
// Define primary keys
int a;
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, rowId) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, rowId) != 0)
return NDBT_FAILED;
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == false){
@ -198,7 +185,7 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb,
int numRecords,
int updatesValue){
int a, check;
int check;
for(int r=0; r < numRecords; r++){
NdbOperation* pOp = getOperation(pTrans, NdbOperation::InsertRequest);
if (pOp == NULL) {
@ -240,14 +227,8 @@ int HugoOperations::pkWriteRecord(Ndb* pNdb,
}
// Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, r+recordNo) != 0)
return NDBT_FAILED;
// Define attributes to update
for(a = 0; a<tab.getNoOfColumns(); a++){
@ -266,7 +247,7 @@ int HugoOperations::pkWritePartialRecord(Ndb* pNdb,
int recordNo,
int numRecords){
int a, check;
int check;
for(int r=0; r < numRecords; r++){
NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
if (pOp == NULL) {
@ -281,14 +262,8 @@ int HugoOperations::pkWritePartialRecord(Ndb* pNdb,
}
// Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, r+recordNo) != 0)
return NDBT_FAILED;
}
return NDBT_OK;
}
@ -297,7 +272,7 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb,
int recordNo,
int numRecords){
int a, check;
int check;
for(int r=0; r < numRecords; r++){
NdbOperation* pOp = getOperation(pTrans, NdbOperation::DeleteRequest);
if (pOp == NULL) {
@ -312,14 +287,8 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb,
}
// Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, r+recordNo) != 0)
return NDBT_FAILED;
}
return NDBT_OK;
}
@ -518,6 +487,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 attrId,
@ -676,14 +661,8 @@ int HugoOperations::indexReadRecords(Ndb*, const char * idxName, int recordNo,
}
// Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, r+recordNo) != 0)
return NDBT_FAILED;
// Define attributes to read
for(a = 0; a<tab.getNoOfColumns(); a++){
@ -720,14 +699,8 @@ HugoOperations::indexUpdateRecord(Ndb*,
}
// Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+recordNo) != 0){
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
}
if (equalForRow(pOp, r+recordNo) != 0)
return NDBT_FAILED;
// Define attributes to update
for(a = 0; a<tab.getNoOfColumns(); a++){

View file

@ -520,10 +520,9 @@ HugoTransactions::loadTable(Ndb* pNdb,
bool oneTrans,
int value,
bool abort){
int check, a;
int check;
int retryAttempt = 0;
int retryMax = 5;
NdbOperation *pOp;
bool first_batch = true;
const int org = batch;
@ -667,10 +666,9 @@ HugoTransactions::loadTable(Ndb* pNdb,
int
HugoTransactions::fillTable(Ndb* pNdb,
int batch){
int check, a, b;
int check;
int retryAttempt = 0;
int retryMax = 5;
NdbOperation *pOp;
const int org = batch;
const int cols = tab.getNoOfColumns();
@ -791,7 +789,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
int reads = 0;
int r = 0;
int retryAttempt = 0;
int check, a;
int check;
if (batch == 0) {
g_info << "ERROR: Argument batch == 0 in pkReadRecords(). Not allowed." << endl;
@ -910,8 +908,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
int updated = 0;
int r = 0;
int retryAttempt = 0;
int check, a, b;
NdbOperation *pOp;
int check, b;
allocRows(batch);
@ -1097,14 +1094,10 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
}
// Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r) != 0){
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
if (equalForRow(pOp, r) != 0)
{
closeTransaction(pNdb);
return NDBT_FAILED;
}
// Read update value
@ -1153,14 +1146,10 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
}
// PKs
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pUpdOp, a, r) != 0){
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
if (equalForRow(pOp, r) != 0)
{
closeTransaction(pNdb);
return NDBT_FAILED;
}
// Update col
@ -1236,8 +1225,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb,
int deleted = 0;
int r = 0;
int retryAttempt = 0;
int check, a;
NdbOperation *pOp;
int check;
g_info << "|- Deleting records..." << endl;
while (r < records){
@ -1335,8 +1323,7 @@ HugoTransactions::lockRecords(Ndb* pNdb,
// and lock som other records
int r = 0;
int retryAttempt = 0;
int check, a, b;
NdbOperation *pOp;
int check;
NdbOperation::LockMode lm = NdbOperation::LM_Exclusive;
// Calculate how many records to lock in each batch
@ -1522,14 +1509,10 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
}
// Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+b) != 0){
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
if (equalForRow(pOp, r+b) != 0)
{
closeTransaction(pNdb);
return NDBT_FAILED;
}
// Define attributes to read
@ -1663,14 +1646,10 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
}
// Define primary keys
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+b) != 0){
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
if (equalForRow(pOp, r+b) != 0)
{
closeTransaction(pNdb);
return NDBT_FAILED;
}
// Define attributes to read
@ -1733,16 +1712,13 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
return NDBT_FAILED;
}
if(!ordered){
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pUpdOp, a, r+b) != 0){
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
}
if(!ordered)
{
if (equalForRow(pOp, r+b) != 0)
{
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
for(a = 0; a<tab.getNoOfColumns(); a++){

View file

@ -630,8 +630,8 @@ int restartNFDuringNR(NdbRestarter& _restarter,
int nodeId = _restarter.getDbNodeId(randomId);
int error = NFDuringNR_codes[i];
g_info << _restart->m_name << ": node = " << nodeId
<< " error code = " << error << endl;
g_err << _restart->m_name << ": node = " << nodeId
<< " error code = " << error << endl;
CHECK(_restarter.restartOneDbNode(nodeId, false, true, true) == 0,
"Could not restart node "<< nodeId);

View file

@ -13,7 +13,7 @@
# along with this program; if not, write to the Free Software
# 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
@ -33,6 +33,7 @@ copy_tab_SOURCES = copy_tab.cpp
create_index_SOURCES = create_index.cpp
ndb_cpcc_SOURCES = cpcc.cpp
listen_event_SOURCES = listen.cpp
eventlog_SOURCES = log_listner.cpp
rep_latency_SOURCES = rep_latency.cpp
include $(top_srcdir)/storage/ndb/config/common.mk.am

View file

@ -0,0 +1,88 @@
#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;
}