summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorunknown <knielsen@ymer.(none)>2007-04-25 20:45:48 +0200
committerunknown <knielsen@ymer.(none)>2007-04-25 20:45:48 +0200
commita8fef66872555438921935ed783629a176505655 (patch)
tree6d3f857ff7e4a3ae97f3df9111e28e56ea2c0aec /storage
parent88a10dbaf3ee2d18bde586868863f8347275f552 (diff)
parent7f48dfa007aed3d45c987fa16739044d297bbe25 (diff)
downloadmariadb-git-a8fef66872555438921935ed783629a176505655.tar.gz
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
Diffstat (limited to 'storage')
-rw-r--r--storage/ndb/include/kernel/AttributeHeader.hpp2
-rw-r--r--storage/ndb/include/kernel/signaldata/StartPerm.hpp1
-rw-r--r--storage/ndb/include/kernel/signaldata/SumaImpl.hpp3
-rw-r--r--storage/ndb/include/ndbapi/NdbDictionary.hpp1
-rw-r--r--storage/ndb/src/kernel/blocks/ERROR_codes.txt4
-rw-r--r--storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp3
-rw-r--r--storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp94
-rw-r--r--storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp3
-rw-r--r--storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp15
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp3
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp7
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp4
-rw-r--r--storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp8
-rw-r--r--storage/ndb/src/kernel/blocks/suma/Suma.cpp24
-rw-r--r--storage/ndb/src/mgmsrv/InitConfigFileParser.cpp2
-rw-r--r--storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp6
-rw-r--r--storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp20
-rw-r--r--storage/ndb/src/ndbapi/ndb_cluster_connection.cpp5
-rw-r--r--storage/ndb/src/ndbapi/ndberror.c1
-rw-r--r--storage/ndb/test/include/HugoOperations.hpp2
-rw-r--r--storage/ndb/test/include/NdbRestarter.hpp19
-rw-r--r--storage/ndb/test/ndbapi/testBasic.cpp62
-rw-r--r--storage/ndb/test/ndbapi/testNodeRestart.cpp124
-rw-r--r--storage/ndb/test/run-test/daily-basic-tests.txt12
-rw-r--r--storage/ndb/test/src/HugoAsynchTransactions.cpp58
-rw-r--r--storage/ndb/test/src/HugoOperations.cpp93
-rw-r--r--storage/ndb/test/src/HugoTransactions.cpp82
-rw-r--r--storage/ndb/test/src/NdbRestarts.cpp4
-rw-r--r--storage/ndb/test/tools/Makefile.am3
-rw-r--r--storage/ndb/test/tools/log_listner.cpp88
30 files changed, 538 insertions, 215 deletions
diff --git a/storage/ndb/include/kernel/AttributeHeader.hpp b/storage/ndb/include/kernel/AttributeHeader.hpp
index ad2ca582914..a8b811e4efa 100644
--- a/storage/ndb/include/kernel/AttributeHeader.hpp
+++ b/storage/ndb/include/kernel/AttributeHeader.hpp
@@ -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 */
diff --git a/storage/ndb/include/kernel/signaldata/StartPerm.hpp b/storage/ndb/include/kernel/signaldata/StartPerm.hpp
index ffb16bfec9d..16229f6552f 100644
--- a/storage/ndb/include/kernel/signaldata/StartPerm.hpp
+++ b/storage/ndb/include/kernel/signaldata/StartPerm.hpp
@@ -67,6 +67,7 @@ private:
enum ErrorCode
{
ZNODE_ALREADY_STARTING_ERROR = 305,
+ ZNODE_START_DISALLOWED_ERROR = 309,
InitialStartRequired = 320
};
};
diff --git a/storage/ndb/include/kernel/signaldata/SumaImpl.hpp b/storage/ndb/include/kernel/signaldata/SumaImpl.hpp
index 077ea8e879c..072c3955ac4 100644
--- a/storage/ndb/include/kernel/signaldata/SumaImpl.hpp
+++ b/storage/ndb/include/kernel/signaldata/SumaImpl.hpp
@@ -119,7 +119,8 @@ struct SubStartRef {
Undefined = 1,
NF_FakeErrorREF = 11,
Busy = 701,
- NotMaster = 702
+ NotMaster = 702,
+ PartiallyConnected = 1421
};
STATIC_CONST( SignalLength = 7 );
diff --git a/storage/ndb/include/ndbapi/NdbDictionary.hpp b/storage/ndb/include/ndbapi/NdbDictionary.hpp
index aada314e454..0687733df03 100644
--- a/storage/ndb/include/ndbapi/NdbDictionary.hpp
+++ b/storage/ndb/include/ndbapi/NdbDictionary.hpp
@@ -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
diff --git a/storage/ndb/src/kernel/blocks/ERROR_codes.txt b/storage/ndb/src/kernel/blocks/ERROR_codes.txt
index 8639c1a360a..b3405679978 100644
--- a/storage/ndb/src/kernel/blocks/ERROR_codes.txt
+++ b/storage/ndb/src/kernel/blocks/ERROR_codes.txt
@@ -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)
diff --git a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
index 5144a8726b4..4c060ff4e2b 100644
--- a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
+++ b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
@@ -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)
diff --git a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
index beadb9eb947..76ff0dcc41b 100644
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
@@ -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()
/*****************************************************************************/
diff --git a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
index ad2fa0e1696..203febef3f6 100644
--- a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
+++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
@@ -1952,5 +1952,8 @@ private:
// those variables should be removed and exchanged for stack
// variable communication.
/**************************************************************************/
+
+ Uint32 c_gcp_ref;
};
+
#endif
diff --git a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
index ff8f32bf085..3baad90a5f0 100644
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
@@ -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()
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp
index f218f3beee8..61a88f1f501 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp
@@ -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) {
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp
index 26373708b66..69b9ccc60e4 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp
@@ -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, */
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
index c8546209f94..eb94e2c3473 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
@@ -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;
}
diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp
index 3ccf5e58ab9..04e60edfb2e 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp
@@ -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
diff --git a/storage/ndb/src/kernel/blocks/suma/Suma.cpp b/storage/ndb/src/kernel/blocks/suma/Suma.cpp
index 5ebb075d636..717448ca03b 100644
--- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp
@@ -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()));
diff --git a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
index bf84b6692d1..b8c4bbc590d 100644
--- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
+++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
@@ -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;
diff --git a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index c999c7ed919..76f0cf81823 100644
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -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;
diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
index 3449f3ff1d2..45738a3a65f 100644
--- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
+++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
@@ -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();
diff --git a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
index 0e8a5f54c6e..66e3fe92e81 100644
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
@@ -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);
diff --git a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c
index 13e6c95644c..ed3829ed74f 100644
--- a/storage/ndb/src/ndbapi/ndberror.c
+++ b/storage/ndb/src/ndbapi/ndberror.c
@@ -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" },
diff --git a/storage/ndb/test/include/HugoOperations.hpp b/storage/ndb/test/include/HugoOperations.hpp
index 6126c705471..1f3290e8ce1 100644
--- a/storage/ndb/test/include/HugoOperations.hpp
+++ b/storage/ndb/test/include/HugoOperations.hpp
@@ -84,6 +84,8 @@ public:
int equalForAttr(NdbOperation*,
int attrId,
int rowId);
+
+ int equalForRow(NdbOperation*, int rowid);
int setValues(NdbOperation*, int rowId, int updateId);
diff --git a/storage/ndb/test/include/NdbRestarter.hpp b/storage/ndb/test/include/NdbRestarter.hpp
index 916848adf45..9780c0cd1ae 100644
--- a/storage/ndb/test/include/NdbRestarter.hpp
+++ b/storage/ndb/test/include/NdbRestarter.hpp
@@ -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);
diff --git a/storage/ndb/test/ndbapi/testBasic.cpp b/storage/ndb/test/ndbapi/testBasic.cpp
index 78cf28f5f76..705c18b55c0 100644
--- a/storage/ndb/test/ndbapi/testBasic.cpp
+++ b/storage/ndb/test/ndbapi/testBasic.cpp
@@ -1340,6 +1340,64 @@ runBug28073(NDBT_Context *ctx, NDBT_Step* step)
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);
TESTCASE("PkInsert",
"Verify that we can insert and delete from this table using PK"
@@ -1614,6 +1672,10 @@ TESTCASE("Bug28073",
"Infinite loop in lock queue" ){
STEP(runBug28073);
}
+TESTCASE("Bug27756",
+ "Verify what happens when we fill the db" ){
+ STEP(runBug27756);
+}
NDBT_TESTSUITE_END(testBasic);
#if 0
diff --git a/storage/ndb/test/ndbapi/testNodeRestart.cpp b/storage/ndb/test/ndbapi/testNodeRestart.cpp
index ad9069142ab..fb05681bab4 100644
--- a/storage/ndb/test/ndbapi/testNodeRestart.cpp
+++ b/storage/ndb/test/ndbapi/testNodeRestart.cpp
@@ -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){
diff --git a/storage/ndb/test/run-test/daily-basic-tests.txt b/storage/ndb/test/run-test/daily-basic-tests.txt
index 3141e5e2c24..203ba4145ec 100644
--- a/storage/ndb/test/run-test/daily-basic-tests.txt
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt
@@ -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: testBasic
args: -n Bug28073
@@ -473,6 +477,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
@@ -801,6 +809,10 @@ 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
diff --git a/storage/ndb/test/src/HugoAsynchTransactions.cpp b/storage/ndb/test/src/HugoAsynchTransactions.cpp
index 6926c8a973e..0a5991d9e20 100644
--- a/storage/ndb/test/src/HugoAsynchTransactions.cpp
+++ b/storage/ndb/test/src/HugoAsynchTransactions.cpp
@@ -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...
diff --git a/storage/ndb/test/src/HugoOperations.cpp b/storage/ndb/test/src/HugoOperations.cpp
index be79a9f5701..a8aa52aaf99 100644
--- a/storage/ndb/test/src/HugoOperations.cpp
+++ b/storage/ndb/test/src/HugoOperations.cpp
@@ -113,14 +113,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);
@@ -145,7 +139,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++){
@@ -174,14 +167,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){
@@ -200,7 +187,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) {
@@ -242,14 +229,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++){
@@ -268,7 +249,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) {
@@ -283,14 +264,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;
}
@@ -299,7 +274,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) {
@@ -314,14 +289,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;
}
@@ -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 attrId,
@@ -678,14 +663,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++){
@@ -722,14 +701,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++){
diff --git a/storage/ndb/test/src/HugoTransactions.cpp b/storage/ndb/test/src/HugoTransactions.cpp
index 35c15a497fe..c201e170faf 100644
--- a/storage/ndb/test/src/HugoTransactions.cpp
+++ b/storage/ndb/test/src/HugoTransactions.cpp
@@ -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++){
diff --git a/storage/ndb/test/src/NdbRestarts.cpp b/storage/ndb/test/src/NdbRestarts.cpp
index 013c7a97d1f..6ec520887b5 100644
--- a/storage/ndb/test/src/NdbRestarts.cpp
+++ b/storage/ndb/test/src/NdbRestarts.cpp
@@ -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);
diff --git a/storage/ndb/test/tools/Makefile.am b/storage/ndb/test/tools/Makefile.am
index 3a2bcb5005f..91cc1a4796c 100644
--- a/storage/ndb/test/tools/Makefile.am
+++ b/storage/ndb/test/tools/Makefile.am
@@ -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
diff --git a/storage/ndb/test/tools/log_listner.cpp b/storage/ndb/test/tools/log_listner.cpp
new file mode 100644
index 00000000000..c5125ef7414
--- /dev/null
+++ b/storage/ndb/test/tools/log_listner.cpp
@@ -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;
+}