3024 Jonas Oreland 2008-10-30 [merge]
merge with 64-main
modified:
storage/ndb/include/kernel/RefConvert.hpp
storage/ndb/include/kernel/ndb_limits.h
storage/ndb/include/kernel/signaldata/LqhTransConf.hpp
storage/ndb/include/ndb_global.h.in
storage/ndb/src/kernel/blocks/backup/Backup.hpp
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp
storage/ndb/src/kernel/vm/ArrayPool.hpp
storage/ndb/src/kernel/vm/LongSignal.hpp
storage/ndb/src/kernel/vm/TransporterCallback.cpp
storage/ndb/src/kernel/vm/mt.cpp
3023 Stewart Smith 2008-10-31
fix whoopsy in CmakeLists.txt merge
modified:
CMakeLists.txt
=== modified file 'storage/ndb/include/kernel/RefConvert.hpp'
--- a/storage/ndb/include/kernel/RefConvert.hpp 2008-07-25 05:48:32 +0000
+++ b/storage/ndb/include/kernel/RefConvert.hpp 2008-10-30 10:43:10 +0000
@@ -18,6 +18,7 @@
#include <assert.h>
#include "kernel_types.h"
+#include "ndb_limits.h"
/*
* In multithreaded kernel, BlockNumber includes the main block
@@ -27,20 +28,21 @@
inline
BlockNumber blockToMain(Uint32 block){
assert(block < (1 << 16));
- return (BlockNumber)(block & ((1 << 9) - 1));
+ return (BlockNumber)(block & ((1 << NDBMT_BLOCK_BITS) - 1));
}
inline
BlockInstance blockToInstance(Uint32 block){
assert(block < (1 << 16));
- return (BlockNumber)(block >> 9);
+ return (BlockNumber)(block >> NDBMT_BLOCK_BITS);
}
inline
BlockNumber numberToBlock(Uint32 main, Uint32 instance)
{
- assert(main < (1 << 9) && instance < (1 << (16 - 9)));
- return (BlockNumber)(main | (instance << 9));
+ assert(main < (1 << NDBMT_BLOCK_BITS) &&
+ instance < (1 << NDBMT_BLOCK_INSTANCE_BITS));
+ return (BlockNumber)(main | (instance << NDBMT_BLOCK_BITS));
}
/**
@@ -65,7 +67,7 @@ BlockNumber refToBlock(Uint32 ref){
*/
inline
BlockNumber refToMain(Uint32 ref){
- return (BlockNumber)((ref >> 16) & ((1 << 9) - 1));
+ return (BlockNumber)((ref >> 16) & ((1 << NDBMT_BLOCK_BITS) - 1));
}
/**
@@ -73,7 +75,7 @@ BlockNumber refToMain(Uint32 ref){
*/
inline
BlockInstance refToInstance(Uint32 ref){
- return (BlockInstance)(ref >> (16 + 9));
+ return (BlockInstance)(ref >> (16 + NDBMT_BLOCK_BITS));
}
/**
@@ -90,8 +92,12 @@ BlockReference numberToRef(Uint32 block,
*/
inline
BlockReference numberToRef(Uint32 main, Uint32 instance, Uint32 node){
- assert(node < (1 << 16) && main < (1 << 9) && instance < (1 << (16 - 9)));
- return (BlockReference)(node | (main << 16) | (instance << (16 + 9)));
+ assert(node < (1 << 16) &&
+ main < (1 << NDBMT_BLOCK_BITS) &&
+ instance < (1 << NDBMT_BLOCK_INSTANCE_BITS));
+ return (BlockReference)(node |
+ (main << 16) |
+ (instance << (16 + NDBMT_BLOCK_BITS)));
}
#endif
=== modified file 'storage/ndb/include/kernel/ndb_limits.h'
--- a/storage/ndb/include/kernel/ndb_limits.h 2008-10-29 09:15:35 +0000
+++ b/storage/ndb/include/kernel/ndb_limits.h 2008-10-30 10:43:10 +0000
@@ -15,8 +15,6 @@
#ifndef NDB_LIMITS_H
#define NDB_LIMITS_H
-#include <my_global.h>
-#include <mysql_com.h>
#define RNIL 0xffffff00
@@ -183,9 +181,8 @@
* Bits/mask used for coding/decoding blockno/blockinstance
*/
#define NDBMT_BLOCK_BITS 9
-#define NDBMT_BLOCK_MASK 0x001FF
+#define NDBMT_BLOCK_MASK ((1 << NDBMT_BLOCK_BITS) - 1)
#define NDBMT_BLOCK_INSTANCE_BITS 7
-#define NDBMT_BLOCK_INSTANCE_MASK 0xFE00
#define MAX_NDBMT_LQH_WORKERS 4
#define MAX_NDBMT_LQH_THREADS 4
=== modified file 'storage/ndb/include/kernel/signaldata/LqhTransConf.hpp'
--- a/storage/ndb/include/kernel/signaldata/LqhTransConf.hpp 2008-08-23 06:32:32 +0000
+++ b/storage/ndb/include/kernel/signaldata/LqhTransConf.hpp 2008-10-30 09:43:50 +0000
@@ -36,7 +36,13 @@ class LqhTransConf {
friend bool printLQH_TRANSCONF(FILE *, const Uint32 *, Uint32, Uint16);
public:
- STATIC_CONST( SignalLength = 16 );
+ STATIC_CONST( SignalLength = 17 );
+
+ /**
+ * Upgrade
+ */
+ STATIC_CONST( SignalLength_GCI_LO = 16 );
+ STATIC_CONST( SignalLength_FRAG_ID = 17 );
private:
/**
@@ -76,6 +82,7 @@ private:
Uint32 nextNodeId3;
Uint32 tableId;
Uint32 gci_lo;
+ Uint32 fragId;
/**
* Getters
=== modified file 'storage/ndb/include/ndb_global.h.in'
--- a/storage/ndb/include/ndb_global.h.in 2008-09-17 13:23:21 +0000
+++ b/storage/ndb/include/ndb_global.h.in 2008-10-30 10:43:10 +0000
@@ -19,6 +19,9 @@
#include <my_global.h>
#include <ndb_types.h>
+/* NAME_LEN */
+#include <mysql_com.h>
+
#define NDB_PORT "@ndb_port@"
#define NDB_TCP_BASE_PORT "@ndb_port_base@"
=== modified file 'storage/ndb/src/kernel/blocks/backup/Backup.hpp'
--- a/storage/ndb/src/kernel/blocks/backup/Backup.hpp 2008-10-09 19:17:11 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.hpp 2008-10-30 20:30:06 +0000
@@ -173,7 +173,12 @@ public:
#define BACKUP_WORDS_PER_PAGE 8191
struct Page32 {
- Uint32 data[BACKUP_WORDS_PER_PAGE];
+ union {
+ Uint32 data[BACKUP_WORDS_PER_PAGE];
+ Uint32 chunkSize;
+ Uint32 nextChunk;
+ Uint32 lastChunk;
+ };
Uint32 nextPool;
};
typedef Ptr<Page32> Page32Ptr;
@@ -187,7 +192,12 @@ public:
Uint8 scanned; // 0 = not scanned x = scanned by node x
Uint8 scanning; // 0 = not scanning x = scanning on node x
Uint8 lcp_no;
- Uint32 nextPool;
+ union {
+ Uint32 nextPool;
+ Uint32 chunkSize;
+ Uint32 nextChunk;
+ Uint32 lastChunk;
+ };
};
typedef Ptr<Fragment> FragmentPtr;
=== modified file 'storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp'
--- a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp 2008-10-05 07:12:42 +0000
+++ b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp 2008-10-30 20:30:06 +0000
@@ -47,6 +47,8 @@
extern EventLogger * g_eventLogger;
extern int simulate_error_during_shutdown;
+extern void mt_set_section_chunk_size();
+
Cmvmi::Cmvmi(Block_context& ctx) :
SimulatedBlock(CMVMI, ctx)
,subscribers(subscriberPool)
@@ -71,6 +73,8 @@ Cmvmi::Cmvmi(Block_context& ctx) :
g_sectionSegmentPool.setSize(long_sig_buffer_size,
true,true,true,CFG_DB_LONG_SIGNAL_BUFFER);
+ mt_set_section_chunk_size();
+
// Add received signals
addRecSignal(GSN_CONNECT_REP, &Cmvmi::execCONNECT_REP);
addRecSignal(GSN_DISCONNECT_REP, &Cmvmi::execDISCONNECT_REP);
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2008-10-29 14:25:59 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2008-10-30 11:03:37 +0000
@@ -7534,7 +7534,7 @@ Dbdict::check_supported_add_fragment(Uin
}
Uint32 fragments = newdata[1];
- if (fragments <= olddata[1])
+ if (fragments < olddata[1])
{
jam();
return AlterTableRef::UnsupportedChange;
@@ -18052,7 +18052,9 @@ Dbdict::removeStaleDictLocks(Signal* sig
LockQueue::Iterator iter;
if (m_dict_lock.first(this, m_dict_lock_pool, iter))
{
+#ifdef MARTIN
infoEvent("Iterating lock queue");
+#endif
do {
if (NodeBitmask::get(theFailedNodes,
refToNode(iter.m_curr.p->m_req.senderRef)))
@@ -18117,7 +18119,9 @@ Dbdict::dict_lock_trylock(const DictLock
ndbassert(false);
break;
}
+#ifdef MARTIN
infoEvent("Busy with schema transaction");
+#endif
return SchemaTransBeginRef::Busy;
}
@@ -20434,23 +20438,13 @@ Dbdict::createNodegroup_abortParse(Signa
sendTransConf(signal, op_ptr);
}
-static
-Uint32
-cnt_nodes(const Uint32 * nodes, Uint32 bound)
-{
- for (Uint32 i = 0; i<bound; i++)
- if (nodes[i] == 0)
- return i;
- return bound;
-}
-
bool
Dbdict::createNodegroup_subOps(Signal* signal, SchemaOpPtr op_ptr)
{
SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
CreateNodegroupRecPtr createNodegroupRecPtr;
getOpRec(op_ptr, createNodegroupRecPtr);
- CreateNodegroupImplReq* impl_req = &createNodegroupRecPtr.p->m_request;
+ //CreateNodegroupImplReq* impl_req = &createNodegroupRecPtr.p->m_request;
if (createNodegroupRecPtr.p->m_map_created == false)
{
@@ -21701,7 +21695,7 @@ Dbdict::seizeSchemaOp(SchemaOpPtr& op_pt
op_ptr.p->m_magic = SchemaOp::DICT_MAGIC;
const char* opType = info.m_opType;
D("seizeSchemaOp" << V(op_key) << V(opType));
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::seizeSchemaOp: op_key %u, op_type %s", op_key, opType);
#endif
return true;
@@ -21733,7 +21727,7 @@ Dbdict::releaseSchemaOp(SchemaOpPtr& op_
{
Uint32 op_key = op_ptr.p->op_key;
D("releaseSchemaOp" << V(op_key));
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::releaseSchemaOp: op_key %u", op_key);
#endif
@@ -22044,7 +22038,7 @@ Dbdict::seizeSchemaTrans(SchemaTransPtr&
{
Uint32 trans_key = c_opRecordSequence + 1;
if (seizeSchemaTrans(trans_ptr, trans_key)) {
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::seizeSchemaTrans: Seized schema trans %u", trans_key);
#endif
c_opRecordSequence = trans_key;
@@ -22072,7 +22066,7 @@ Dbdict::releaseSchemaTrans(SchemaTransPt
{
Uint32 trans_key = trans_ptr.p->trans_key;
D("releaseSchemaTrans" << V(trans_key));
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::releaseSchemaTrans: Releasing trans %u", trans_key);
#endif
@@ -22112,7 +22106,7 @@ Dbdict::execSCHEMA_TRANS_BEGIN_REQ(Signa
const SchemaTransBeginReq* req =
(const SchemaTransBeginReq*)signal->getDataPtr();
Uint32 clientRef = req->clientRef;
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::execSCHEMA_TRANS_BEGIN_REQ: received GSN_SCHEMA_TRANS_BEGIN_REQ from 0x%8x", clientRef);
#endif
@@ -22317,7 +22311,7 @@ Dbdict::execSCHEMA_TRANS_END_REQ(Signal*
setError(error, SchemaTransEndRef::NotMaster, __LINE__);
break;
}
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::execSCHEMA_TRANS_END_REQ: trans %u, state %u", trans_ptr.i, trans_ptr.p->m_state);
#endif
@@ -22563,7 +22557,7 @@ Dbdict::execSCHEMA_TRANS_IMPL_REF(Signal
Uint32 senderRef = ref->senderRef;
Uint32 nodeId = refToNode(senderRef);
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Got SCHEMA_TRANS_IMPL_REF from node %u, error %u", nodeId, ref->errorCode);
#endif
if (ref->errorCode == SchemaTransImplRef::NF_FakeErrorREF)
@@ -23105,7 +23099,7 @@ Dbdict::trans_abort_parse_next(Signal* s
{
jam();
ndbrequire(trans_ptr.p->m_state == SchemaTrans::TS_ABORTING_PARSE);
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::trans_abort_parse_next: op %u state %u", op_ptr.i,op_ptr.p->m_state);
#endif
trans_ptr.p->m_curr_op_ptr_i = op_ptr.i;
@@ -23264,7 +23258,7 @@ Dbdict::trans_abort_prepare_next(Signal*
{
jam();
ndbrequire(trans_ptr.p->m_state == SchemaTrans::TS_ABORTING_PREPARE);
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::trans_abort_prepare_next: op %u state %u", op_ptr.p->op_key, op_ptr.p->m_state);
#endif
trans_ptr.p->m_curr_op_ptr_i = op_ptr.i;
@@ -23348,7 +23342,7 @@ Dbdict::trans_abort_prepare_done(Signal*
{
jam();
ndbrequire(trans_ptr.p->m_state == SchemaTrans::TS_ABORTING_PREPARE);
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::trans_abort_prepare_done");
#endif
/**
@@ -23580,7 +23574,7 @@ void
Dbdict::trans_commit_first(Signal* signal, SchemaTransPtr trans_ptr)
{
jam();
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("trans_commit");
#endif
@@ -23614,7 +23608,7 @@ Dbdict::trans_commit_mutex_locked(Signal
Uint32 ret)
{
jamEntry();
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("trans_commit_mutex_locked");
#endif
SchemaTransPtr trans_ptr;
@@ -23698,7 +23692,7 @@ Dbdict::trans_commit_next(Signal* signal
SchemaOpPtr op_ptr)
{
jam();
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("Dbdict::trans_commit_next: op %u state %u", op_ptr.i,op_ptr.p->m_state);
#endif
op_ptr.p->m_state = SchemaOp::OS_COMMITTING;
@@ -23816,7 +23810,10 @@ Dbdict::trans_commit_recv_reply(Signal*
void
Dbdict::trans_commit_done(Signal* signal, SchemaTransPtr trans_ptr)
{
+#ifdef MARTIN
ndbout_c("trans_commit_done");
+#endif
+
Mutex mutex(signal, c_mutexMgr, trans_ptr.p->m_commit_mutex);
Callback c = { safe_cast(&Dbdict::trans_commit_mutex_unlocked), trans_ptr.i };
mutex.unlock(c);
@@ -23828,7 +23825,7 @@ Dbdict::trans_commit_mutex_unlocked(Sign
Uint32 ret)
{
jamEntry();
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("trans_commit_mutex_unlocked");
#endif
SchemaTransPtr trans_ptr;
@@ -23886,7 +23883,7 @@ void
Dbdict::trans_complete_start(Signal* signal, SchemaTransPtr trans_ptr)
{
jam();
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("trans_complete_start %u", trans_ptr.p->trans_key);
#endif
trans_ptr.p->m_state = SchemaTrans::TS_FLUSH_COMPLETE;
@@ -24327,7 +24324,7 @@ Dbdict::execSCHEMA_TRANS_IMPL_REQ(Signal
goto err;
}
-#ifndef DBUG_OFF
+#ifdef MARTIN
char buf[256];
switch(rt) {
case(SchemaTransImplReq::RT_START):
@@ -24729,7 +24726,7 @@ Dbdict::slave_commit_mutex_locked(Signal
Uint32 ret)
{
jamEntry();
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("slave_commit_mutex_locked");
#endif
SchemaTransPtr trans_ptr;
@@ -24745,7 +24742,7 @@ Dbdict::slave_commit_mutex_unlocked(Sign
Uint32 ret)
{
jamEntry();
-#ifdef VM_TRACE
+#ifdef MARTIN
ndbout_c("slave_commit_mutex_unlocked");
#endif
SchemaTransPtr trans_ptr;
=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2008-10-09 19:17:11 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2008-10-30 09:43:50 +0000
@@ -18859,9 +18859,6 @@ void Dblqh::sendAborted(Signal* signal)
* ------------------------------------------------------------------------- */
void Dblqh::sendLqhTransconf(Signal* signal, LqhTransConf::OperationStatus stat)
{
- /**
- * wl4391_todo need to send instance key to take-over TC
- */
tcNodeFailptr.i = tcConnectptr.p->tcNodeFailrec;
ptrCheckGuard(tcNodeFailptr, ctcNodeFailrecFileSize, tcNodeFailRecord);
@@ -18890,6 +18887,7 @@ void Dblqh::sendLqhTransconf(Signal* sig
lqhTransConf->apiOpRec = tcConnectptr.p->applOprec;
lqhTransConf->tableId = tcConnectptr.p->tableref;
lqhTransConf->gci_lo = tcConnectptr.p->gci_lo;
+ lqhTransConf->fragId = tcConnectptr.p->fragmentid;
sendSignal(tcNodeFailptr.p->newTcBlockref, GSN_LQH_TRANSCONF,
signal, LqhTransConf::SignalLength, JBB);
tcNodeFailptr.p->tcRecNow = tcConnectptr.i + 1;
=== modified file 'storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp 2008-10-05 07:14:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp 2008-10-30 09:43:50 +0000
@@ -1396,14 +1396,14 @@ private:
void timeOutLoopStartFragLab(Signal* signal, Uint32 TscanConPtr);
int releaseAndAbort(Signal* signal);
void findApiConnectFail(Signal* signal);
- void findTcConnectFail(Signal* signal);
+ void findTcConnectFail(Signal* signal, Uint32 instanceKey);
void initApiConnectFail(Signal* signal);
- void initTcConnectFail(Signal* signal);
+ void initTcConnectFail(Signal* signal, Uint32 instanceKey);
void initTcFail(Signal* signal);
void releaseTakeOver(Signal* signal);
void setupFailData(Signal* signal);
void updateApiStateFail(Signal* signal);
- void updateTcStateFail(Signal* signal);
+ void updateTcStateFail(Signal* signal, Uint32 instanceKey);
void handleApiFailState(Signal* signal, UintR anApiConnectptr);
void handleFailedApiNode(Signal* signal,
UintR aFailedNode,
=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2008-10-08 06:18:28 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2008-10-30 09:43:50 +0000
@@ -7150,7 +7150,8 @@ void Dbtc::sendAbortedAfterTimeout(Signa
* We also update the timer to ensure we don't get time-out
* too early.
*--------------------------------------------------------------*/
- BlockReference TBRef = calcLqhBlockRef(hostptr.i);
+ Uint32 instanceKey = tcConnectptr.p->lqhInstanceKey;
+ BlockReference TBRef = numberToRef(DBLQH, instanceKey, hostptr.i);
signal->theData[0] = tcConnectptr.i;
signal->theData[1] = cownref;
signal->theData[2] = apiConnectptr.p->transid[0];
@@ -7981,8 +7982,9 @@ void Dbtc::execLQH_TRANSCONF(Signal* sig
tapplOprec = lqhTransConf->apiOpRec;
const Uint32 tableId = lqhTransConf->tableId;
Uint32 gci_lo = lqhTransConf->gci_lo;
+ Uint32 fragId = lqhTransConf->fragId;
if (ttransStatus == LqhTransConf::Committed &&
- unlikely(signal->getLength() < LqhTransConf::SignalLength))
+ unlikely(signal->getLength() < LqhTransConf::SignalLength_GCI_LO))
{
jam();
gci_lo = 0;
@@ -8023,9 +8025,23 @@ void Dbtc::execLQH_TRANSCONF(Signal* sig
apiConnectptr.p->ndbapiConnect = tapplOprec;
}
- if (ttransStatus != LqhTransConf::Marker){
+ if (ttransStatus != LqhTransConf::Marker)
+ {
jam();
- findTcConnectFail(signal);
+
+ Uint32 instanceKey;
+
+ if (unlikely(signal->getLength() < LqhTransConf::SignalLength_FRAG_ID))
+ {
+ jam();
+ instanceKey = 0;
+ }
+ else
+ {
+ jam();
+ instanceKey = getInstanceKey(tableId, fragId);
+ }
+ findTcConnectFail(signal, instanceKey);
}
}//Dbtc::execLQH_TRANSCONF()
@@ -8478,7 +8494,8 @@ void Dbtc::toAbortHandlingLab(Signal* si
ptrCheckGuard(hostptr, chostFilesize, hostRecord);
if (hostptr.p->hostStatus == HS_ALIVE) {
jam();
- tblockref = calcLqhBlockRef(hostptr.i);
+ Uint32 instanceKey = tcConnectptr.p->lqhInstanceKey;
+ tblockref = numberToRef(DBLQH, instanceKey, hostptr.i);
setApiConTimer(apiConnectptr.i, ctcTimer, __LINE__);
tcConnectptr.p->tcConnectstate = OS_WAIT_ABORT_CONF;
apiConnectptr.p->apiConnectstate = CS_WAIT_ABORT_CONF;
@@ -8897,7 +8914,7 @@ FAF_LOOP:
/*----------------------------------------------------------*/
/* FIND THE TC CONNECT AND IF NOT FOUND ALLOCATE A NEW */
/*----------------------------------------------------------*/
-void Dbtc::findTcConnectFail(Signal* signal)
+void Dbtc::findTcConnectFail(Signal* signal, Uint32 instanceKey)
{
UintR tftfHashNumber;
@@ -8915,7 +8932,7 @@ void Dbtc::findTcConnectFail(Signal* sig
linkTcInConnectionlist(signal);
tcConnectptr.p->nextTcFailHash = ctcConnectFailHash[tftfHashNumber];
ctcConnectFailHash[tftfHashNumber] = tcConnectptr.i;
- initTcConnectFail(signal);
+ initTcConnectFail(signal, instanceKey);
return;
} else {
ptrCheckGuard(tcConnectptr, ctcConnectFilesize, tcConnectRecord);
@@ -8923,7 +8940,7 @@ void Dbtc::findTcConnectFail(Signal* sig
jam(); /* FRAGMENTID = TC_OPREC HERE, LOOP ANOTHER TURN */
tcConnectptr.i = tcConnectptr.p->nextTcFailHash;
} else {
- updateTcStateFail(signal);
+ updateTcStateFail(signal, instanceKey);
return;
}//if
}//if
@@ -9001,7 +9018,7 @@ void Dbtc::initApiConnectFail(Signal* si
/* INITIALISE AT TC CONNECT AT TAKE OVER WHEN ALLOCATING*/
/* THE TC CONNECT RECORD. */
/*------------------------------------------------------------*/
-void Dbtc::initTcConnectFail(Signal* signal)
+void Dbtc::initTcConnectFail(Signal* signal, Uint32 instanceKey)
{
tcConnectptr.p->apiConnect = apiConnectptr.i;
tcConnectptr.p->tcOprec = ttcOprec;
@@ -9013,7 +9030,8 @@ void Dbtc::initTcConnectFail(Signal* sig
tcConnectptr.p->failData[treplicaNo] = ttransStatus;
tcConnectptr.p->lastReplicaNo = LqhTransConf::getLastReplicaNo(treqinfo);
tcConnectptr.p->dirtyOp = LqhTransConf::getDirtyFlag(treqinfo);
-
+ tcConnectptr.p->lqhInstanceKey = instanceKey;
+
}//Dbtc::initTcConnectFail()
/*----------------------------------------------------------*/
@@ -9252,7 +9270,7 @@ void Dbtc::updateApiStateFail(Signal* si
/* WE ALSO NEED TO CHECK THAT THERE IS CONSISTENCY */
/* BETWEEN THE DIFFERENT REPLICAS. */
/*------------------------------------------------------------*/
-void Dbtc::updateTcStateFail(Signal* signal)
+void Dbtc::updateTcStateFail(Signal* signal, Uint32 instanceKey)
{
const Uint8 treplicaNo = LqhTransConf::getReplicaNo(treqinfo);
const Uint8 tlastReplicaNo = LqhTransConf::getLastReplicaNo(treqinfo);
@@ -9267,6 +9285,7 @@ void Dbtc::updateTcStateFail(Signal* sig
regTcPtr->tcNodedata[treplicaNo] = tnodeid;
regTcPtr->failData[treplicaNo] = ttransStatus;
+ ndbrequire(regTcPtr->lqhInstanceKey == instanceKey)
}//Dbtc::updateTcStateFail()
void Dbtc::execTCGETOPSIZEREQ(Signal* signal)
=== modified file 'storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp'
--- a/storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp 2008-10-05 07:14:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp 2008-10-30 20:30:06 +0000
@@ -147,7 +147,12 @@ public:
* @brief For storing SimpleProperties objects and similar temporary data
*/
struct Page32 {
- Uint32 data[UTIL_WORDS_PER_PAGE];
+ union {
+ Uint32 data[UTIL_WORDS_PER_PAGE];
+ Uint32 chunkSize;
+ Uint32 nextChunk;
+ Uint32 lastChunk;
+ };
Uint32 nextPool; // Note: This used as data when seized
};
=== modified file 'storage/ndb/src/kernel/vm/ArrayPool.hpp'
--- a/storage/ndb/src/kernel/vm/ArrayPool.hpp 2008-10-27 19:46:39 +0000
+++ b/storage/ndb/src/kernel/vm/ArrayPool.hpp 2008-10-30 20:30:06 +0000
@@ -89,8 +89,6 @@ public:
*/
bool seize(Ptr<T> &);
- bool seizeList(Uint32 & n, Ptr<T> &);
-
/**
* Allocate object <b>i</b> from pool - update Ptr
*/
@@ -133,7 +131,7 @@ public:
*/
struct Cache
{
- Cache(Uint32 a0 = 128, Uint32 a1 = 128) { m_first_free = RNIL; m_free_cnt = 0; m_alloc_cnt = a0; m_max_free_cnt = a1; }
+ Cache(Uint32 a0 = 512, Uint32 a1 = 256) { m_first_free = RNIL; m_free_cnt = 0; m_alloc_cnt = a0; m_max_free_cnt = a1; }
Uint32 m_first_free;
Uint32 m_free_cnt;
Uint32 m_alloc_cnt;
@@ -151,8 +149,13 @@ public:
void release(LockFun, Cache&, Uint32 i);
void release(LockFun, Cache&, Ptr<T> &);
void releaseList(LockFun, Cache&, Uint32 n, Uint32 first, Uint32 last);
+
+ void setChunkSize(Uint32 sz);
protected:
- void releaseList(LockFun, Cache&, Uint32 n);
+ void releaseChunk(LockFun, Cache&, Uint32 n);
+
+ bool seizeChunk(Uint32 & n, Ptr<T> &);
+ void releaseChunk(Uint32 n, Uint32 first, Uint32 last);
protected:
friend class Array<T>;
@@ -329,6 +332,39 @@ ArrayPool<T>::setSize(Uint32 noOfElement
template <class T>
inline
+void
+ArrayPool<T>::setChunkSize(Uint32 sz)
+{
+ Uint32 i;
+ for (i = 0; i + sz < size; i += sz)
+ {
+ theArray[i].chunkSize = sz;
+ theArray[i].lastChunk = i + sz - 1;
+ theArray[i].nextChunk = i + sz;
+ }
+
+ theArray[i].chunkSize = size - i;
+ theArray[i].lastChunk = size - 1;
+ theArray[i].nextChunk = RNIL;
+
+#ifdef ARRAY_GUARD
+ {
+ Uint32 ff = firstFree;
+ Uint32 sum = 0;
+ while (ff != RNIL)
+ {
+ sum += theArray[ff].chunkSize;
+ Uint32 last = theArray[ff].lastChunk;
+ assert(theArray[last].nextPool == theArray[ff].nextChunk);
+ ff = theArray[ff].nextChunk;
+ }
+ assert(sum == size);
+ }
+#endif
+}
+
+template <class T>
+inline
bool
ArrayPool<T>::set(T* ptr, Uint32 cnt, bool align){
if (size == 0)
@@ -680,29 +716,6 @@ ArrayPool<T>::seize(Ptr<T> & ptr){
template <class T>
inline
bool
-ArrayPool<T>::seizeList(Uint32 & cnt, Ptr<T> & ptr){
- Uint32 save = cnt;
- Uint32 tmp = save - 1;
- if (seize(ptr))
- {
- Ptr<T> prev = ptr;
- Ptr<T> curr;
- while (tmp && seize(curr))
- {
- prev.p->nextPool = curr.i;
- prev = curr;
- tmp--;
- }
- prev.p->nextPool = RNIL;
- cnt = save - tmp;
- return true;
- }
- return false;
-}
-
-template <class T>
-inline
-bool
ArrayPool<T>::seizeId(Ptr<T> & ptr, Uint32 i){
Uint32 ff = firstFree;
Uint32 prev = RNIL;
@@ -951,6 +964,100 @@ ArrayPool<T>::release(Ptr<T> & ptr){
template <class T>
inline
bool
+ArrayPool<T>::seizeChunk(Uint32 & cnt, Ptr<T> & ptr)
+{
+ Uint32 save = cnt;
+ int tmp = save;
+ Uint32 ff = firstFree;
+ ptr.i = ff;
+ ptr.p = theArray + ff;
+
+ if (ff != RNIL)
+ {
+ Uint32 prev;
+ do
+ {
+ if (0)
+ ndbout_c("seizeChunk(%u) ff: %u tmp: %d chunkSize: %u lastChunk: %u nextChunk: %u",
+ save, ff, tmp,
+ theArray[ff].chunkSize,
+ theArray[ff].lastChunk,
+ theArray[ff].nextChunk);
+
+ tmp -= theArray[ff].chunkSize;
+ prev = theArray[ff].lastChunk;
+ assert(theArray[ff].nextChunk == theArray[prev].nextPool);
+ ff = theArray[ff].nextChunk;
+ } while (tmp > 0 && ff != RNIL);
+
+ cnt = (save - tmp);
+ noOfFree -= (save - tmp);
+ firstFree = ff;
+ theArray[prev].nextPool = RNIL;
+
+#ifdef ARRAY_GUARD
+ if (theAllocatedBitmask)
+ {
+ Uint32 tmpI = ptr.i;
+ for(Uint32 i = 0; i<cnt; i++){
+ if(BitmaskImpl::get(bitmaskSz, theAllocatedBitmask, tmpI)){
+ /**
+ * Seizing an already seized element
+ */
+ ErrorReporter::handleAssert("ArrayPool<T>::seizeChunk",
+ __FILE__, __LINE__);
+ } else {
+ BitmaskImpl::set(bitmaskSz, theAllocatedBitmask, tmpI);
+ }
+ tmpI = theArray[tmpI].nextPool;
+ }
+ }
+#endif
+ return true;
+ }
+
+ return false;
+}
+
+template <class T>
+inline
+void
+ArrayPool<T>::releaseChunk(Uint32 cnt, Uint32 first, Uint32 last)
+{
+ Uint32 ff = firstFree;
+ firstFree = first;
+ theArray[first].nextChunk = ff;
+ theArray[last].nextPool = ff;
+ noOfFree += cnt;
+
+ assert(theArray[first].chunkSize == cnt);
+ assert(theArray[first].lastChunk == last);
+
+#ifdef ARRAY_GUARD
+ if (theAllocatedBitmask)
+ {
+ Uint32 tmp = first;
+ for(Uint32 i = 0; i<cnt; i++){
+ if(BitmaskImpl::get(bitmaskSz, theAllocatedBitmask, tmp)){
+ BitmaskImpl::clear(bitmaskSz, theAllocatedBitmask, tmp);
+ } else {
+ /**
+ * Relesing a already released element
+ */
+ ErrorReporter::handleAssert("ArrayPool<T>::releaseList",
+ __FILE__, __LINE__);
+ return;
+ }
+ tmp = theArray[tmp].nextPool;
+ }
+ }
+#endif
+}
+
+
+template <class T>
+inline
+bool
ArrayPool<T>::seize(LockFun l, Cache& c, Ptr<T> & p)
{
DUMP("seize", "-> ");
@@ -968,7 +1075,7 @@ ArrayPool<T>::seize(LockFun l, Cache& c,
Uint32 tmp = c.m_alloc_cnt;
l.lock();
- bool ret = seizeList(tmp, p);
+ bool ret = seizeChunk(tmp, p);
l.unlock();
if (ret)
@@ -1002,7 +1109,7 @@ ArrayPool<T>::release(LockFun l, Cache&
if (c.m_free_cnt > 2 * c.m_max_free_cnt)
{
- releaseList(l, c, c.m_max_free_cnt);
+ releaseChunk(l, c, c.m_alloc_cnt);
}
}
@@ -1018,14 +1125,14 @@ ArrayPool<T>::releaseList(LockFun l, Cac
if (c.m_free_cnt > 2 * c.m_max_free_cnt)
{
- releaseList(l, c, c.m_max_free_cnt);
+ releaseChunk(l, c, c.m_alloc_cnt);
}
}
template <class T>
inline
void
-ArrayPool<T>::releaseList(LockFun l, Cache& c, Uint32 n)
+ArrayPool<T>::releaseChunk(LockFun l, Cache& c, Uint32 n)
{
DUMP("releaseListImpl", "-> ");
Uint32 ff = c.m_first_free;
@@ -1042,8 +1149,11 @@ ArrayPool<T>::releaseList(LockFun l, Cac
DUMP("", "\n");
+ theArray[ff].chunkSize = i;
+ theArray[ff].lastChunk = prev;
+
l.lock();
- releaseList(i, ff, prev);
+ releaseChunk(i, ff, prev);
l.unlock();
}
=== modified file 'storage/ndb/src/kernel/vm/LongSignal.hpp'
--- a/storage/ndb/src/kernel/vm/LongSignal.hpp 2008-10-08 19:09:05 +0000
+++ b/storage/ndb/src/kernel/vm/LongSignal.hpp 2008-10-30 20:30:06 +0000
@@ -26,9 +26,18 @@ struct SectionSegment {
STATIC_CONST( DataLength = NDB_SECTION_SEGMENT_SZ );
- Uint32 m_ownerRef;
- Uint32 m_sz;
- Uint32 m_lastSegment;
+ union {
+ Uint32 m_sz;
+ Uint32 chunkSize;
+ };
+ union {
+ Uint32 m_ownerRef;
+ Uint32 nextChunk;
+ };
+ union {
+ Uint32 m_lastSegment;
+ Uint32 lastChunk; //
+ };
union {
Uint32 m_nextSegment;
Uint32 nextPool;
=== modified file 'storage/ndb/src/kernel/vm/TransporterCallback.cpp'
--- a/storage/ndb/src/kernel/vm/TransporterCallback.cpp 2008-10-27 17:56:57 +0000
+++ b/storage/ndb/src/kernel/vm/TransporterCallback.cpp 2008-10-30 20:30:06 +0000
@@ -97,6 +97,15 @@ TransporterRegistry globalTransporterReg
#ifdef NDBD_MULTITHREADED
static SectionSegmentPool::Cache cache(1024,1024);
+
+void
+mt_set_section_chunk_size()
+{
+ g_sectionSegmentPool.setChunkSize(256);
+}
+
+#else
+void mt_set_section_chunk_size(){}
#endif
void
=== modified file 'storage/ndb/src/kernel/vm/mt.cpp'
--- a/storage/ndb/src/kernel/vm/mt.cpp 2008-10-28 11:12:13 +0000
+++ b/storage/ndb/src/kernel/vm/mt.cpp 2008-10-30 09:47:57 +0000
@@ -260,6 +260,7 @@ void
lock_slow(struct thr_spin_lock* sl)
{
volatile unsigned* val = &sl->m_lock;
+ mt_lock_stat* s = lookup_lock(sl); // lookup before owning lock
loop:
Uint32 spins = 0;
@@ -271,7 +272,6 @@ loop:
if (unlikely(xcng(val, 1) != 0))
goto loop;
- mt_lock_stat* s = lookup_lock(sl);
if (s)
{
s->m_spin_count += spins;
| Thread |
|---|
| • bzr push into mysql-5.1 branch (jonas:3023 to 3024) | Jonas Oreland | 30 Oct |