Commit 2ed29f93 authored by unknown's avatar unknown

new method to set size of local table data

clearer configure description texts
changed Ndb_local_table_info to use create, destroy metods and hidden constructor/destructor
move definition if Thd_ndb to .h file and changes seize/release to operate on Thd_ndb instead of Ndb objects
moved allocation/deletion of Ndb objects to Thd_ndb


ndb/include/ndbapi/NdbDictionary.hpp:
  new method to set size of local table data
ndb/src/mgmsrv/ConfigInfo.cpp:
  clearer configure description texts
ndb/src/ndbapi/DictCache.cpp:
  changed Ndb_local_table_info to use create, destroy metods and hidden constructor/destructor
ndb/src/ndbapi/DictCache.hpp:
  changed Ndb_local_table_info to use create, destroy metods and hidden constructor/destructor
ndb/src/ndbapi/NdbDictionary.cpp:
  new method to set size of local table data
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  new method to set size of local table data
ndb/src/ndbapi/NdbDictionaryImpl.hpp:
  new method to set size of local table data
sql/ha_ndbcluster.cc:
  new method to set size of local table data
  moved allocation/deletion of Ndb objects to Thd_ndb
sql/ha_ndbcluster.h:
  move definition if Thd_ndb to .h file and changes seize/release to operate on Thd_ndb instead of Ndb objects
parent 714667b4
...@@ -1068,6 +1068,7 @@ public: ...@@ -1068,6 +1068,7 @@ public:
const char * tableName); const char * tableName);
public: public:
const Table * getTable(const char * name, void **data); const Table * getTable(const char * name, void **data);
void set_local_table_data_size(unsigned sz);
}; };
}; };
......
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
* Section names * Section names
****************************************************************************/ ****************************************************************************/
#define DB_TOKEN_PRINT "ndbd(DB)"
#define MGM_TOKEN_PRINT "ndb_mgmd(MGM)"
#define API_TOKEN_PRINT "mysqld(API)"
#define DB_TOKEN "DB" #define DB_TOKEN "DB"
#define MGM_TOKEN "MGM" #define MGM_TOKEN "MGM"
#define API_TOKEN "API" #define API_TOKEN "API"
...@@ -327,7 +331,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -327,7 +331,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_SYS_PRIMARY_MGM_NODE, CFG_SYS_PRIMARY_MGM_NODE,
"PrimaryMGMNode", "PrimaryMGMNode",
"SYSTEM", "SYSTEM",
"Node id of Primary "MGM_TOKEN" node", "Node id of Primary "MGM_TOKEN_PRINT" node",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -388,7 +392,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -388,7 +392,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_NODE_ID, CFG_NODE_ID,
"Id", "Id",
DB_TOKEN, DB_TOKEN,
"Number identifying the database node ("DB_TOKEN")", "Number identifying the database node ("DB_TOKEN_PRINT")",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -484,7 +488,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -484,7 +488,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_NO_INDEX_OPS, CFG_DB_NO_INDEX_OPS,
"MaxNoOfConcurrentIndexOperations", "MaxNoOfConcurrentIndexOperations",
DB_TOKEN, DB_TOKEN,
"Total number of index operations that can execute simultaneously on one "DB_TOKEN" node", "Total number of index operations that can execute simultaneously on one "DB_TOKEN_PRINT" node",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -509,7 +513,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -509,7 +513,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_NO_TRIGGER_OPS, CFG_DB_NO_TRIGGER_OPS,
"MaxNoOfFiredTriggers", "MaxNoOfFiredTriggers",
DB_TOKEN, DB_TOKEN,
"Total number of triggers that can fire simultaneously in one "DB_TOKEN" node", "Total number of triggers that can fire simultaneously in one "DB_TOKEN_PRINT" node",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -568,7 +572,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -568,7 +572,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_STOP_ON_ERROR, CFG_DB_STOP_ON_ERROR,
"StopOnError", "StopOnError",
DB_TOKEN, DB_TOKEN,
"If set to N, "DB_TOKEN" automatically restarts/recovers in case of node failure", "If set to N, "DB_TOKEN_PRINT" automatically restarts/recovers in case of node failure",
ConfigInfo::USED, ConfigInfo::USED,
true, true,
ConfigInfo::BOOL, ConfigInfo::BOOL,
...@@ -640,7 +644,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -640,7 +644,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_NO_TRANSACTIONS, CFG_DB_NO_TRANSACTIONS,
"MaxNoOfConcurrentTransactions", "MaxNoOfConcurrentTransactions",
DB_TOKEN, DB_TOKEN,
"Max number of transaction executing concurrently on the "DB_TOKEN" node", "Max number of transaction executing concurrently on the "DB_TOKEN_PRINT" node",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -652,7 +656,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -652,7 +656,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_NO_SCANS, CFG_DB_NO_SCANS,
"MaxNoOfConcurrentScans", "MaxNoOfConcurrentScans",
DB_TOKEN, DB_TOKEN,
"Max number of scans executing concurrently on the "DB_TOKEN" node", "Max number of scans executing concurrently on the "DB_TOKEN_PRINT" node",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -664,7 +668,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -664,7 +668,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_TRANS_BUFFER_MEM, CFG_DB_TRANS_BUFFER_MEM,
"TransactionBufferMemory", "TransactionBufferMemory",
DB_TOKEN, DB_TOKEN,
"Dynamic buffer space (in bytes) for key and attribute data allocated for each "DB_TOKEN" node", "Dynamic buffer space (in bytes) for key and attribute data allocated for each "DB_TOKEN_PRINT" node",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -676,7 +680,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -676,7 +680,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_INDEX_MEM, CFG_DB_INDEX_MEM,
"IndexMemory", "IndexMemory",
DB_TOKEN, DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for storing indexes", "Number bytes on each "DB_TOKEN_PRINT" node allocated for storing indexes",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT64, ConfigInfo::INT64,
...@@ -688,7 +692,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -688,7 +692,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_DATA_MEM, CFG_DB_DATA_MEM,
"DataMemory", "DataMemory",
DB_TOKEN, DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for storing data", "Number bytes on each "DB_TOKEN_PRINT" node allocated for storing data",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT64, ConfigInfo::INT64,
...@@ -700,7 +704,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -700,7 +704,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_UNDO_INDEX_BUFFER, CFG_DB_UNDO_INDEX_BUFFER,
"UndoIndexBuffer", "UndoIndexBuffer",
DB_TOKEN, DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for writing UNDO logs for index part", "Number bytes on each "DB_TOKEN_PRINT" node allocated for writing UNDO logs for index part",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -712,7 +716,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -712,7 +716,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_UNDO_DATA_BUFFER, CFG_DB_UNDO_DATA_BUFFER,
"UndoDataBuffer", "UndoDataBuffer",
DB_TOKEN, DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for writing UNDO logs for data part", "Number bytes on each "DB_TOKEN_PRINT" node allocated for writing UNDO logs for data part",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -724,7 +728,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -724,7 +728,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_REDO_BUFFER, CFG_DB_REDO_BUFFER,
"RedoBuffer", "RedoBuffer",
DB_TOKEN, DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for writing REDO logs", "Number bytes on each "DB_TOKEN_PRINT" node allocated for writing REDO logs",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -736,7 +740,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -736,7 +740,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_LONG_SIGNAL_BUFFER, CFG_DB_LONG_SIGNAL_BUFFER,
"LongMessageBuffer", "LongMessageBuffer",
DB_TOKEN, DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for internal long messages", "Number bytes on each "DB_TOKEN_PRINT" node allocated for internal long messages",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -784,7 +788,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -784,7 +788,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_HEARTBEAT_INTERVAL, CFG_DB_HEARTBEAT_INTERVAL,
"HeartbeatIntervalDbDb", "HeartbeatIntervalDbDb",
DB_TOKEN, DB_TOKEN,
"Time between "DB_TOKEN"-"DB_TOKEN" heartbeats. "DB_TOKEN" considered dead after 3 missed HBs", "Time between "DB_TOKEN_PRINT"-"DB_TOKEN_PRINT" heartbeats. "DB_TOKEN_PRINT" considered dead after 3 missed HBs",
ConfigInfo::USED, ConfigInfo::USED,
true, true,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -796,7 +800,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -796,7 +800,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_API_HEARTBEAT_INTERVAL, CFG_DB_API_HEARTBEAT_INTERVAL,
"HeartbeatIntervalDbApi", "HeartbeatIntervalDbApi",
DB_TOKEN, DB_TOKEN,
"Time between "API_TOKEN"-"DB_TOKEN" heartbeats. "API_TOKEN" connection closed after 3 missed HBs", "Time between "API_TOKEN_PRINT"-"DB_TOKEN_PRINT" heartbeats. "API_TOKEN_PRINT" connection closed after 3 missed HBs",
ConfigInfo::USED, ConfigInfo::USED,
true, true,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -832,7 +836,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -832,7 +836,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_NO_REDOLOG_FILES, CFG_DB_NO_REDOLOG_FILES,
"NoOfFragmentLogFiles", "NoOfFragmentLogFiles",
DB_TOKEN, DB_TOKEN,
"No of 16 Mbyte Redo log files in each of 4 file sets belonging to "DB_TOKEN" node", "No of 16 Mbyte Redo log files in each of 4 file sets belonging to "DB_TOKEN_PRINT" node",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -844,7 +848,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -844,7 +848,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
KEY_INTERNAL, KEY_INTERNAL,
"MaxNoOfOpenFiles", "MaxNoOfOpenFiles",
DB_TOKEN, DB_TOKEN,
"Max number of files open per "DB_TOKEN" node.(One thread is created per file)", "Max number of files open per "DB_TOKEN_PRINT" node.(One thread is created per file)",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -998,7 +1002,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -998,7 +1002,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_DB_FILESYSTEM_PATH, CFG_DB_FILESYSTEM_PATH,
"FileSystemPath", "FileSystemPath",
DB_TOKEN, DB_TOKEN,
"Path to directory where the "DB_TOKEN" node stores its data (directory must exist)", "Path to directory where the "DB_TOKEN_PRINT" node stores its data (directory must exist)",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::STRING, ConfigInfo::STRING,
...@@ -1288,7 +1292,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1288,7 +1292,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_NODE_ID, CFG_NODE_ID,
"Id", "Id",
API_TOKEN, API_TOKEN,
"Number identifying application node ("API_TOKEN")", "Number identifying application node ("API_TOKEN_PRINT")",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -1311,7 +1315,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1311,7 +1315,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_NODE_ARBIT_RANK, CFG_NODE_ARBIT_RANK,
"ArbitrationRank", "ArbitrationRank",
API_TOKEN, API_TOKEN,
"If 0, then "API_TOKEN" is not arbitrator. Kernel selects arbitrators in order 1, 2", "If 0, then "API_TOKEN_PRINT" is not arbitrator. Kernel selects arbitrators in order 1, 2",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -1419,7 +1423,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1419,7 +1423,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_NODE_ID, CFG_NODE_ID,
"Id", "Id",
MGM_TOKEN, MGM_TOKEN,
"Number identifying the management server node ("MGM_TOKEN")", "Number identifying the management server node ("MGM_TOKEN_PRINT")",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -1489,7 +1493,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1489,7 +1493,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_NODE_ARBIT_RANK, CFG_NODE_ARBIT_RANK,
"ArbitrationRank", "ArbitrationRank",
MGM_TOKEN, MGM_TOKEN,
"If 0, then "MGM_TOKEN" is not arbitrator. Kernel selects arbitrators in order 1, 2", "If 0, then "MGM_TOKEN_PRINT" is not arbitrator. Kernel selects arbitrators in order 1, 2",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -1550,7 +1554,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1550,7 +1554,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_1, CFG_CONNECTION_NODE_1,
"NodeId1", "NodeId1",
"TCP", "TCP",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::STRING, ConfigInfo::STRING,
...@@ -1561,7 +1565,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1561,7 +1565,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_2, CFG_CONNECTION_NODE_2,
"NodeId2", "NodeId2",
"TCP", "TCP",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::STRING, ConfigInfo::STRING,
...@@ -1681,7 +1685,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1681,7 +1685,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_1, CFG_CONNECTION_NODE_1,
"NodeId1", "NodeId1",
"SHM", "SHM",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::STRING, ConfigInfo::STRING,
...@@ -1704,7 +1708,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1704,7 +1708,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_2, CFG_CONNECTION_NODE_2,
"NodeId2", "NodeId2",
"SHM", "SHM",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::STRING, ConfigInfo::STRING,
...@@ -1801,7 +1805,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1801,7 +1805,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_1, CFG_CONNECTION_NODE_1,
"NodeId1", "NodeId1",
"SCI", "SCI",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -1813,7 +1817,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1813,7 +1817,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_2, CFG_CONNECTION_NODE_2,
"NodeId2", "NodeId2",
"SCI", "SCI",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -1956,7 +1960,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1956,7 +1960,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_1, CFG_CONNECTION_NODE_1,
"NodeId1", "NodeId1",
"OSE", "OSE",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
...@@ -1968,7 +1972,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1968,7 +1972,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_2, CFG_CONNECTION_NODE_2,
"NodeId2", "NodeId2",
"OSE", "OSE",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
......
...@@ -21,19 +21,29 @@ ...@@ -21,19 +21,29 @@
#include <NdbCondition.h> #include <NdbCondition.h>
#include <NdbSleep.h> #include <NdbSleep.h>
Ndb_local_table_info::Ndb_local_table_info(NdbTableImpl *table_impl, Uint32 sz) Ndb_local_table_info *
Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz)
{
void *data= malloc(sizeof(NdbTableImpl)+sz-1);
if (data == 0)
return 0;
memset(data,0,sizeof(NdbTableImpl)+sz-1);
new (data) Ndb_local_table_info(table_impl);
return (Ndb_local_table_info *) data;
}
void Ndb_local_table_info::destroy(Ndb_local_table_info *info)
{
free((void *)info);
}
Ndb_local_table_info::Ndb_local_table_info(NdbTableImpl *table_impl)
{ {
m_table_impl= table_impl; m_table_impl= table_impl;
if (sz)
m_local_data= malloc(sz);
else
m_local_data= 0;
} }
Ndb_local_table_info::~Ndb_local_table_info() Ndb_local_table_info::~Ndb_local_table_info()
{ {
if (m_local_data)
free(m_local_data);
} }
LocalDictCache::LocalDictCache(){ LocalDictCache::LocalDictCache(){
...@@ -61,7 +71,7 @@ void ...@@ -61,7 +71,7 @@ void
LocalDictCache::drop(const char * name){ LocalDictCache::drop(const char * name){
Ndb_local_table_info *info= m_tableHash.deleteKey(name, strlen(name)); Ndb_local_table_info *info= m_tableHash.deleteKey(name, strlen(name));
DBUG_ASSERT(info != 0); DBUG_ASSERT(info != 0);
delete info; Ndb_local_table_info::destroy(info);
} }
/***************************************************************** /*****************************************************************
......
...@@ -29,12 +29,13 @@ ...@@ -29,12 +29,13 @@
class Ndb_local_table_info { class Ndb_local_table_info {
public: public:
Ndb_local_table_info(NdbTableImpl *table_impl, Uint32 sz=0); static Ndb_local_table_info *create(NdbTableImpl *table_impl, Uint32 sz=0);
~Ndb_local_table_info(); static void destroy(Ndb_local_table_info *);
NdbTableImpl *m_table_impl; NdbTableImpl *m_table_impl;
Uint64 m_first_tuple_id; char m_local_data[1];
Uint64 m_last_tuple_id; private:
void *m_local_data; Ndb_local_table_info(NdbTableImpl *table_impl);
~Ndb_local_table_info();
}; };
/** /**
......
...@@ -688,6 +688,11 @@ NdbDictionary::Dictionary::getTable(const char * name, void **data){ ...@@ -688,6 +688,11 @@ NdbDictionary::Dictionary::getTable(const char * name, void **data){
return 0; return 0;
} }
void NdbDictionary::Dictionary::set_local_table_data_size(unsigned sz)
{
m_impl.m_local_table_data_size= sz;
}
const NdbDictionary::Table * const NdbDictionary::Table *
NdbDictionary::Dictionary::getTable(const char * name){ NdbDictionary::Dictionary::getTable(const char * name){
return getTable(name, 0); return getTable(name, 0);
......
...@@ -589,6 +589,7 @@ NdbDictionaryImpl::NdbDictionaryImpl(Ndb &ndb, ...@@ -589,6 +589,7 @@ NdbDictionaryImpl::NdbDictionaryImpl(Ndb &ndb,
m_ndb(ndb) m_ndb(ndb)
{ {
m_globalHash = 0; m_globalHash = 0;
m_local_table_data_size= 0;
} }
static int f_dictionary_count = 0; static int f_dictionary_count = 0;
...@@ -600,7 +601,7 @@ NdbDictionaryImpl::~NdbDictionaryImpl() ...@@ -600,7 +601,7 @@ NdbDictionaryImpl::~NdbDictionaryImpl()
while(curr != 0){ while(curr != 0){
m_globalHash->lock(); m_globalHash->lock();
m_globalHash->release(curr->theData->m_table_impl); m_globalHash->release(curr->theData->m_table_impl);
delete curr->theData; Ndb_local_table_info::destroy(curr->theData);
m_globalHash->unlock(); m_globalHash->unlock();
curr = m_localHash.m_tableHash.getNext(curr); curr = m_localHash.m_tableHash.getNext(curr);
...@@ -641,9 +642,7 @@ NdbDictionaryImpl::fetchGlobalTableImpl(const char * internalTableName) ...@@ -641,9 +642,7 @@ NdbDictionaryImpl::fetchGlobalTableImpl(const char * internalTableName)
} }
} }
Ndb_local_table_info *info= new Ndb_local_table_info(impl, 32); Ndb_local_table_info *info= Ndb_local_table_info::create(impl, m_local_table_data_size);
info->m_first_tuple_id= ~0;
info->m_last_tuple_id= ~0;
m_localHash.put(internalTableName, info); m_localHash.put(internalTableName, info);
......
...@@ -400,6 +400,7 @@ public: ...@@ -400,6 +400,7 @@ public:
const NdbError & getNdbError() const; const NdbError & getNdbError() const;
NdbError m_error; NdbError m_error;
Uint32 m_local_table_data_size;
LocalDictCache m_localHash; LocalDictCache m_localHash;
GlobalDictCache * m_globalHash; GlobalDictCache * m_globalHash;
......
...@@ -142,24 +142,17 @@ static int ndb_to_mysql_error(const NdbError *err) ...@@ -142,24 +142,17 @@ static int ndb_to_mysql_error(const NdbError *err)
Place holder for ha_ndbcluster thread specific data Place holder for ha_ndbcluster thread specific data
*/ */
class Thd_ndb {
public:
Thd_ndb();
~Thd_ndb();
Ndb *ndb;
ulong count;
uint lock_count;
};
Thd_ndb::Thd_ndb() Thd_ndb::Thd_ndb()
{ {
ndb= 0; ndb= new Ndb(g_ndb_cluster_connection, "");
lock_count= 0; lock_count= 0;
count= 0; count= 0;
} }
Thd_ndb::~Thd_ndb() Thd_ndb::~Thd_ndb()
{ {
if (ndb)
delete ndb;
} }
/* /*
...@@ -168,7 +161,7 @@ Thd_ndb::~Thd_ndb() ...@@ -168,7 +161,7 @@ Thd_ndb::~Thd_ndb()
struct Ndb_table_local_info { struct Ndb_table_local_info {
int no_uncommitted_rows_count; int no_uncommitted_rows_count;
ulong transaction_count; ulong last_count;
ha_rows records; ha_rows records;
}; };
...@@ -195,9 +188,9 @@ void ha_ndbcluster::no_uncommitted_rows_init(THD *thd) ...@@ -195,9 +188,9 @@ void ha_ndbcluster::no_uncommitted_rows_init(THD *thd)
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_init"); DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_init");
struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info; struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info;
Thd_ndb *thd_ndb= (Thd_ndb *)thd->transaction.thd_ndb; Thd_ndb *thd_ndb= (Thd_ndb *)thd->transaction.thd_ndb;
if (info->transaction_count != thd_ndb->count) if (info->last_count != thd_ndb->count)
{ {
info->transaction_count = thd_ndb->count; info->last_count = thd_ndb->count;
info->no_uncommitted_rows_count= 0; info->no_uncommitted_rows_count= 0;
info->records= ~(ha_rows)0; info->records= ~(ha_rows)0;
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d", DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
...@@ -3346,10 +3339,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg): ...@@ -3346,10 +3339,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
m_tabname[0]= '\0'; m_tabname[0]= '\0';
m_dbname[0]= '\0'; m_dbname[0]= '\0';
// TODO Adjust number of records and other parameters for proper records= ~(ha_rows)0; // uninitialized
// selection of scan/pk access
// records= 100;
records= 0;
block_size= 1024; block_size= 1024;
for (i= 0; i < MAX_KEY; i++) for (i= 0; i < MAX_KEY; i++)
...@@ -3444,41 +3434,44 @@ int ha_ndbcluster::close(void) ...@@ -3444,41 +3434,44 @@ int ha_ndbcluster::close(void)
} }
Ndb* ha_ndbcluster::seize_ndb() Thd_ndb* ha_ndbcluster::seize_thd_ndb()
{ {
Ndb* ndb; Thd_ndb *thd_ndb;
DBUG_ENTER("seize_ndb"); DBUG_ENTER("seize_thd_ndb");
#ifdef USE_NDB_POOL #ifdef USE_NDB_POOL
// Seize from pool // Seize from pool
ndb= Ndb::seize(); ndb= Ndb::seize();
xxxxxxxxxxxxxx error
#else #else
ndb= new Ndb(g_ndb_cluster_connection, ""); thd_ndb= new Thd_ndb();
#endif #endif
if (ndb->init(max_transactions) != 0) thd_ndb->ndb->getDictionary()->set_local_table_data_size(sizeof(Ndb_table_local_info));
if (thd_ndb->ndb->init(max_transactions) != 0)
{ {
ERR_PRINT(ndb->getNdbError()); ERR_PRINT(thd_ndb->ndb->getNdbError());
/* /*
TODO TODO
Alt.1 If init fails because to many allocated Ndb Alt.1 If init fails because to many allocated Ndb
wait on condition for a Ndb object to be released. wait on condition for a Ndb object to be released.
Alt.2 Seize/release from pool, wait until next release Alt.2 Seize/release from pool, wait until next release
*/ */
delete ndb; delete thd_ndb;
ndb= NULL; thd_ndb= NULL;
} }
DBUG_RETURN(ndb); DBUG_RETURN(thd_ndb);
} }
void ha_ndbcluster::release_ndb(Ndb* ndb) void ha_ndbcluster::release_thd_ndb(Thd_ndb* thd_ndb)
{ {
DBUG_ENTER("release_ndb"); DBUG_ENTER("release_thd_ndb");
#ifdef USE_NDB_POOL #ifdef USE_NDB_POOL
// Release to pool // Release to pool
Ndb::release(ndb); Ndb::release(ndb);
xxxxxxxxxxxx error
#else #else
delete ndb; delete thd_ndb;
#endif #endif
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -3497,19 +3490,18 @@ void ha_ndbcluster::release_ndb(Ndb* ndb) ...@@ -3497,19 +3490,18 @@ void ha_ndbcluster::release_ndb(Ndb* ndb)
int ha_ndbcluster::check_ndb_connection() int ha_ndbcluster::check_ndb_connection()
{ {
THD* thd= current_thd; THD *thd= current_thd;
Ndb* ndb; Thd_ndb *thd_ndb= (Thd_ndb*)thd->transaction.thd_ndb;
DBUG_ENTER("check_ndb_connection"); DBUG_ENTER("check_ndb_connection");
if (!thd->transaction.thd_ndb) if (!thd_ndb)
{ {
ndb= seize_ndb(); thd_ndb= seize_thd_ndb();
if (!ndb) if (!thd_ndb)
DBUG_RETURN(2); DBUG_RETURN(2);
thd->transaction.thd_ndb= new Thd_ndb(); thd->transaction.thd_ndb= thd_ndb;
((Thd_ndb *)thd->transaction.thd_ndb)->ndb= ndb;
} }
m_ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb; m_ndb= thd_ndb->ndb;
m_ndb->setDatabaseName(m_dbname); m_ndb->setDatabaseName(m_dbname);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -3517,12 +3509,10 @@ int ha_ndbcluster::check_ndb_connection() ...@@ -3517,12 +3509,10 @@ int ha_ndbcluster::check_ndb_connection()
void ndbcluster_close_connection(THD *thd) void ndbcluster_close_connection(THD *thd)
{ {
Thd_ndb *thd_ndb= (Thd_ndb*)thd->transaction.thd_ndb; Thd_ndb *thd_ndb= (Thd_ndb*)thd->transaction.thd_ndb;
Ndb* ndb;
DBUG_ENTER("ndbcluster_close_connection"); DBUG_ENTER("ndbcluster_close_connection");
if (thd_ndb) if (thd_ndb)
{ {
ha_ndbcluster::release_ndb(thd_ndb->ndb); ha_ndbcluster::release_thd_ndb(thd_ndb);
delete thd_ndb;
thd->transaction.thd_ndb= NULL; thd->transaction.thd_ndb= NULL;
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -3543,6 +3533,7 @@ int ndbcluster_discover(const char *dbname, const char *name, ...@@ -3543,6 +3533,7 @@ int ndbcluster_discover(const char *dbname, const char *name,
DBUG_PRINT("enter", ("db: %s, name: %s", dbname, name)); DBUG_PRINT("enter", ("db: %s, name: %s", dbname, name));
Ndb ndb(g_ndb_cluster_connection, dbname); Ndb ndb(g_ndb_cluster_connection, dbname);
ndb.getDictionary()->set_local_table_data_size(sizeof(Ndb_table_local_info));
if (ndb.init()) if (ndb.init())
ERR_RETURN(ndb.getNdbError()); ERR_RETURN(ndb.getNdbError());
...@@ -3633,6 +3624,7 @@ bool ndbcluster_init() ...@@ -3633,6 +3624,7 @@ bool ndbcluster_init()
// Create a Ndb object to open the connection to NDB // Create a Ndb object to open the connection to NDB
g_ndb= new Ndb(g_ndb_cluster_connection, "sys"); g_ndb= new Ndb(g_ndb_cluster_connection, "sys");
g_ndb->getDictionary()->set_local_table_data_size(sizeof(Ndb_table_local_info));
if (g_ndb->init() != 0) if (g_ndb->init() != 0)
{ {
ERR_PRINT (g_ndb->getNdbError()); ERR_PRINT (g_ndb->getNdbError());
......
...@@ -63,6 +63,19 @@ typedef struct st_ndbcluster_share { ...@@ -63,6 +63,19 @@ typedef struct st_ndbcluster_share {
uint table_name_length,use_count; uint table_name_length,use_count;
} NDB_SHARE; } NDB_SHARE;
/*
Place holder for ha_ndbcluster thread specific data
*/
class Thd_ndb {
public:
Thd_ndb();
~Thd_ndb();
Ndb *ndb;
ulong count;
uint lock_count;
};
class ha_ndbcluster: public handler class ha_ndbcluster: public handler
{ {
public: public:
...@@ -147,8 +160,8 @@ class ha_ndbcluster: public handler ...@@ -147,8 +160,8 @@ class ha_ndbcluster: public handler
void start_bulk_insert(ha_rows rows); void start_bulk_insert(ha_rows rows);
int end_bulk_insert(); int end_bulk_insert();
static Ndb* seize_ndb(); static Thd_ndb* seize_thd_ndb();
static void release_ndb(Ndb* ndb); static void release_thd_ndb(Thd_ndb* thd_ndb);
uint8 table_cache_type() { return HA_CACHE_TBL_NOCACHE; } uint8 table_cache_type() { return HA_CACHE_TBL_NOCACHE; }
private: private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment