summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2005-10-04 20:06:02 +0200
committerunknown <tomas@poseidon.ndb.mysql.com>2005-10-04 20:06:02 +0200
commitc54cb75c2ebcfb9c67c8bfca5a1c75140aac6a51 (patch)
tree5bad14fa255efa9297a954c12baa1196a6e6dc0e /ndb
parentd9e5eaa572267827a52b651b4a3e9f86d38fd3ee (diff)
downloadmariadb-git-c54cb75c2ebcfb9c67c8bfca5a1c75140aac6a51.tar.gz
- to ensure maximum available memory for TUP DataMem
moved all array allocation to READ_CONFIG_REQ (except CMVI which was not possible) reorganized READ_CONFIG_REQ call order in ndb cntr to make sure TUP allocates first moved allocations internally in TUP to allocate DataMem first
Diffstat (limited to 'ndb')
-rw-r--r--ndb/src/kernel/blocks/backup/Backup.cpp100
-rw-r--r--ndb/src/kernel/blocks/backup/Backup.hpp1
-rw-r--r--ndb/src/kernel/blocks/backup/BackupInit.cpp82
-rw-r--r--ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp22
-rw-r--r--ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp1
-rw-r--r--ndb/src/kernel/blocks/dbacc/DbaccInit.cpp45
-rw-r--r--ndb/src/kernel/blocks/dbacc/DbaccMain.cpp14
-rw-r--r--ndb/src/kernel/blocks/dbdih/DbdihInit.cpp2
-rw-r--r--ndb/src/kernel/blocks/dbdih/DbdihMain.cpp2
-rw-r--r--ndb/src/kernel/blocks/dbtc/DbtcInit.cpp2
-rw-r--r--ndb/src/kernel/blocks/dbtc/DbtcMain.cpp2
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupGen.cpp69
-rw-r--r--ndb/src/kernel/blocks/dbutil/DbUtil.cpp104
-rw-r--r--ndb/src/kernel/blocks/dbutil/DbUtil.hpp1
-rw-r--r--ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp1
-rw-r--r--ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp1
-rw-r--r--ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp44
-rw-r--r--ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp12
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp51
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp1
-rw-r--r--ndb/src/kernel/blocks/qmgr/Qmgr.hpp1
-rw-r--r--ndb/src/kernel/blocks/qmgr/QmgrInit.cpp1
-rw-r--r--ndb/src/kernel/blocks/qmgr/QmgrMain.cpp21
-rw-r--r--ndb/src/kernel/blocks/suma/Suma.cpp92
-rw-r--r--ndb/src/kernel/blocks/suma/Suma.hpp2
-rw-r--r--ndb/src/kernel/blocks/suma/SumaInit.cpp40
-rw-r--r--ndb/src/kernel/blocks/trix/Trix.cpp34
-rw-r--r--ndb/src/kernel/blocks/trix/Trix.hpp1
-rw-r--r--ndb/src/kernel/vm/ArrayPool.hpp5
-rw-r--r--ndb/src/kernel/vm/CArray.hpp6
-rw-r--r--ndb/src/kernel/vm/Makefile.am2
-rw-r--r--ndb/src/kernel/vm/SimulatedBlock.cpp23
-rw-r--r--ndb/src/kernel/vm/SimulatedBlock.hpp1
-rw-r--r--ndb/src/kernel/vm/ndbd_malloc.cpp63
-rw-r--r--ndb/src/kernel/vm/ndbd_malloc.hpp26
35 files changed, 554 insertions, 321 deletions
diff --git a/ndb/src/kernel/blocks/backup/Backup.cpp b/ndb/src/kernel/blocks/backup/Backup.cpp
index cbffd6bcb6b..2379bd6cf21 100644
--- a/ndb/src/kernel/blocks/backup/Backup.cpp
+++ b/ndb/src/kernel/blocks/backup/Backup.cpp
@@ -72,6 +72,106 @@ static Uint32 g_TypeOfStart = NodeState::ST_ILLEGAL_TYPE;
#define SEND_BACKUP_STARTED_FLAG(A) (((A) & 0x3) > 0)
#define SEND_BACKUP_COMPLETED_FLAG(A) (((A) & 0x3) > 1)
+void
+Backup::execREAD_CONFIG_REQ(Signal* signal)
+{
+ jamEntry();
+
+ const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
+
+ Uint32 ref = req->senderRef;
+ Uint32 senderData = req->senderData;
+
+ const ndb_mgm_configuration_iterator * p =
+ theConfiguration.getOwnConfigIterator();
+ ndbrequire(p != 0);
+
+ c_nodePool.setSize(MAX_NDB_NODES);
+
+ Uint32 noBackups = 0, noTables = 0, noAttribs = 0;
+ ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &m_diskless));
+ ndb_mgm_get_int_parameter(p, CFG_DB_PARALLEL_BACKUPS, &noBackups);
+ // ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES, &noTables));
+ ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DICT_TABLE, &noTables));
+ ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_ATTRIBUTES, &noAttribs));
+
+ noAttribs++; //RT 527 bug fix
+
+ c_backupPool.setSize(noBackups);
+ c_backupFilePool.setSize(3 * noBackups);
+ c_tablePool.setSize(noBackups * noTables);
+ c_attributePool.setSize(noBackups * noAttribs);
+ c_triggerPool.setSize(noBackups * 3 * noTables);
+
+ // 2 = no of replicas
+ c_fragmentPool.setSize(noBackups * 2 * NO_OF_FRAG_PER_NODE * noTables);
+
+ Uint32 szMem = 0;
+ ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_MEM, &szMem);
+ Uint32 noPages = (szMem + sizeof(Page32) - 1) / sizeof(Page32);
+ // We need to allocate an additional of 2 pages. 1 page because of a bug in
+ // ArrayPool and another one for DICTTAINFO.
+ c_pagePool.setSize(noPages + NO_OF_PAGES_META_FILE + 2);
+
+ Uint32 szDataBuf = (2 * 1024 * 1024);
+ Uint32 szLogBuf = (2 * 1024 * 1024);
+ Uint32 szWrite = 32768;
+ ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_DATA_BUFFER_MEM, &szDataBuf);
+ ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_LOG_BUFFER_MEM, &szLogBuf);
+ ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_WRITE_SIZE, &szWrite);
+
+ c_defaults.m_logBufferSize = szLogBuf;
+ c_defaults.m_dataBufferSize = szDataBuf;
+ c_defaults.m_minWriteSize = szWrite;
+ c_defaults.m_maxWriteSize = szWrite;
+
+ { // Init all tables
+ ArrayList<Table> tables(c_tablePool);
+ TablePtr ptr;
+ while(tables.seize(ptr)){
+ new (ptr.p) Table(c_attributePool, c_fragmentPool);
+ }
+ tables.release();
+ }
+
+ {
+ ArrayList<BackupFile> ops(c_backupFilePool);
+ BackupFilePtr ptr;
+ while(ops.seize(ptr)){
+ new (ptr.p) BackupFile(* this, c_pagePool);
+ }
+ ops.release();
+ }
+
+ {
+ ArrayList<BackupRecord> recs(c_backupPool);
+ BackupRecordPtr ptr;
+ while(recs.seize(ptr)){
+ new (ptr.p) BackupRecord(* this, c_pagePool, c_tablePool,
+ c_backupFilePool, c_triggerPool);
+ }
+ recs.release();
+ }
+
+ // Initialize BAT for interface to file system
+ {
+ Page32Ptr p;
+ ndbrequire(c_pagePool.seizeId(p, 0));
+ c_startOfPages = (Uint32 *)p.p;
+ c_pagePool.release(p);
+
+ NewVARIABLE* bat = allocateBat(1);
+ bat[0].WA = c_startOfPages;
+ bat[0].nrr = c_pagePool.getSize()*sizeof(Page32)/sizeof(Uint32);
+ }
+
+ ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = senderData;
+ sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
+ ReadConfigConf::SignalLength, JBB);
+}
+
void
Backup::execSTTOR(Signal* signal)
{
diff --git a/ndb/src/kernel/blocks/backup/Backup.hpp b/ndb/src/kernel/blocks/backup/Backup.hpp
index 67b53d3eccd..c455e32fa67 100644
--- a/ndb/src/kernel/blocks/backup/Backup.hpp
+++ b/ndb/src/kernel/blocks/backup/Backup.hpp
@@ -46,6 +46,7 @@ public:
protected:
void execSTTOR(Signal* signal);
+ void execREAD_CONFIG_REQ(Signal* signal);
void execDUMP_STATE_ORD(Signal* signal);
void execREAD_NODESCONF(Signal* signal);
void execNODE_FAILREP(Signal* signal);
diff --git a/ndb/src/kernel/blocks/backup/BackupInit.cpp b/ndb/src/kernel/blocks/backup/BackupInit.cpp
index 2c36896e34c..4c734d58c8e 100644
--- a/ndb/src/kernel/blocks/backup/BackupInit.cpp
+++ b/ndb/src/kernel/blocks/backup/BackupInit.cpp
@@ -34,90 +34,10 @@ Backup::Backup(const Configuration & conf) :
{
BLOCK_CONSTRUCTOR(Backup);
- c_nodePool.setSize(MAX_NDB_NODES);
c_masterNodeId = getOwnNodeId();
- const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
- ndbrequire(p != 0);
-
- Uint32 noBackups = 0, noTables = 0, noAttribs = 0;
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &m_diskless));
- ndb_mgm_get_int_parameter(p, CFG_DB_PARALLEL_BACKUPS, &noBackups);
- // ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES, &noTables));
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DICT_TABLE, &noTables));
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_ATTRIBUTES, &noAttribs));
-
- noAttribs++; //RT 527 bug fix
-
- c_backupPool.setSize(noBackups);
- c_backupFilePool.setSize(3 * noBackups);
- c_tablePool.setSize(noBackups * noTables);
- c_attributePool.setSize(noBackups * noAttribs);
- c_triggerPool.setSize(noBackups * 3 * noTables);
-
- // 2 = no of replicas
- c_fragmentPool.setSize(noBackups * 2 * NO_OF_FRAG_PER_NODE * noTables);
-
- Uint32 szMem = 0;
- ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_MEM, &szMem);
- Uint32 noPages = (szMem + sizeof(Page32) - 1) / sizeof(Page32);
- // We need to allocate an additional of 2 pages. 1 page because of a bug in
- // ArrayPool and another one for DICTTAINFO.
- c_pagePool.setSize(noPages + NO_OF_PAGES_META_FILE + 2);
-
- Uint32 szDataBuf = (2 * 1024 * 1024);
- Uint32 szLogBuf = (2 * 1024 * 1024);
- Uint32 szWrite = 32768;
- ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_DATA_BUFFER_MEM, &szDataBuf);
- ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_LOG_BUFFER_MEM, &szLogBuf);
- ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_WRITE_SIZE, &szWrite);
-
- c_defaults.m_logBufferSize = szLogBuf;
- c_defaults.m_dataBufferSize = szDataBuf;
- c_defaults.m_minWriteSize = szWrite;
- c_defaults.m_maxWriteSize = szWrite;
-
- { // Init all tables
- ArrayList<Table> tables(c_tablePool);
- TablePtr ptr;
- while(tables.seize(ptr)){
- new (ptr.p) Table(c_attributePool, c_fragmentPool);
- }
- tables.release();
- }
-
- {
- ArrayList<BackupFile> ops(c_backupFilePool);
- BackupFilePtr ptr;
- while(ops.seize(ptr)){
- new (ptr.p) BackupFile(* this, c_pagePool);
- }
- ops.release();
- }
-
- {
- ArrayList<BackupRecord> recs(c_backupPool);
- BackupRecordPtr ptr;
- while(recs.seize(ptr)){
- new (ptr.p) BackupRecord(* this, c_pagePool, c_tablePool,
- c_backupFilePool, c_triggerPool);
- }
- recs.release();
- }
-
- // Initialize BAT for interface to file system
- {
- Page32Ptr p;
- ndbrequire(c_pagePool.seizeId(p, 0));
- c_startOfPages = (Uint32 *)p.p;
- c_pagePool.release(p);
-
- NewVARIABLE* bat = allocateBat(1);
- bat[0].WA = c_startOfPages;
- bat[0].nrr = c_pagePool.getSize()*sizeof(Page32)/sizeof(Uint32);
- }
-
// Add received signals
+ addRecSignal(GSN_READ_CONFIG_REQ, &Backup::execREAD_CONFIG_REQ);
addRecSignal(GSN_STTOR, &Backup::execSTTOR);
addRecSignal(GSN_DUMP_STATE_ORD, &Backup::execDUMP_STATE_ORD);
addRecSignal(GSN_READ_NODESCONF, &Backup::execREAD_NODESCONF);
diff --git a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
index 9d6c692379a..657fc8e5896 100644
--- a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
+++ b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
@@ -72,6 +72,7 @@ Cmvmi::Cmvmi(const Configuration & conf) :
addRecSignal(GSN_SET_LOGLEVELORD, &Cmvmi::execSET_LOGLEVELORD);
addRecSignal(GSN_EVENT_REP, &Cmvmi::execEVENT_REP);
addRecSignal(GSN_STTOR, &Cmvmi::execSTTOR);
+ addRecSignal(GSN_READ_CONFIG_REQ, &Cmvmi::execREAD_CONFIG_REQ);
addRecSignal(GSN_CLOSE_COMREQ, &Cmvmi::execCLOSE_COMREQ);
addRecSignal(GSN_ENABLE_COMORD, &Cmvmi::execENABLE_COMORD);
addRecSignal(GSN_OPEN_COMREQ, &Cmvmi::execOPEN_COMREQ);
@@ -307,6 +308,27 @@ void Cmvmi::sendSTTORRY(Signal* signal)
}//Cmvmi::sendSTTORRY
+void
+Cmvmi::execREAD_CONFIG_REQ(Signal* signal)
+{
+ jamEntry();
+
+ const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
+
+ Uint32 ref = req->senderRef;
+ Uint32 senderData = req->senderData;
+
+ const ndb_mgm_configuration_iterator * p =
+ theConfiguration.getOwnConfigIterator();
+ ndbrequire(p != 0);
+
+ ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = senderData;
+ sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
+ ReadConfigConf::SignalLength, JBB);
+}
+
void Cmvmi::execSTTOR(Signal* signal)
{
Uint32 theStartPhase = signal->theData[1];
diff --git a/ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp b/ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp
index 1c91f564749..f89c8f15e86 100644
--- a/ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp
+++ b/ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp
@@ -48,6 +48,7 @@ private:
void execNDB_TAMPER(Signal* signal);
void execSET_LOGLEVELORD(Signal* signal);
void execEVENT_REP(Signal* signal);
+ void execREAD_CONFIG_REQ(Signal* signal);
void execSTTOR(Signal* signal);
void execCLOSE_COMREQ(Signal* signal);
void execENABLE_COMORD(Signal* signal);
diff --git a/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp b/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp
index d03f3b55d6a..59a622b60e6 100644
--- a/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp
+++ b/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp
@@ -59,10 +59,24 @@ void Dbacc::initData()
void Dbacc::initRecords()
{
// Records with dynamic sizes
+ page8 = (Page8*)allocRecord("Page8",
+ sizeof(Page8),
+ cpagesize,
+ false);
+
+ operationrec = (Operationrec*)allocRecord("Operationrec",
+ sizeof(Operationrec),
+ coprecsize);
+
dirRange = (DirRange*)allocRecord("DirRange",
sizeof(DirRange),
cdirrangesize);
+ undopage = (Undopage*)allocRecord("Undopage",
+ sizeof(Undopage),
+ cundopagesize,
+ false);
+
directoryarray = (Directoryarray*)allocRecord("Directoryarray",
sizeof(Directoryarray),
cdirarraysize);
@@ -83,19 +97,10 @@ void Dbacc::initRecords()
sizeof(LcpConnectrec),
clcpConnectsize);
- operationrec = (Operationrec*)allocRecord("Operationrec",
- sizeof(Operationrec),
- coprecsize);
-
overflowRecord = (OverflowRecord*)allocRecord("OverflowRecord",
sizeof(OverflowRecord),
coverflowrecsize);
- page8 = (Page8*)allocRecord("Page8",
- sizeof(Page8),
- cpagesize,
- false);
-
rootfragmentrec = (Rootfragmentrec*)allocRecord("Rootfragmentrec",
sizeof(Rootfragmentrec),
crootfragmentsize);
@@ -112,11 +117,6 @@ void Dbacc::initRecords()
sizeof(Tabrec),
ctablesize);
- undopage = (Undopage*)allocRecord("Undopage",
- sizeof(Undopage),
- cundopagesize,
- false);
-
// Initialize BAT for interface to file system
NewVARIABLE* bat = allocateBat(3);
@@ -136,25 +136,8 @@ Dbacc::Dbacc(const class Configuration & conf):
SimulatedBlock(DBACC, conf),
c_tup(0)
{
- Uint32 log_page_size= 0;
BLOCK_CONSTRUCTOR(Dbacc);
- const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
- ndbrequire(p != 0);
-
- ndb_mgm_get_int_parameter(p, CFG_DB_UNDO_INDEX_BUFFER,
- &log_page_size);
-
- /**
- * Always set page size in half MBytes
- */
- cundopagesize= (log_page_size / sizeof(Undopage));
- Uint32 mega_byte_part= cundopagesize & 15;
- if (mega_byte_part != 0) {
- jam();
- cundopagesize+= (16 - mega_byte_part);
- }
-
// Transit signals
addRecSignal(GSN_DUMP_STATE_ORD, &Dbacc::execDUMP_STATE_ORD);
addRecSignal(GSN_DEBUG_SIG, &Dbacc::execDEBUG_SIG);
diff --git a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
index 0501b866f53..18c44134255 100644
--- a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
+++ b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
@@ -679,6 +679,20 @@ void Dbacc::execREAD_CONFIG_REQ(Signal* signal)
theConfiguration.getOwnConfigIterator();
ndbrequire(p != 0);
+ Uint32 log_page_size= 0;
+ ndb_mgm_get_int_parameter(p, CFG_DB_UNDO_INDEX_BUFFER,
+ &log_page_size);
+
+ /**
+ * Always set page size in half MBytes
+ */
+ cundopagesize= (log_page_size / sizeof(Undopage));
+ Uint32 mega_byte_part= cundopagesize & 15;
+ if (mega_byte_part != 0) {
+ jam();
+ cundopagesize+= (16 - mega_byte_part);
+ }
+
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_ACC_DIR_RANGE, &cdirrangesize));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_ACC_DIR_ARRAY, &cdirarraysize));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_ACC_FRAGMENT, &cfragmentsize));
diff --git a/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp b/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp
index 1c14163fe76..051832998d6 100644
--- a/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp
+++ b/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp
@@ -262,8 +262,6 @@ Dbdih::Dbdih(const class Configuration & config):
addRecSignal(GSN_CREATE_FRAGMENTATION_REQ,
&Dbdih::execCREATE_FRAGMENTATION_REQ);
-
- initData();
}//Dbdih::Dbdih()
Dbdih::~Dbdih()
diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
index 92959eb5552..c328499cd33 100644
--- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
+++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
@@ -1053,6 +1053,8 @@ void Dbdih::execREAD_CONFIG_REQ(Signal* signal)
theConfiguration.getOwnConfigIterator();
ndbrequireErr(p != 0, NDBD_EXIT_INVALID_CONFIG);
+ initData();
+
ndbrequireErr(!ndb_mgm_get_int_parameter(p, CFG_DIH_API_CONNECT,
&capiConnectFileSize),
NDBD_EXIT_INVALID_CONFIG);
diff --git a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp
index f99b4bf15af..75f5b89da01 100644
--- a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp
+++ b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp
@@ -291,8 +291,6 @@ Dbtc::Dbtc(const class Configuration & conf):
addRecSignal(GSN_ALTER_TAB_REQ, &Dbtc::execALTER_TAB_REQ);
- initData();
-
#ifdef VM_TRACE
{
void* tmp[] = { &apiConnectptr,
diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
index e61ec45b18d..c8bed77712a 100644
--- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
@@ -608,6 +608,8 @@ void Dbtc::execREAD_CONFIG_REQ(Signal* signal)
theConfiguration.getOwnConfigIterator();
ndbrequire(p != 0);
+ initData();
+
UintR apiConnect;
UintR tcConnect;
UintR tables;
diff --git a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
index 52ac96bc5d3..cd8a1777567 100644
--- a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
+++ b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
@@ -75,25 +75,8 @@ Dbtup::Dbtup(const class Configuration & conf)
c_storedProcPool(),
c_buildIndexList(c_buildIndexPool)
{
- Uint32 log_page_size= 0;
BLOCK_CONSTRUCTOR(Dbtup);
- const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
- ndbrequire(p != 0);
-
- ndb_mgm_get_int_parameter(p, CFG_DB_UNDO_DATA_BUFFER,
- &log_page_size);
-
- /**
- * Always set page size in half MBytes
- */
- cnoOfUndoPage= (log_page_size / sizeof(UndoPage));
- Uint32 mega_byte_part= cnoOfUndoPage & 15;
- if (mega_byte_part != 0) {
- jam();
- cnoOfUndoPage+= (16 - mega_byte_part);
- }
-
addRecSignal(GSN_DEBUG_SIG, &Dbtup::execDEBUG_SIG);
addRecSignal(GSN_CONTINUEB, &Dbtup::execCONTINUEB);
@@ -603,6 +586,20 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
theConfiguration.getOwnConfigIterator();
ndbrequire(p != 0);
+ Uint32 log_page_size= 0;
+ ndb_mgm_get_int_parameter(p, CFG_DB_UNDO_DATA_BUFFER,
+ &log_page_size);
+
+ /**
+ * Always set page size in half MBytes
+ */
+ cnoOfUndoPage= (log_page_size / sizeof(UndoPage));
+ Uint32 mega_byte_part= cnoOfUndoPage & 15;
+ if (mega_byte_part != 0) {
+ jam();
+ cnoOfUndoPage+= (16 - mega_byte_part);
+ }
+
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_FRAG, &cnoOfFragrec));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_OP_RECS, &cnoOfOprec));
@@ -622,16 +619,19 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TRIGGERS,
&noOfTriggers));
+ Uint32 nScanOp; // use TUX config for now
+ ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_SCAN_OP, &nScanOp));
+
+
cnoOfTabDescrRec = (cnoOfTabDescrRec & 0xFFFFFFF0) + 16;
+
+ initRecords();
+
c_storedProcPool.setSize(noOfStoredProc);
c_buildIndexPool.setSize(c_noOfBuildIndexRec);
c_triggerPool.setSize(noOfTriggers);
-
- Uint32 nScanOp; // use TUX config for now
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_SCAN_OP, &nScanOp));
c_scanOpPool.setSize(nScanOp);
- initRecords();
czero = 0;
cminusOne = czero - 1;
clastBitMask = 1;
@@ -656,6 +656,19 @@ void Dbtup::initRecords()
unsigned i;
// Records with dynamic sizes
+ page = (Page*)allocRecord("Page",
+ sizeof(Page),
+ cnoOfPage,
+ false);
+
+ undoPage = (UndoPage*)allocRecord("UndoPage",
+ sizeof(UndoPage),
+ cnoOfUndoPage);
+
+ operationrec = (Operationrec*)allocRecord("Operationrec",
+ sizeof(Operationrec),
+ cnoOfOprec);
+
attrbufrec = (Attrbufrec*)allocRecord("Attrbufrec",
sizeof(Attrbufrec),
cnoOfAttrbufrec);
@@ -690,15 +703,6 @@ void Dbtup::initRecords()
sizeof(LocalLogInfo),
cnoOfParallellUndoFiles);
- operationrec = (Operationrec*)allocRecord("Operationrec",
- sizeof(Operationrec),
- cnoOfOprec);
-
- page = (Page*)allocRecord("Page",
- sizeof(Page),
- cnoOfPage,
- false);
-
pageRange = (PageRange*)allocRecord("PageRange",
sizeof(PageRange),
cnoOfPageRangeRec);
@@ -728,11 +732,6 @@ void Dbtup::initRecords()
sizeof(TableDescriptor),
cnoOfTabDescrRec);
- undoPage = (UndoPage*)allocRecord("UndoPage",
- sizeof(UndoPage),
- cnoOfUndoPage);
-
-
// Initialize BAT for interface to file system
NewVARIABLE* bat = allocateBat(3);
bat[1].WA = &page->pageWord[0];
diff --git a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
index b94bb8e6d7e..0f45c407d83 100644
--- a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
+++ b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
@@ -60,6 +60,7 @@ DbUtil::DbUtil(const Configuration & conf) :
BLOCK_CONSTRUCTOR(DbUtil);
// Add received signals
+ addRecSignal(GSN_READ_CONFIG_REQ, &DbUtil::execREAD_CONFIG_REQ);
addRecSignal(GSN_STTOR, &DbUtil::execSTTOR);
addRecSignal(GSN_NDB_STTOR, &DbUtil::execNDB_STTOR);
addRecSignal(GSN_DUMP_STATE_ORD, &DbUtil::execDUMP_STATE_ORD);
@@ -111,47 +112,6 @@ DbUtil::DbUtil(const Configuration & conf) :
addRecSignal(GSN_UTIL_RELEASE_REQ, &DbUtil::execUTIL_RELEASE_REQ);
addRecSignal(GSN_UTIL_RELEASE_CONF, &DbUtil::execUTIL_RELEASE_CONF);
addRecSignal(GSN_UTIL_RELEASE_REF, &DbUtil::execUTIL_RELEASE_REF);
-
- c_pagePool.setSize(10);
- c_preparePool.setSize(1); // one parallel prepare at a time
- c_preparedOperationPool.setSize(5); // three hardcoded, two for test
- c_operationPool.setSize(64); // 64 parallel operations
- c_transactionPool.setSize(32); // 16 parallel transactions
- c_attrMappingPool.setSize(100);
- c_dataBufPool.setSize(6000); // 6000*11*4 = 264K > 8k+8k*16 = 256k
- {
- SLList<Prepare> tmp(c_preparePool);
- PreparePtr ptr;
- while(tmp.seize(ptr))
- new (ptr.p) Prepare(c_pagePool);
- tmp.release();
- }
- {
- SLList<Operation> tmp(c_operationPool);
- OperationPtr ptr;
- while(tmp.seize(ptr))
- new (ptr.p) Operation(c_dataBufPool, c_dataBufPool, c_dataBufPool);
- tmp.release();
- }
- {
- SLList<PreparedOperation> tmp(c_preparedOperationPool);
- PreparedOperationPtr ptr;
- while(tmp.seize(ptr))
- new (ptr.p) PreparedOperation(c_attrMappingPool,
- c_dataBufPool, c_dataBufPool);
- tmp.release();
- }
- {
- SLList<Transaction> tmp(c_transactionPool);
- TransactionPtr ptr;
- while(tmp.seize(ptr))
- new (ptr.p) Transaction(c_pagePool, c_operationPool);
- tmp.release();
- }
-
- c_lockQueuePool.setSize(5);
- c_lockElementPool.setSize(5);
- c_lockQueues.setSize(8);
}
DbUtil::~DbUtil()
@@ -197,6 +157,68 @@ DbUtil::releaseTransaction(TransactionPtr transPtr){
c_runningTransactions.release(transPtr);
}
+void
+DbUtil::execREAD_CONFIG_REQ(Signal* signal)
+{
+ jamEntry();
+
+ const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
+
+ Uint32 ref = req->senderRef;
+ Uint32 senderData = req->senderData;
+
+ const ndb_mgm_configuration_iterator * p =
+ theConfiguration.getOwnConfigIterator();
+ ndbrequire(p != 0);
+
+ c_pagePool.setSize(10);
+ c_preparePool.setSize(1); // one parallel prepare at a time
+ c_preparedOperationPool.setSize(5); // three hardcoded, two for test
+ c_operationPool.setSize(64); // 64 parallel operations
+ c_transactionPool.setSize(32); // 16 parallel transactions
+ c_attrMappingPool.setSize(100);
+ c_dataBufPool.setSize(6000); // 6000*11*4 = 264K > 8k+8k*16 = 256k
+ {
+ SLList<Prepare> tmp(c_preparePool);
+ PreparePtr ptr;
+ while(tmp.seize(ptr))
+ new (ptr.p) Prepare(c_pagePool);
+ tmp.release();
+ }
+ {
+ SLList<Operation> tmp(c_operationPool);
+ OperationPtr ptr;
+ while(tmp.seize(ptr))
+ new (ptr.p) Operation(c_dataBufPool, c_dataBufPool, c_dataBufPool);
+ tmp.release();
+ }
+ {
+ SLList<PreparedOperation> tmp(c_preparedOperationPool);
+ PreparedOperationPtr ptr;
+ while(tmp.seize(ptr))
+ new (ptr.p) PreparedOperation(c_attrMappingPool,
+ c_dataBufPool, c_dataBufPool);
+ tmp.release();
+ }
+ {
+ SLList<Transaction> tmp(c_transactionPool);
+ TransactionPtr ptr;
+ while(tmp.seize(ptr))
+ new (ptr.p) Transaction(c_pagePool, c_operationPool);
+ tmp.release();
+ }
+
+ c_lockQueuePool.setSize(5);
+ c_lockElementPool.setSize(5);
+ c_lockQueues.setSize(8);
+
+ ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = senderData;
+ sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
+ ReadConfigConf::SignalLength, JBB);
+}
+
void
DbUtil::execSTTOR(Signal* signal)
{
diff --git a/ndb/src/kernel/blocks/dbutil/DbUtil.hpp b/ndb/src/kernel/blocks/dbutil/DbUtil.hpp
index 5499970fde3..983dd4402a4 100644
--- a/ndb/src/kernel/blocks/dbutil/DbUtil.hpp
+++ b/ndb/src/kernel/blocks/dbutil/DbUtil.hpp
@@ -69,6 +69,7 @@ protected:
/**
* Startup & Misc
*/
+ void execREAD_CONFIG_REQ(Signal* signal);
void execSTTOR(Signal* signal);
void execNDB_STTOR(Signal* signal);
void execDUMP_STATE_ORD(Signal* signal);
diff --git a/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp b/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp
index 657133bda36..7c074c9675c 100644
--- a/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp
+++ b/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp
@@ -173,6 +173,7 @@ private:
// Received signals
void execDUMP_STATE_ORD(Signal* signal);
+ void execREAD_CONFIG_REQ(Signal* signal);
void execSTTOR(Signal* signal);
void execTCSEIZECONF(Signal* signal);
void execTCSEIZEREF(Signal* signal);
diff --git a/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp b/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp
index 97ca3f44b3a..5a939818d16 100644
--- a/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp
+++ b/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp
@@ -60,6 +60,7 @@ Ndbcntr::Ndbcntr(const class Configuration & conf):
// Received signals
addRecSignal(GSN_DUMP_STATE_ORD, &Ndbcntr::execDUMP_STATE_ORD);
+ addRecSignal(GSN_READ_CONFIG_REQ, &Ndbcntr::execREAD_CONFIG_REQ);
addRecSignal(GSN_STTOR, &Ndbcntr::execSTTOR);
addRecSignal(GSN_TCSEIZECONF, &Ndbcntr::execTCSEIZECONF);
addRecSignal(GSN_TCSEIZEREF, &Ndbcntr::execTCSEIZEREF);
diff --git a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
index e4126031a83..27fa0ac6362 100644
--- a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
+++ b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
@@ -85,6 +85,24 @@ static BlockInfo ALL_BLOCKS[] = {
static const Uint32 ALL_BLOCKS_SZ = sizeof(ALL_BLOCKS)/sizeof(BlockInfo);
+static BlockReference readConfigOrder[ALL_BLOCKS_SZ] = {
+ DBTUP_REF,
+ DBACC_REF,
+ DBTC_REF,
+ DBLQH_REF,
+ DBTUX_REF,
+ DBDICT_REF,
+ DBDIH_REF,
+ NDBFS_REF,
+ NDBCNTR_REF,
+ QMGR_REF,
+ CMVMI_REF,
+ TRIX_REF,
+ BACKUP_REF,
+ DBUTIL_REF,
+ SUMA_REF
+};
+
/*******************************/
/* CONTINUEB */
/*******************************/
@@ -201,6 +219,27 @@ void Ndbcntr::execSYSTEM_ERROR(Signal* signal)
return;
}//Ndbcntr::execSYSTEM_ERROR()
+void
+Ndbcntr::execREAD_CONFIG_REQ(Signal* signal)
+{
+ jamEntry();
+
+ const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
+
+ Uint32 ref = req->senderRef;
+ Uint32 senderData = req->senderData;
+
+ const ndb_mgm_configuration_iterator * p =
+ theConfiguration.getOwnConfigIterator();
+ ndbrequire(p != 0);
+
+ ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = senderData;
+ sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
+ ReadConfigConf::SignalLength, JBB);
+}
+
void Ndbcntr::execSTTOR(Signal* signal)
{
jamEntry();
@@ -2458,7 +2497,7 @@ void Ndbcntr::Missra::sendNextREAD_CONFIG_REQ(Signal* signal){
req->senderRef = cntr.reference();
req->noOfParameters = 0;
- const BlockReference ref = ALL_BLOCKS[currentBlockIndex].Ref;
+ const BlockReference ref = readConfigOrder[currentBlockIndex];
#if 0
ndbout_c("sending READ_CONFIG_REQ to %s(ref=%x index=%d)",
@@ -2489,7 +2528,8 @@ void Ndbcntr::Missra::execREAD_CONFIG_CONF(Signal* signal){
const ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtr();
const Uint32 ref = conf->senderRef;
- ndbrequire(refToBlock(ALL_BLOCKS[currentBlockIndex].Ref) == refToBlock(ref));
+ ndbrequire(refToBlock(readConfigOrder[currentBlockIndex])
+ == refToBlock(ref));
currentBlockIndex++;
sendNextREAD_CONFIG_REQ(signal);
diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
index 1457dd31abb..ddf16024017 100644
--- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
@@ -22,7 +22,7 @@
#include <ErrorHandlingMacros.hpp>
#include <kernel_types.h>
-#include <NdbMem.h>
+#include <ndbd_malloc.hpp>
#include <NdbThread.h>
#include <signaldata/FsOpenReq.hpp>
@@ -161,7 +161,7 @@ AsyncFile::run()
theStartFlag = true;
// Create write buffer for bigger writes
theWriteBufferSize = WRITEBUFFERSIZE;
- theWriteBuffer = (char *) NdbMem_Allocate(theWriteBufferSize);
+ theWriteBuffer = (char *) ndbd_malloc(theWriteBufferSize);
NdbMutex_Unlock(theStartMutexPtr);
NdbCondition_Signal(theStartConditionPtr);
@@ -512,7 +512,7 @@ AsyncFile::extendfile(Request* request) {
DEBUG(ndbout_c("extendfile: maxOffset=%d, size=%d", maxOffset, maxSize));
// Allocate a buffer and fill it with zeros
- void* pbuf = NdbMem_Allocate(maxSize);
+ void* pbuf = ndbd_malloc(maxSize);
memset(pbuf, 0, maxSize);
for (int p = 0; p <= maxOffset; p = p + maxSize) {
int return_value;
@@ -520,16 +520,18 @@ AsyncFile::extendfile(Request* request) {
p,
SEEK_SET);
if((return_value == -1 ) || (return_value != p)) {
+ ndbd_free(pbuf,maxSize);
return -1;
}
return_value = ::write(theFd,
pbuf,
maxSize);
if ((return_value == -1) || (return_value != maxSize)) {
+ ndbd_free(pbuf,maxSize);
return -1;
}
}
- free(pbuf);
+ ndbd_free(pbuf,maxSize);
DEBUG(ndbout_c("extendfile: \"%s\" OK!", theFileName.c_str()));
return 0;
@@ -879,7 +881,7 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){
void AsyncFile::endReq()
{
// Thread is ended with return
- if (theWriteBuffer) NdbMem_Free(theWriteBuffer);
+ if (theWriteBuffer) ndbd_free(theWriteBuffer, theWriteBufferSize);
}
diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
index 784a46fe9c9..40a7f14bb5d 100644
--- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
@@ -56,26 +56,10 @@ Ndbfs::Ndbfs(const Configuration & conf) :
theLastId(0),
m_maxOpenedFiles(0)
{
- theFileSystemPath = conf.fileSystemPath();
- theBackupFilePath = conf.backupFilePath();
-
- theRequestPool = new Pool<Request>;
-
- const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
- ndbrequire(p != 0);
-
- m_maxFiles = 40;
- ndb_mgm_get_int_parameter(p, CFG_DB_MAX_OPEN_FILES, &m_maxFiles);
-
- // Create idle AsyncFiles
- Uint32 noIdleFiles = m_maxFiles > 27 ? 27 : m_maxFiles ;
- for (Uint32 i = 0; i < noIdleFiles; i++){
- theIdleFiles.push_back(createAsyncFile());
- }
-
BLOCK_CONSTRUCTOR(Ndbfs);
// Set received signals
+ addRecSignal(GSN_READ_CONFIG_REQ, &Ndbfs::execREAD_CONFIG_REQ);
addRecSignal(GSN_DUMP_STATE_ORD, &Ndbfs::execDUMP_STATE_ORD);
addRecSignal(GSN_STTOR, &Ndbfs::execSTTOR);
addRecSignal(GSN_FSOPENREQ, &Ndbfs::execFSOPENREQ);
@@ -104,6 +88,39 @@ Ndbfs::~Ndbfs()
delete theRequestPool;
}
+void
+Ndbfs::execREAD_CONFIG_REQ(Signal* signal)
+{
+ const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
+
+ Uint32 ref = req->senderRef;
+ Uint32 senderData = req->senderData;
+
+ const ndb_mgm_configuration_iterator * p =
+ theConfiguration.getOwnConfigIterator();
+ ndbrequire(p != 0);
+
+ theFileSystemPath = theConfiguration.fileSystemPath();
+ theBackupFilePath = theConfiguration.backupFilePath();
+
+ theRequestPool = new Pool<Request>;
+
+ m_maxFiles = 40;
+ ndb_mgm_get_int_parameter(p, CFG_DB_MAX_OPEN_FILES, &m_maxFiles);
+
+ // Create idle AsyncFiles
+ Uint32 noIdleFiles = m_maxFiles > 27 ? 27 : m_maxFiles ;
+ for (Uint32 i = 0; i < noIdleFiles; i++){
+ theIdleFiles.push_back(createAsyncFile());
+ }
+
+ ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = senderData;
+ sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
+ ReadConfigConf::SignalLength, JBB);
+}
+
/* Received a restart signal.
* Answer it like any other block
* PR0 : StartCase
diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
index c5aaa4e5c49..4af2da25872 100644
--- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
+++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
@@ -41,6 +41,7 @@ protected:
BLOCK_DEFINES(Ndbfs);
// The signal processing functions
+ void execREAD_CONFIG_REQ(Signal* signal);
void execDUMP_STATE_ORD(Signal* signal);
void execFSOPENREQ(Signal* signal);
void execFSCLOSEREQ(Signal* signal);
diff --git a/ndb/src/kernel/blocks/qmgr/Qmgr.hpp b/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
index f84fae02fc4..4a17d56d31e 100644
--- a/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
+++ b/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
@@ -209,6 +209,7 @@ private:
void execDUMP_STATE_ORD(Signal* signal);
void execCONNECT_REP(Signal* signal);
void execNDB_FAILCONF(Signal* signal);
+ void execREAD_CONFIG_REQ(Signal* signal);
void execSTTOR(Signal* signal);
void execCM_INFOCONF(Signal* signal);
void execCLOSE_COMCONF(Signal* signal);
diff --git a/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp b/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp
index 4061455092d..751641ae896 100644
--- a/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp
+++ b/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp
@@ -75,6 +75,7 @@ Qmgr::Qmgr(const class Configuration & conf)
// Received signals
addRecSignal(GSN_CONNECT_REP, &Qmgr::execCONNECT_REP);
addRecSignal(GSN_NDB_FAILCONF, &Qmgr::execNDB_FAILCONF);
+ addRecSignal(GSN_READ_CONFIG_REQ, &Qmgr::execREAD_CONFIG_REQ);
addRecSignal(GSN_STTOR, &Qmgr::execSTTOR);
addRecSignal(GSN_CLOSE_COMCONF, &Qmgr::execCLOSE_COMCONF);
addRecSignal(GSN_API_REGREQ, &Qmgr::execAPI_REGREQ);
diff --git a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
index e0eb40e5528..3e00ab98450 100644
--- a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
+++ b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
@@ -166,6 +166,27 @@ void Qmgr::execPRES_TOREQ(Signal* signal)
return;
}//Qmgr::execPRES_TOREQ()
+void
+Qmgr::execREAD_CONFIG_REQ(Signal* signal)
+{
+ jamEntry();
+
+ const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
+
+ Uint32 ref = req->senderRef;
+ Uint32 senderData = req->senderData;
+
+ const ndb_mgm_configuration_iterator * p =
+ theConfiguration.getOwnConfigIterator();
+ ndbrequire(p != 0);
+
+ ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = senderData;
+ sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
+ ReadConfigConf::SignalLength, JBB);
+}
+
/*
4.2 ADD NODE MODULE*/
/*##########################################################################*/
diff --git a/ndb/src/kernel/blocks/suma/Suma.cpp b/ndb/src/kernel/blocks/suma/Suma.cpp
index c4225ad2a4c..3644bc0a03f 100644
--- a/ndb/src/kernel/blocks/suma/Suma.cpp
+++ b/ndb/src/kernel/blocks/suma/Suma.cpp
@@ -120,6 +120,64 @@ Suma::getNodeGroupMembers(Signal* signal) {
#endif
}
+void
+Suma::execREAD_CONFIG_REQ(Signal* signal)
+{
+ jamEntry();
+
+ const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
+
+ Uint32 ref = req->senderRef;
+ Uint32 senderData = req->senderData;
+
+ const ndb_mgm_configuration_iterator * p =
+ theConfiguration.getOwnConfigIterator();
+ ndbrequire(p != 0);
+
+ // SumaParticipant
+ Uint32 noTables;
+ ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES,
+ &noTables);
+
+ /**
+ * @todo: fix pool sizes
+ */
+ c_tablePool_.setSize(noTables);
+ c_tables.setSize(noTables);
+
+ c_subscriptions.setSize(20); //10
+ c_subscriberPool.setSize(64);
+
+ c_subscriptionPool.setSize(64); //2
+ c_syncPool.setSize(20); //2
+ c_dataBufferPool.setSize(128);
+
+ {
+ SLList<SyncRecord> tmp(c_syncPool);
+ Ptr<SyncRecord> ptr;
+ while(tmp.seize(ptr))
+ new (ptr.p) SyncRecord(* this, c_dataBufferPool);
+ tmp.release();
+ }
+
+ // Suma
+ c_nodePool.setSize(MAX_NDB_NODES);
+ c_masterNodeId = getOwnNodeId();
+
+ c_nodeGroup = c_noNodesInGroup = c_idInNodeGroup = 0;
+ for (int i = 0; i < MAX_REPLICAS; i++) {
+ c_nodesInGroup[i] = 0;
+ }
+
+ c_subCoordinatorPool.setSize(10);
+
+ ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = senderData;
+ sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
+ ReadConfigConf::SignalLength, JBB);
+}
+
void
Suma::execSTTOR(Signal* signal) {
jamEntry();
@@ -272,40 +330,6 @@ Suma::execREAD_NODESCONF(Signal* signal){
sendSTTORRY(signal);
}
-#if 0
-void
-Suma::execREAD_CONFIG_REQ(Signal* signal)
-{
- const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
- Uint32 ref = req->senderRef;
- Uint32 senderData = req->senderData;
- ndbrequire(req->noOfParameters == 0);
-
- jamEntry();
-
- const ndb_mgm_configuration_iterator * p =
- theConfiguration.getOwnConfigIterator();
- ndbrequire(p != 0);
-
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_REDOLOG_FILES,
- &cnoLogFiles));
- ndbrequire(cnoLogFiles > 0);
-
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_FRAG, &cfragrecFileSize));
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_TABLE, &ctabrecFileSize));
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_TC_CONNECT,
- &ctcConnectrecFileSize));
- clogFileFileSize = 4 * cnoLogFiles;
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_SCAN, &cscanrecFileSize));
- cmaxAccOps = cscanrecFileSize * MAX_PARALLEL_SCANS_PER_FRAG;
-
- initRecords();
- initialiseRecordsLab(signal, 0, ref, senderData);
-
- return;
-}//Dblqh::execSIZEALT_REP()
-#endif
-
void
Suma::sendSTTORRY(Signal* signal){
signal->theData[0] = 0;
diff --git a/ndb/src/kernel/blocks/suma/Suma.hpp b/ndb/src/kernel/blocks/suma/Suma.hpp
index 65869f44423..0638bd4a006 100644
--- a/ndb/src/kernel/blocks/suma/Suma.hpp
+++ b/ndb/src/kernel/blocks/suma/Suma.hpp
@@ -442,6 +442,8 @@ private:
void getNodeGroupMembers(Signal* signal);
+ void execREAD_CONFIG_REQ(Signal* signal);
+
void execSTTOR(Signal* signal);
void sendSTTORRY(Signal*);
void execNDB_STTOR(Signal* signal);
diff --git a/ndb/src/kernel/blocks/suma/SumaInit.cpp b/ndb/src/kernel/blocks/suma/SumaInit.cpp
index b5945db3811..ad8493ff908 100644
--- a/ndb/src/kernel/blocks/suma/SumaInit.cpp
+++ b/ndb/src/kernel/blocks/suma/SumaInit.cpp
@@ -90,34 +90,6 @@ SumaParticipant::SumaParticipant(const Configuration & conf) :
addRecSignal(GSN_SUB_GCP_COMPLETE_REP,
&SumaParticipant::execSUB_GCP_COMPLETE_REP);
- /**
- * @todo: fix pool sizes
- */
- Uint32 noTables;
- const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
- ndbrequire(p != 0);
-
- ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES,
- &noTables);
-
- c_tablePool_.setSize(noTables);
- c_tables.setSize(noTables);
-
- c_subscriptions.setSize(20); //10
- c_subscriberPool.setSize(64);
-
- c_subscriptionPool.setSize(64); //2
- c_syncPool.setSize(20); //2
- c_dataBufferPool.setSize(128);
-
- {
- SLList<SyncRecord> tmp(c_syncPool);
- Ptr<SyncRecord> ptr;
- while(tmp.seize(ptr))
- new (ptr.p) SyncRecord(* this, c_dataBufferPool);
- tmp.release();
- }
-
for( int i = 0; i < NO_OF_BUCKETS; i++) {
c_buckets[i].active = false;
c_buckets[i].handover = false;
@@ -142,18 +114,8 @@ Suma::Suma(const Configuration & conf) :
c_nodes(c_nodePool),
c_runningSubscriptions(c_subCoordinatorPool)
{
-
- c_nodePool.setSize(MAX_NDB_NODES);
- c_masterNodeId = getOwnNodeId();
-
- c_nodeGroup = c_noNodesInGroup = c_idInNodeGroup = 0;
- for (int i = 0; i < MAX_REPLICAS; i++) {
- c_nodesInGroup[i] = 0;
- }
-
- c_subCoordinatorPool.setSize(10);
-
// Add received signals
+ addRecSignal(GSN_READ_CONFIG_REQ, &Suma::execREAD_CONFIG_REQ);
addRecSignal(GSN_STTOR, &Suma::execSTTOR);
addRecSignal(GSN_NDB_STTOR, &Suma::execNDB_STTOR);
addRecSignal(GSN_DUMP_STATE_ORD, &Suma::execDUMP_STATE_ORD);
diff --git a/ndb/src/kernel/blocks/trix/Trix.cpp b/ndb/src/kernel/blocks/trix/Trix.cpp
index cd11cb4d575..1d6e5adad62 100644
--- a/ndb/src/kernel/blocks/trix/Trix.cpp
+++ b/ndb/src/kernel/blocks/trix/Trix.cpp
@@ -52,6 +52,7 @@ Trix::Trix(const Configuration & conf) :
BLOCK_CONSTRUCTOR(Trix);
// Add received signals
+ addRecSignal(GSN_READ_CONFIG_REQ, &Trix::execREAD_CONFIG_REQ);
addRecSignal(GSN_STTOR, &Trix::execSTTOR);
addRecSignal(GSN_NDB_STTOR, &Trix::execNDB_STTOR); // Forwarded from DICT
addRecSignal(GSN_READ_NODESCONF, &Trix::execREAD_NODESCONF);
@@ -85,6 +86,28 @@ Trix::Trix(const Configuration & conf) :
addRecSignal(GSN_SUB_SYNC_CONTINUE_REQ, &Trix::execSUB_SYNC_CONTINUE_REQ);
addRecSignal(GSN_SUB_META_DATA, &Trix::execSUB_META_DATA);
addRecSignal(GSN_SUB_TABLE_DATA, &Trix::execSUB_TABLE_DATA);
+}
+
+/**
+ *
+ */
+Trix::~Trix()
+{
+}
+
+void
+Trix::execREAD_CONFIG_REQ(Signal* signal)
+{
+ jamEntry();
+
+ const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
+
+ Uint32 ref = req->senderRef;
+ Uint32 senderData = req->senderData;
+
+ const ndb_mgm_configuration_iterator * p =
+ theConfiguration.getOwnConfigIterator();
+ ndbrequire(p != 0);
// Allocate pool sizes
c_theAttrOrderBufferPool.setSize(100);
@@ -96,13 +119,12 @@ Trix::Trix(const Configuration & conf) :
new (subptr.p) SubscriptionRecord(c_theAttrOrderBufferPool);
}
subscriptions.release();
-}
-/**
- *
- */
-Trix::~Trix()
-{
+ ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = senderData;
+ sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
+ ReadConfigConf::SignalLength, JBB);
}
/**
diff --git a/ndb/src/kernel/blocks/trix/Trix.hpp b/ndb/src/kernel/blocks/trix/Trix.hpp
index 8dc01375fa1..78c5b8b35c3 100644
--- a/ndb/src/kernel/blocks/trix/Trix.hpp
+++ b/ndb/src/kernel/blocks/trix/Trix.hpp
@@ -139,6 +139,7 @@ private:
ArrayList<SubscriptionRecord> c_theSubscriptions;
// System start
+ void execREAD_CONFIG_REQ(Signal* signal);
void execSTTOR(Signal* signal);
void execNDB_STTOR(Signal* signal);
diff --git a/ndb/src/kernel/vm/ArrayPool.hpp b/ndb/src/kernel/vm/ArrayPool.hpp
index f50617d9d7f..3b1264af8be 100644
--- a/ndb/src/kernel/vm/ArrayPool.hpp
+++ b/ndb/src/kernel/vm/ArrayPool.hpp
@@ -18,6 +18,7 @@
#define ARRAY_POOL_HPP
#include <ndb_global.h>
+#include "ndbd_malloc.hpp"
#include <pc.hpp>
#include <ErrorReporter.hpp>
@@ -201,7 +202,7 @@ template <class T>
inline
ArrayPool<T>::~ArrayPool(){
if(theArray != 0){
- NdbMem_Free(theArray);
+ ndbd_free(theArray, size * sizeof(T));
theArray = 0;
#ifdef ARRAY_GUARD
delete []theAllocatedBitmask;
@@ -222,7 +223,7 @@ ArrayPool<T>::setSize(Uint32 noOfElements, bool exit_on_error){
if(size == 0){
if(noOfElements == 0)
return true;
- theArray = (T *)NdbMem_Allocate(noOfElements * sizeof(T));
+ theArray = (T *)ndbd_malloc(noOfElements * sizeof(T));
if(theArray == 0)
{
if (!exit_on_error)
diff --git a/ndb/src/kernel/vm/CArray.hpp b/ndb/src/kernel/vm/CArray.hpp
index e8159da9a58..93f75056b50 100644
--- a/ndb/src/kernel/vm/CArray.hpp
+++ b/ndb/src/kernel/vm/CArray.hpp
@@ -17,6 +17,8 @@
#ifndef CARRAY_HPP
#define CARRAY_HPP
+#include "ndbd_malloc.hpp"
+
/**
* Template class used for implementing an c - array
*/
@@ -69,7 +71,7 @@ template <class T>
inline
CArray<T>::~CArray(){
if(theArray != 0){
- NdbMem_Free(theArray);
+ ndbd_free(theArray, size * sizeof(T));
theArray = 0;
}
}
@@ -86,7 +88,7 @@ CArray<T>::setSize(Uint32 noOfElements, bool exit_on_error){
if(size == noOfElements)
return true;
- theArray = (T *)NdbMem_Allocate(noOfElements * sizeof(T));
+ theArray = (T *)ndbd_malloc(noOfElements * sizeof(T));
if(theArray == 0)
{
if (!exit_on_error)
diff --git a/ndb/src/kernel/vm/Makefile.am b/ndb/src/kernel/vm/Makefile.am
index 0dce9285ae3..8f9bf92cb01 100644
--- a/ndb/src/kernel/vm/Makefile.am
+++ b/ndb/src/kernel/vm/Makefile.am
@@ -18,7 +18,7 @@ libkernel_a_SOURCES = \
SimplePropertiesSection.cpp \
SectionReader.cpp \
MetaData.cpp \
- Mutex.cpp SafeCounter.cpp
+ Mutex.cpp SafeCounter.cpp ndbd_malloc.cpp
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi
diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp
index 9e1cff7a0b2..d708052ca4e 100644
--- a/ndb/src/kernel/vm/SimulatedBlock.cpp
+++ b/ndb/src/kernel/vm/SimulatedBlock.cpp
@@ -25,7 +25,7 @@
#include <TransporterRegistry.hpp>
#include <SignalLoggerManager.hpp>
#include <FastScheduler.hpp>
-#include <NdbMem.h>
+#include "ndbd_malloc.hpp"
#include <signaldata/EventReport.hpp>
#include <signaldata/ContinueFragmented.hpp>
#include <signaldata/NodeStateSignalData.hpp>
@@ -141,7 +141,6 @@ SimulatedBlock::installSimulatedBlockFunctions(){
a[GSN_UTIL_LOCK_CONF] = &SimulatedBlock::execUTIL_LOCK_CONF;
a[GSN_UTIL_UNLOCK_REF] = &SimulatedBlock::execUTIL_UNLOCK_REF;
a[GSN_UTIL_UNLOCK_CONF] = &SimulatedBlock::execUTIL_UNLOCK_CONF;
- a[GSN_READ_CONFIG_REQ] = &SimulatedBlock::execREAD_CONFIG_REQ;
a[GSN_FSOPENREF] = &SimulatedBlock::execFSOPENREF;
a[GSN_FSCLOSEREF] = &SimulatedBlock::execFSCLOSEREF;
a[GSN_FSWRITEREF] = &SimulatedBlock::execFSWRITEREF;
@@ -668,7 +667,7 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
n,
size);
#endif
- p = NdbMem_Allocate(size);
+ p = ndbd_malloc(size);
if (p == NULL){
char buf1[255];
char buf2[255];
@@ -699,11 +698,9 @@ void
SimulatedBlock::deallocRecord(void ** ptr,
const char * type, size_t s, size_t n){
(void)type;
- (void)s;
- (void)n;
if(* ptr != 0){
- NdbMem_Free(* ptr);
+ ndbd_free(* ptr, n*s);
* ptr = 0;
}
}
@@ -1742,20 +1739,6 @@ void SimulatedBlock::execUTIL_UNLOCK_CONF(Signal* signal){
c_mutexMgr.execUTIL_UNLOCK_CONF(signal);
}
-void
-SimulatedBlock::execREAD_CONFIG_REQ(Signal* signal){
- const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
-
- Uint32 ref = req->senderRef;
- Uint32 senderData = req->senderData;
-
- ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
- conf->senderRef = reference();
- conf->senderData = senderData;
- sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
- ReadConfigConf::SignalLength, JBB);
-}
-
void
SimulatedBlock::ignoreMutexUnlockCallback(Signal* signal,
Uint32 ptrI, Uint32 retVal){
diff --git a/ndb/src/kernel/vm/SimulatedBlock.hpp b/ndb/src/kernel/vm/SimulatedBlock.hpp
index c1b540ff50c..ce77fa916d8 100644
--- a/ndb/src/kernel/vm/SimulatedBlock.hpp
+++ b/ndb/src/kernel/vm/SimulatedBlock.hpp
@@ -502,7 +502,6 @@ private:
void execUTIL_UNLOCK_REF(Signal* signal);
void execUTIL_UNLOCK_CONF(Signal* signal);
- void execREAD_CONFIG_REQ(Signal* signal);
protected:
void execUPGRADE(Signal* signal);
diff --git a/ndb/src/kernel/vm/ndbd_malloc.cpp b/ndb/src/kernel/vm/ndbd_malloc.cpp
new file mode 100644
index 00000000000..4bfccf828fc
--- /dev/null
+++ b/ndb/src/kernel/vm/ndbd_malloc.cpp
@@ -0,0 +1,63 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <ndb_global.h>
+#include "ndbd_malloc.hpp"
+#include <NdbMem.h>
+
+//#define TRACE_MALLOC
+#ifdef TRACE_MALLOC
+#include <stdio.h>
+#endif
+
+static void xxx(size_t size, size_t *s_m, size_t *s_k, size_t *s_b)
+{
+ *s_m = size/1024/1024;
+ *s_k = (size - *s_m*1024*1024)/1024;
+ *s_b = size - *s_m*1024*1024-*s_k*1024;
+}
+
+static Uint64 g_allocated_memory;
+void *ndbd_malloc(size_t size)
+{
+ void *p = NdbMem_Allocate(size);
+ if (p)
+ {
+ g_allocated_memory += size;
+#ifdef TRACE_MALLOC
+ {
+ size_t s_m, s_k, s_b;
+ xxx(size, &s_m, &s_k, &s_b);
+ fprintf(stderr, "%p malloc(%um %uk %ub)", p, s_m, s_k, s_b);
+ xxx(g_allocated_memory, &s_m, &s_k, &s_b);
+ fprintf(stderr, "\t\ttotal(%um %uk %ub)\n", s_m, s_k, s_b);
+ }
+#endif
+ }
+ return p;
+}
+
+void ndbd_free(void *p, size_t size)
+{
+ NdbMem_Free(p);
+ if (p)
+ {
+ g_allocated_memory -= size;
+#ifdef TRACE_MALLOC
+ fprintf(stderr, "%p free(%d)\n", p, size);
+#endif
+ }
+}
diff --git a/ndb/src/kernel/vm/ndbd_malloc.hpp b/ndb/src/kernel/vm/ndbd_malloc.hpp
new file mode 100644
index 00000000000..136e9f0c372
--- /dev/null
+++ b/ndb/src/kernel/vm/ndbd_malloc.hpp
@@ -0,0 +1,26 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef NDBD_MALLOC_H
+#define NDBD_MALLOC_H
+
+/**
+ * common memory allocation function for ndbd kernel
+ */
+void *ndbd_malloc(size_t size);
+void ndbd_free(void *p, size_t size);
+
+#endif