Commit c42ce285 authored by unknown's avatar unknown

ndb cluster config fixes, se respective files


mysql-test/ndb/ndb_config_2_node.ini:
  added new config parameter datadir
ndb/include/mgmapi/mgmapi_config_parameters.h:
  added new config parameter datadir and backup data dir
ndb/include/mgmcommon/ConfigRetriever.hpp:
  changed verify config so that it can be used by mgmt srvr
ndb/include/mgmcommon/NdbConfig.h:
  added option to set path for ndb files
ndb/src/common/mgmcommon/ConfigInfo.cpp:
  changed token names for DB, MGM and API
  added config parametsers for datadir and backup data dir
ndb/src/common/mgmcommon/ConfigRetriever.cpp:
  changed verify config so that it can be used by mgmt srvr
ndb/src/common/mgmcommon/InitConfigFileParser.cpp:
  no need anymore to make uppercase
ndb/src/common/mgmcommon/NdbConfig.c:
  bugfix+
  added method to set datadir
ndb/src/kernel/Makefile.am:
  added debug libs to ndbd
ndb/src/kernel/vm/Configuration.cpp:
  added debug libs to ndbd
ndb/src/mgmsrv/MgmtSrvr.cpp:
  added verify config to mgmt srvr
ndb/src/mgmsrv/main.cpp:
  .
parent e387719d
......@@ -5,15 +5,16 @@ DataMemory= CHOOSE_DataMemory
IndexMemory= CHOOSE_IndexMemory
Diskless= CHOOSE_Diskless
TimeBetweenWatchDogCheck= 30000
FileSystemPath= CHOOSE_FILESYSTEM
DataDir= CHOOSE_FILESYSTEM
[ndbd]
HostName: CHOOSE_HOSTNAME_1
HostName= CHOOSE_HOSTNAME_1
[ndbd]
HostName: CHOOSE_HOSTNAME_2
HostName= CHOOSE_HOSTNAME_2
[ndb_mgmd]
DataDir= CHOOSE_FILESYSTEM
PortNumber= CHOOSE_PORT_MGM
[mysqld]
......
......@@ -12,6 +12,7 @@
#define CFG_NODE_BYTE_ORDER 4
#define CFG_NODE_HOST 5
#define CFG_NODE_SYSTEM 6
#define CFG_NODE_DATADIR 7
/**
* DB config parameters
......@@ -89,6 +90,8 @@
#define CFG_DB_LONG_SIGNAL_BUFFER 157
#define CFG_DB_BACKUP_DATA_PATH 158
#define CFG_NODE_ARBIT_RANK 200
#define CFG_NODE_ARBIT_DELAY 201
......
......@@ -78,6 +78,11 @@ public:
* Get config from file
*/
struct ndb_mgm_configuration * getConfig(const char * file);
/**
* Verify config
*/
bool verifyConfig(const struct ndb_mgm_configuration *, Uint32 nodeid);
private:
BaseString errorString;
enum ErrorType {
......@@ -97,11 +102,6 @@ private:
Uint32 m_version;
Uint32 m_node_type;
NdbMgmHandle m_handle;
/**
* Verify config
*/
bool verifyConfig(const struct ndb_mgm_configuration *);
};
#endif
......
......@@ -21,6 +21,7 @@
extern "C" {
#endif
void NdbConfig_SetPath(const char *path);
char* NdbConfig_NdbCfgName(int with_ndb_home);
char* NdbConfig_ErrorFileName(int node_id);
char* NdbConfig_ClusterLogFileName(int node_id);
......
......@@ -33,11 +33,15 @@
* Section names
****************************************************************************/
#define DB_TOKEN "NDBD"
#define MGM_TOKEN "NDB_MGMD"
#define API_TOKEN "MYSQLD"
const ConfigInfo::AliasPair
ConfigInfo::m_sectionNameAliases[]={
{"API", "MYSQLD"},
{"DB", "NDBD"},
{"MGM", "NDB_MGMD"},
{API_TOKEN, "API"},
{DB_TOKEN, "DB"},
{MGM_TOKEN, "MGM"},
{0, 0}
};
......@@ -47,9 +51,9 @@ ConfigInfo::m_sectionNames[]={
"EXTERNAL SYSTEM",
"COMPUTER",
"DB",
"MGM",
"API",
DB_TOKEN,
MGM_TOKEN,
API_TOKEN,
"REP",
"EXTERNAL REP",
......@@ -84,6 +88,8 @@ static bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data);
static bool fixExtConnection(InitConfigFileParser::Context & ctx, const char * data);
static bool fixDepricated(InitConfigFileParser::Context & ctx, const char *);
static bool saveInConfigValues(InitConfigFileParser::Context & ctx, const char *);
static bool fixFileSystemPath(InitConfigFileParser::Context & ctx, const char * data);
static bool fixBackupDataPath(InitConfigFileParser::Context & ctx, const char * data);
const ConfigInfo::SectionRule
ConfigInfo::m_SectionRules[] = {
......@@ -91,9 +97,9 @@ ConfigInfo::m_SectionRules[] = {
{ "EXTERNAL SYSTEM", transformExternalSystem, 0 },
{ "COMPUTER", transformComputer, 0 },
{ "DB", transformNode, 0 },
{ "API", transformNode, 0 },
{ "MGM", transformNode, 0 },
{ DB_TOKEN, transformNode, 0 },
{ API_TOKEN, transformNode, 0 },
{ MGM_TOKEN, transformNode, 0 },
{ "REP", transformNode, 0 },
{ "EXTERNAL REP", transformExtNode, 0 },
......@@ -102,9 +108,9 @@ ConfigInfo::m_SectionRules[] = {
{ "SCI", transformConnection, 0 },
{ "OSE", transformConnection, 0 },
{ "DB", fixNodeHostname, 0 },
{ "API", fixNodeHostname, 0 },
{ "MGM", fixNodeHostname, 0 },
{ DB_TOKEN, fixNodeHostname, 0 },
{ API_TOKEN, fixNodeHostname, 0 },
{ MGM_TOKEN, fixNodeHostname, 0 },
{ "REP", fixNodeHostname, 0 },
//{ "EXTERNAL REP", fixNodeHostname, 0 },
......@@ -138,7 +144,10 @@ ConfigInfo::m_SectionRules[] = {
{ "*", fixDepricated, 0 },
{ "*", applyDefaultValues, "system" },
{ "DB", checkDbConstraints, 0 },
{ DB_TOKEN, fixFileSystemPath, 0 },
{ DB_TOKEN, fixBackupDataPath, 0 },
{ DB_TOKEN, checkDbConstraints, 0 },
/**
* checkConnectionConstraints must be after fixExtConnection
......@@ -153,9 +162,9 @@ ConfigInfo::m_SectionRules[] = {
{ "*", checkMandatory, 0 },
{ "DB", saveInConfigValues, 0 },
{ "API", saveInConfigValues, 0 },
{ "MGM", saveInConfigValues, 0 },
{ DB_TOKEN, saveInConfigValues, 0 },
{ API_TOKEN, saveInConfigValues, 0 },
{ MGM_TOKEN, saveInConfigValues, 0 },
{ "REP", saveInConfigValues, 0 },
{ "TCP", saveInConfigValues, 0 },
......@@ -196,7 +205,7 @@ struct DepricationTransform {
static
const DepricationTransform f_deprication[] = {
{ "DB", "Discless", "Diskless", 0, 1 },
{ DB_TOKEN, "Discless", "Diskless", 0, 1 },
{ 0, 0, 0, 0, 0}
};
......@@ -302,7 +311,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_SYS_PRIMARY_MGM_NODE,
"PrimaryMGMNode",
"SYSTEM",
"Node id of Primary MGM node",
"Node id of Primary "MGM_TOKEN" node",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -327,8 +336,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
***************************************************************************/
{
CFG_SECTION_NODE,
"DB",
"DB",
DB_TOKEN,
DB_TOKEN,
"Node section",
ConfigInfo::USED,
false,
......@@ -340,7 +349,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_HOST,
"HostName",
"DB",
DB_TOKEN,
"Name of computer for this node",
ConfigInfo::INTERNAL,
false,
......@@ -351,7 +360,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_SYSTEM,
"System",
"DB",
DB_TOKEN,
"Name of system for this node",
ConfigInfo::INTERNAL,
false,
......@@ -362,8 +371,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_ID,
"Id",
"DB",
"Number identifying the database node (DB)",
DB_TOKEN,
"Number identifying the database node ("DB_TOKEN")",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -374,7 +383,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"ServerPort",
"DB",
DB_TOKEN,
"Port used to setup transporter",
ConfigInfo::USED,
false,
......@@ -386,7 +395,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_REPLICAS,
"NoOfReplicas",
"DB",
DB_TOKEN,
"Number of copies of all data in the database (1-4)",
ConfigInfo::USED,
false,
......@@ -398,7 +407,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_ATTRIBUTES,
"MaxNoOfAttributes",
"DB",
DB_TOKEN,
"Total number of attributes stored in database. I.e. sum over all tables",
ConfigInfo::USED,
false,
......@@ -410,7 +419,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_TABLES,
"MaxNoOfTables",
"DB",
DB_TOKEN,
"Total number of tables stored in the database",
ConfigInfo::USED,
false,
......@@ -422,7 +431,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_ORDERED_INDEXES,
"MaxNoOfOrderedIndexes",
"DB",
DB_TOKEN,
"Total number of ordered indexes that can be defined in the system",
ConfigInfo::USED,
false,
......@@ -434,7 +443,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_UNIQUE_HASH_INDEXES,
"MaxNoOfUniqueHashIndexes",
"DB",
DB_TOKEN,
"Total number of unique hash indexes that can be defined in the system",
ConfigInfo::USED,
false,
......@@ -446,7 +455,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_INDEXES,
"MaxNoOfIndexes",
"DB",
DB_TOKEN,
"Total number of indexes that can be defined in the system",
ConfigInfo::DEPRICATED,
false,
......@@ -458,8 +467,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_INDEX_OPS,
"MaxNoOfConcurrentIndexOperations",
"DB",
"Total number of index operations that can execute simultaneously on one DB node",
DB_TOKEN,
"Total number of index operations that can execute simultaneously on one "DB_TOKEN" node",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -471,7 +480,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_TRIGGERS,
"MaxNoOfTriggers",
"DB",
DB_TOKEN,
"Total number of triggers that can be defined in the system",
ConfigInfo::USED,
false,
......@@ -483,8 +492,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_TRIGGER_OPS,
"MaxNoOfFiredTriggers",
"DB",
"Total number of triggers that can fire simultaneously in one DB node",
DB_TOKEN,
"Total number of triggers that can fire simultaneously in one "DB_TOKEN" node",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -495,7 +504,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"ExecuteOnComputer",
"DB",
DB_TOKEN,
"String referencing an earlier defined COMPUTER",
ConfigInfo::USED,
false,
......@@ -506,7 +515,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_SAVE_MSGS,
"MaxNoOfSavedMessages",
"DB",
DB_TOKEN,
"Max number of error messages in error log and max number of trace files",
ConfigInfo::USED,
true,
......@@ -518,7 +527,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_MEMLOCK,
"LockPagesInMainMemory",
"DB",
DB_TOKEN,
"If set to yes, then NDB Cluster data will not be swapped out to disk",
ConfigInfo::USED,
true,
......@@ -530,7 +539,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_WATCHDOG_INTERVAL,
"TimeBetweenWatchDogCheck",
"DB",
DB_TOKEN,
"Time between execution checks inside a database node",
ConfigInfo::USED,
true,
......@@ -542,8 +551,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_STOP_ON_ERROR,
"StopOnError",
"DB",
"If set to N, the DB automatically restarts/recovers in case of node failure",
DB_TOKEN,
"If set to N, "DB_TOKEN" automatically restarts/recovers in case of node failure",
ConfigInfo::USED,
true,
ConfigInfo::BOOL,
......@@ -554,7 +563,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_STOP_ON_ERROR_INSERT,
"RestartOnErrorInsert",
"DB",
DB_TOKEN,
"See src/kernel/vm/Emulator.hpp NdbRestartType for details",
ConfigInfo::INTERNAL,
true,
......@@ -566,7 +575,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_OPS,
"MaxNoOfConcurrentOperations",
"DB",
DB_TOKEN,
"Max number of operation records in transaction coordinator",
ConfigInfo::USED,
false,
......@@ -578,7 +587,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_LOCAL_OPS,
"MaxNoOfLocalOperations",
"DB",
DB_TOKEN,
"Max number of operation records defined in the local storage node",
ConfigInfo::USED,
false,
......@@ -590,7 +599,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_LOCAL_SCANS,
"MaxNoOfLocalScans",
"DB",
DB_TOKEN,
"Max number of fragment scans in parallel in the local storage node",
ConfigInfo::USED,
false,
......@@ -602,7 +611,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_BATCH_SIZE,
"BatchSizePerLocalScan",
"DB",
DB_TOKEN,
"Used to calculate the number of lock records for scan with hold lock",
ConfigInfo::USED,
false,
......@@ -614,8 +623,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_TRANSACTIONS,
"MaxNoOfConcurrentTransactions",
"DB",
"Max number of transaction executing concurrently on the DB node",
DB_TOKEN,
"Max number of transaction executing concurrently on the "DB_TOKEN" node",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -626,8 +635,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_SCANS,
"MaxNoOfConcurrentScans",
"DB",
"Max number of scans executing concurrently on the DB node",
DB_TOKEN,
"Max number of scans executing concurrently on the "DB_TOKEN" node",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -638,8 +647,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_TRANS_BUFFER_MEM,
"TransactionBufferMemory",
"DB",
"Dynamic buffer space (in bytes) for key and attribute data allocated for each DB node",
DB_TOKEN,
"Dynamic buffer space (in bytes) for key and attribute data allocated for each "DB_TOKEN" node",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -650,8 +659,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_INDEX_MEM,
"IndexMemory",
"DB",
"Number bytes on each DB node allocated for storing indexes",
DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for storing indexes",
ConfigInfo::USED,
false,
ConfigInfo::INT64,
......@@ -662,8 +671,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_DATA_MEM,
"DataMemory",
"DB",
"Number bytes on each DB node allocated for storing data",
DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for storing data",
ConfigInfo::USED,
false,
ConfigInfo::INT64,
......@@ -674,8 +683,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_UNDO_INDEX_BUFFER,
"UndoIndexBuffer",
"DB",
"Number bytes on each DB node allocated for writing UNDO logs for index part",
DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for writing UNDO logs for index part",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -686,8 +695,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_UNDO_DATA_BUFFER,
"UndoDataBuffer",
"DB",
"Number bytes on each DB node allocated for writing UNDO logs for data part",
DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for writing UNDO logs for data part",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -698,8 +707,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_REDO_BUFFER,
"RedoBuffer",
"DB",
"Number bytes on each DB node allocated for writing REDO logs",
DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for writing REDO logs",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -710,8 +719,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_LONG_SIGNAL_BUFFER,
"LongMessageBuffer",
"DB",
"Number bytes on each DB node allocated for internal long messages",
DB_TOKEN,
"Number bytes on each "DB_TOKEN" node allocated for internal long messages",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -722,7 +731,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_START_PARTIAL_TIMEOUT,
"StartPartialTimeout",
"DB",
DB_TOKEN,
"Time to wait before trying to start wo/ all nodes. 0=Wait forever",
ConfigInfo::USED,
true,
......@@ -734,7 +743,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_START_PARTITION_TIMEOUT,
"StartPartitionedTimeout",
"DB",
DB_TOKEN,
"Time to wait before trying to start partitioned. 0=Wait forever",
ConfigInfo::USED,
true,
......@@ -746,7 +755,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_START_FAILURE_TIMEOUT,
"StartFailureTimeout",
"DB",
DB_TOKEN,
"Time to wait before terminating. 0=Wait forever",
ConfigInfo::USED,
true,
......@@ -758,8 +767,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_HEARTBEAT_INTERVAL,
"HeartbeatIntervalDbDb",
"DB",
"Time between DB-DB heartbeats. DB considered dead after 3 missed HBs",
DB_TOKEN,
"Time between "DB_TOKEN"-"DB_TOKEN" heartbeats. "DB_TOKEN" considered dead after 3 missed HBs",
ConfigInfo::USED,
true,
ConfigInfo::INT,
......@@ -770,8 +779,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_API_HEARTBEAT_INTERVAL,
"HeartbeatIntervalDbApi",
"DB",
"Time between API-DB heartbeats. API connection closed after 3 missed HBs",
DB_TOKEN,
"Time between "API_TOKEN"-"DB_TOKEN" heartbeats. "API_TOKEN" connection closed after 3 missed HBs",
ConfigInfo::USED,
true,
ConfigInfo::INT,
......@@ -782,7 +791,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_LCP_INTERVAL,
"TimeBetweenLocalCheckpoints",
"DB",
DB_TOKEN,
"Time between taking snapshots of the database (expressed in 2log of bytes)",
ConfigInfo::USED,
true,
......@@ -794,7 +803,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_GCP_INTERVAL,
"TimeBetweenGlobalCheckpoints",
"DB",
DB_TOKEN,
"Time between doing group commit of transactions to disk",
ConfigInfo::USED,
true,
......@@ -806,8 +815,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_NO_REDOLOG_FILES,
"NoOfFragmentLogFiles",
"DB",
"No of 16 Mbyte Redo log files in each of 4 file sets belonging to DB node",
DB_TOKEN,
"No of 16 Mbyte Redo log files in each of 4 file sets belonging to "DB_TOKEN" node",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -818,8 +827,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"MaxNoOfOpenFiles",
"DB",
"Max number of files open per DB node.(One thread is created per file)",
DB_TOKEN,
"Max number of files open per "DB_TOKEN" node.(One thread is created per file)",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -831,7 +840,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_TRANSACTION_CHECK_INTERVAL,
"TimeBetweenInactiveTransactionAbortCheck",
"DB",
DB_TOKEN,
"Time between inactive transaction checks",
ConfigInfo::USED,
true,
......@@ -843,7 +852,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_TRANSACTION_INACTIVE_TIMEOUT,
"TransactionInactiveTimeout",
"DB",
DB_TOKEN,
"Time application can wait before executing another transaction part (ms).\n"
"This is the time the transaction coordinator waits for the application\n"
"to execute or send another part (query, statement) of the transaction.\n"
......@@ -859,7 +868,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT,
"TransactionDeadlockDetectionTimeout",
"DB",
DB_TOKEN,
"Time transaction can be executing in a DB node (ms).\n"
"This is the time the transaction coordinator waits for each database node\n"
"of the transaction to execute a request. If the database node takes too\n"
......@@ -874,7 +883,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"NoOfDiskPagesToDiskDuringRestartTUP",
"DB",
DB_TOKEN,
"?",
ConfigInfo::USED,
true,
......@@ -886,7 +895,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"NoOfDiskPagesToDiskAfterRestartTUP",
"DB",
DB_TOKEN,
"?",
ConfigInfo::USED,
true,
......@@ -898,7 +907,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"NoOfDiskPagesToDiskDuringRestartACC",
"DB",
DB_TOKEN,
"?",
ConfigInfo::USED,
true,
......@@ -910,7 +919,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"NoOfDiskPagesToDiskAfterRestartACC",
"DB",
DB_TOKEN,
"?",
ConfigInfo::USED,
true,
......@@ -923,7 +932,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_DISCLESS,
"Diskless",
"DB",
DB_TOKEN,
"Run wo/ disk",
ConfigInfo::USED,
true,
......@@ -935,7 +944,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"Discless",
"DB",
DB_TOKEN,
"Diskless",
ConfigInfo::DEPRICATED,
true,
......@@ -949,7 +958,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_ARBIT_TIMEOUT,
"ArbitrationTimeout",
"DB",
DB_TOKEN,
"Max time (milliseconds) database partion waits for arbitration signal",
ConfigInfo::USED,
false,
......@@ -958,21 +967,32 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"10",
MAX_INT_RNIL_STRING },
{
CFG_NODE_DATADIR,
"DataDir",
DB_TOKEN,
"Data directory for this node",
ConfigInfo::USED,
false,
ConfigInfo::STRING,
DATADIR,
0, 0 },
{
CFG_DB_FILESYSTEM_PATH,
"FileSystemPath",
"DB",
"Path to directory where the DB node stores its data (directory must exist)",
DB_TOKEN,
"Path to directory where the "DB_TOKEN" node stores its data (directory must exist)",
ConfigInfo::USED,
false,
ConfigInfo::STRING,
DATADIR,
UNDEFINED,
0, 0 },
{
CFG_LOGLEVEL_STARTUP,
"LogLevelStartup",
"DB",
DB_TOKEN,
"Node startup info printed on stdout",
ConfigInfo::USED,
false,
......@@ -984,7 +1004,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_LOGLEVEL_SHUTDOWN,
"LogLevelShutdown",
"DB",
DB_TOKEN,
"Node shutdown info printed on stdout",
ConfigInfo::USED,
false,
......@@ -996,7 +1016,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_LOGLEVEL_STATISTICS,
"LogLevelStatistic",
"DB",
DB_TOKEN,
"Transaction, operation, transporter info printed on stdout",
ConfigInfo::USED,
false,
......@@ -1008,7 +1028,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_LOGLEVEL_CHECKPOINT,
"LogLevelCheckpoint",
"DB",
DB_TOKEN,
"Local and Global checkpoint info printed on stdout",
ConfigInfo::USED,
false,
......@@ -1020,7 +1040,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_LOGLEVEL_NODERESTART,
"LogLevelNodeRestart",
"DB",
DB_TOKEN,
"Node restart, node failure info printed on stdout",
ConfigInfo::USED,
false,
......@@ -1032,7 +1052,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_LOGLEVEL_CONNECTION,
"LogLevelConnection",
"DB",
DB_TOKEN,
"Node connect/disconnect info printed on stdout",
ConfigInfo::USED,
false,
......@@ -1044,7 +1064,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_LOGLEVEL_ERROR,
"LogLevelError",
"DB",
DB_TOKEN,
"Transporter, heartbeat errors printed on stdout",
ConfigInfo::USED,
false,
......@@ -1056,7 +1076,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_LOGLEVEL_INFO,
"LogLevelInfo",
"DB",
DB_TOKEN,
"Heartbeat and log info printed on stdout",
ConfigInfo::USED,
false,
......@@ -1071,7 +1091,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_PARALLEL_BACKUPS,
"ParallelBackups",
"DB",
DB_TOKEN,
"Maximum number of parallel backups",
ConfigInfo::NOTIMPLEMENTED,
false,
......@@ -1080,10 +1100,21 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"1",
"1" },
{
CFG_DB_BACKUP_DATA_PATH,
"BackupDataPath",
DB_TOKEN,
"Path to where to store backups",
ConfigInfo::USED,
false,
ConfigInfo::STRING,
UNDEFINED,
0, 0 },
{
CFG_DB_BACKUP_MEM,
"BackupMemory",
"DB",
DB_TOKEN,
"Total memory allocated for backups per node (in bytes)",
ConfigInfo::USED,
false,
......@@ -1095,7 +1126,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_BACKUP_DATA_BUFFER_MEM,
"BackupDataBufferSize",
"DB",
DB_TOKEN,
"Default size of databuffer for a backup (in bytes)",
ConfigInfo::USED,
false,
......@@ -1107,7 +1138,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_BACKUP_LOG_BUFFER_MEM,
"BackupLogBufferSize",
"DB",
DB_TOKEN,
"Default size of logbuffer for a backup (in bytes)",
ConfigInfo::USED,
false,
......@@ -1119,7 +1150,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_DB_BACKUP_WRITE_SIZE,
"BackupWriteSize",
"DB",
DB_TOKEN,
"Default size of filesystem writes made by backup (in bytes)",
ConfigInfo::USED,
false,
......@@ -1205,8 +1236,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
***************************************************************************/
{
CFG_SECTION_NODE,
"API",
"API",
API_TOKEN,
API_TOKEN,
"Node section",
ConfigInfo::USED,
false,
......@@ -1218,7 +1249,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_HOST,
"HostName",
"API",
API_TOKEN,
"Name of computer for this node",
ConfigInfo::INTERNAL,
false,
......@@ -1229,7 +1260,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_SYSTEM,
"System",
"API",
API_TOKEN,
"Name of system for this node",
ConfigInfo::INTERNAL,
false,
......@@ -1240,8 +1271,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_ID,
"Id",
"API",
"Number identifying application node (API)",
API_TOKEN,
"Number identifying application node ("API_TOKEN")",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -1252,7 +1283,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"ExecuteOnComputer",
"API",
API_TOKEN,
"String referencing an earlier defined COMPUTER",
ConfigInfo::USED,
false,
......@@ -1263,8 +1294,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_ARBIT_RANK,
"ArbitrationRank",
"API",
"If 0, then API is not arbitrator. Kernel selects arbitrators in order 1, 2",
API_TOKEN,
"If 0, then "API_TOKEN" is not arbitrator. Kernel selects arbitrators in order 1, 2",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -1275,7 +1306,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_ARBIT_DELAY,
"ArbitrationDelay",
"API",
API_TOKEN,
"When asked to arbitrate, arbitrator waits this long before voting (msec)",
ConfigInfo::USED,
false,
......@@ -1289,8 +1320,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
***************************************************************************/
{
CFG_SECTION_NODE,
"MGM",
"MGM",
MGM_TOKEN,
MGM_TOKEN,
"Node section",
ConfigInfo::USED,
false,
......@@ -1302,7 +1333,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_HOST,
"HostName",
"MGM",
MGM_TOKEN,
"Name of computer for this node",
ConfigInfo::INTERNAL,
false,
......@@ -1310,10 +1341,21 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
UNDEFINED,
0, 0 },
{
CFG_NODE_DATADIR,
"DataDir",
MGM_TOKEN,
"Data directory for this node",
ConfigInfo::USED,
false,
ConfigInfo::STRING,
DATADIR,
0, 0 },
{
CFG_NODE_SYSTEM,
"System",
"MGM",
MGM_TOKEN,
"Name of system for this node",
ConfigInfo::INTERNAL,
false,
......@@ -1324,8 +1366,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_ID,
"Id",
"MGM",
"Number identifying the management server node (MGM)",
MGM_TOKEN,
"Number identifying the management server node ("MGM_TOKEN")",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -1336,7 +1378,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_LOG_DESTINATION,
"LogDestination",
"MGM",
MGM_TOKEN,
"String describing where logmessages are sent",
ConfigInfo::USED,
false,
......@@ -1347,7 +1389,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"ExecuteOnComputer",
"MGM",
MGM_TOKEN,
"String referencing an earlier defined COMPUTER",
ConfigInfo::USED,
false,
......@@ -1358,7 +1400,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"MaxNoOfSavedEvents",
"MGM",
MGM_TOKEN,
"",
ConfigInfo::USED,
false,
......@@ -1370,7 +1412,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_MGM_PORT,
"PortNumber",
"MGM",
MGM_TOKEN,
"Port number to give commands to/fetch configurations from management server",
ConfigInfo::USED,
false,
......@@ -1382,7 +1424,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
KEY_INTERNAL,
"PortNumberStats",
"MGM",
MGM_TOKEN,
"Port number used to get statistical information from a management server",
ConfigInfo::USED,
false,
......@@ -1394,8 +1436,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_ARBIT_RANK,
"ArbitrationRank",
"MGM",
"If 0, then MGM is not arbitrator. Kernel selects arbitrators in order 1, 2",
MGM_TOKEN,
"If 0, then "MGM_TOKEN" is not arbitrator. Kernel selects arbitrators in order 1, 2",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -1406,7 +1448,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
{
CFG_NODE_ARBIT_DELAY,
"ArbitrationDelay",
"MGM",
MGM_TOKEN,
"",
ConfigInfo::USED,
false,
......@@ -1456,7 +1498,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_1,
"NodeId1",
"TCP",
"Id of node (DB, API or MGM) on one side of the connection",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
ConfigInfo::USED,
false,
ConfigInfo::STRING,
......@@ -1467,7 +1509,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_2,
"NodeId2",
"TCP",
"Id of node (DB, API or MGM) on one side of the connection",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
ConfigInfo::USED,
false,
ConfigInfo::STRING,
......@@ -1587,7 +1629,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_1,
"NodeId1",
"SHM",
"Id of node (DB, API or MGM) on one side of the connection",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
ConfigInfo::USED,
false,
ConfigInfo::STRING,
......@@ -1610,7 +1652,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_2,
"NodeId2",
"SHM",
"Id of node (DB, API or MGM) on one side of the connection",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
ConfigInfo::USED,
false,
ConfigInfo::STRING,
......@@ -1707,7 +1749,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_1,
"NodeId1",
"SCI",
"Id of node (DB, API or MGM) on one side of the connection",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -1719,7 +1761,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_2,
"NodeId2",
"SCI",
"Id of node (DB, API or MGM) on one side of the connection",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -1862,7 +1904,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_1,
"NodeId1",
"OSE",
"Id of node (DB, API or MGM) on one side of the connection",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -1874,7 +1916,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
CFG_CONNECTION_NODE_2,
"NodeId2",
"OSE",
"Id of node (DB, API or MGM) on one side of the connection",
"Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
ConfigInfo::USED,
false,
ConfigInfo::INT,
......@@ -2206,7 +2248,7 @@ ConfigInfo::getDescription(const Properties * section,
bool
ConfigInfo::isSection(const char * section) const {
for (int i = 0; i<m_noOfSectionNames; i++) {
if(!strcmp(section, m_sectionNames[i])) return true;
if(!strcasecmp(section, m_sectionNames[i])) return true;
}
return false;
}
......@@ -2409,7 +2451,7 @@ fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data){
const char * compId;
if(!ctx.m_currentSection->get("ExecuteOnComputer", &compId)){
const char * type;
if(ctx.m_currentSection->get("Type", &type) && strcmp(type,"DB") == 0)
if(ctx.m_currentSection->get("Type", &type) && strcmp(type,DB_TOKEN) == 0)
require(ctx.m_currentSection->put("HostName", "localhost"));
else
require(ctx.m_currentSection->put("HostName", ""));
......@@ -2437,6 +2479,39 @@ fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data){
return checkLocalhostHostnameMix(ctx);
}
bool
fixFileSystemPath(InitConfigFileParser::Context & ctx, const char * data){
DBUG_ENTER("fixFileSystemPath");
const char * path;
if (ctx.m_currentSection->get("FileSystemPath", &path))
DBUG_RETURN(true);
if (ctx.m_currentSection->get("DataDir", &path)) {
require(ctx.m_currentSection->put("FileSystemPath", path));
DBUG_RETURN(true);
}
require(false);
DBUG_RETURN(false);
}
bool
fixBackupDataPath(InitConfigFileParser::Context & ctx, const char * data){
const char * path;
if (ctx.m_currentSection->get("BackupDataPath", &path))
return true;
if (ctx.m_currentSection->get("FileSystemPath", &path)) {
require(ctx.m_currentSection->put("BackupDataPath", path));
return true;
}
require(false);
return false;
}
bool
transformExtNode(InitConfigFileParser::Context & ctx, const char * data){
......@@ -2778,10 +2853,16 @@ fixHostname(InitConfigFileParser::Context & ctx, const char * data){
static bool
fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
DBUG_ENTER("fixPortNumber");
Uint32 id1= 0, id2= 0;
require(ctx.m_currentSection->get("NodeId1", &id1));
require(ctx.m_currentSection->get("NodeId2", &id2));
id1 = id1 < id2 ? id1 : id2;
if (id1 > id2) {
Uint32 tmp= id1;
id1= id2;
id2= tmp;
}
const Properties * node;
require(ctx.m_config->get("Node", id1, &node));
......@@ -2790,7 +2871,7 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
if (hostname.c_str()[0] == 0) {
ctx.reportError("Hostname required on nodeid %d since it will act as server.", id1);
return false;
DBUG_RETURN(false);
}
Uint32 port= 0;
......@@ -2823,7 +2904,9 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
} else
ctx.m_currentSection->put("PortNumber", port);
return true;
DBUG_PRINT("info", ("connection %d-%d port %d host %s", id1, id2, port, hostname.c_str()));
DBUG_RETURN(true);
}
/**
......@@ -2908,8 +2991,8 @@ checkConnectionConstraints(InitConfigFileParser::Context & ctx, const char *){
* -# Not both of them are MGMs
* -# None of them contain a "SystemX" name
*/
if((strcmp(type1, "DB") != 0 && strcmp(type2, "DB") != 0) &&
!(strcmp(type1, "MGM") == 0 && strcmp(type2, "MGM") == 0) &&
if((strcmp(type1, DB_TOKEN) != 0 && strcmp(type2, DB_TOKEN) != 0) &&
!(strcmp(type1, MGM_TOKEN) == 0 && strcmp(type2, MGM_TOKEN) == 0) &&
!ctx.m_currentSection->contains("System1") &&
!ctx.m_currentSection->contains("System2")){
ctx.reportError("Invalid connection between node %d (%s) and node %d (%s)"
......@@ -3157,10 +3240,10 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>&sections,
const char * type;
if(!tmp->get("Type", &type)) continue;
if (strcmp(type,"DB") == 0)
if (strcmp(type,DB_TOKEN) == 0)
p_db_nodes.put("", i_db++, i);
else if (strcmp(type,"API") == 0 ||
strcmp(type,"MGM") == 0)
else if (strcmp(type,API_TOKEN) == 0 ||
strcmp(type,MGM_TOKEN) == 0)
p_api_mgm_nodes.put("", i_api_mgm++, i);
}
......@@ -3233,7 +3316,7 @@ static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>&sections,
Uint32 adder= 0;
computers.get("",computer, &adder);
if (strcmp(type,"DB") == 0) {
if (strcmp(type,DB_TOKEN) == 0) {
adder++;
tmp->put("ServerPort", port_base+adder);
computers.put("",computer, adder);
......@@ -3250,7 +3333,7 @@ check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>&sections,
{
Uint32 db_nodes = 0;
Uint32 replicas = 0;
ctx.m_userProperties.get("DB", &db_nodes);
ctx.m_userProperties.get(DB_TOKEN, &db_nodes);
ctx.m_userProperties.get("NoOfReplicas", &replicas);
if((db_nodes % replicas) != 0){
ctx.reportError("Invalid no of db nodes wrt no of replicas.\n"
......
......@@ -154,7 +154,7 @@ ConfigRetriever::getConfig() {
if(p == 0)
return 0;
if(!verifyConfig(p)){
if(!verifyConfig(p, _ownNodeId)){
free(p);
p= 0;
}
......@@ -239,7 +239,7 @@ ConfigRetriever::setConnectString(const char * connectString) {
}
bool
ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 nodeid){
char buf[255];
ndb_mgm_configuration_iterator * it;
......@@ -253,8 +253,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
}
NdbAutoPtr<ndb_mgm_configuration_iterator> ptr(it);
if(ndb_mgm_find(it, CFG_NODE_ID, _ownNodeId) != 0){
snprintf(buf, 255, "Unable to find node with id: %d", _ownNodeId);
if(ndb_mgm_find(it, CFG_NODE_ID, nodeid) != 0){
snprintf(buf, 255, "Unable to find node with id: %d", nodeid);
setError(CR_ERROR, buf);
return false;
}
......@@ -266,6 +266,11 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
return false;
}
const char * datadir;
if(!ndb_mgm_get_string_parameter(it, CFG_NODE_DATADIR, &datadir)){
NdbConfig_SetPath(datadir);
}
char localhost[MAXHOSTNAMELEN];
if(NdbHost_GetHostName(localhost) != 0){
snprintf(buf, 255, "Unable to get own hostname");
......@@ -332,8 +337,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
if(iter.get(CFG_CONNECTION_NODE_1, &nodeId1)) continue;
if(iter.get(CFG_CONNECTION_NODE_2, &nodeId2)) continue;
if(nodeId1 != _ownNodeId && nodeId2 != _ownNodeId) continue;
remoteNodeId = (_ownNodeId == nodeId1 ? nodeId2 : nodeId1);
if(nodeId1 != nodeid && nodeId2 != nodeid) continue;
remoteNodeId = (nodeid == nodeId1 ? nodeId2 : nodeId1);
const char * name;
struct in_addr addr;
......@@ -342,7 +347,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
if(Ndb_getInAddr(&addr, name) != 0){
tmp.assfmt("Unable to lookup/illegal hostname %s, "
"connection from node %d to node %d",
name, _ownNodeId, remoteNodeId);
name, nodeid, remoteNodeId);
setError(CR_ERROR, tmp.c_str());
return false;
}
......@@ -352,7 +357,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
if(Ndb_getInAddr(&addr, name) != 0){
tmp.assfmt("Unable to lookup/illegal hostname %s, "
"connection from node %d to node %d",
name, _ownNodeId, remoteNodeId);
name, nodeid, remoteNodeId);
setError(CR_ERROR, tmp.c_str());
return false;
}
......
......@@ -480,10 +480,6 @@ InitConfigFileParser::parseSectionHeader(const char* line) const {
tmp[0] = ' ';
trim(tmp);
// Convert section header to upper
for(int i= strlen(tmp)-1; i >= 0; i--)
tmp[i]= toupper(tmp[i]);
// Get the correct header name if an alias
{
const char *tmp_alias= m_info->getAlias(tmp);
......
......@@ -19,6 +19,8 @@
#include <NdbEnv.h>
#include <NdbMem.h>
static char *datadir_path= 0;
static char*
NdbConfig_AllocHomePath(int _len)
{
......@@ -27,19 +29,27 @@ NdbConfig_AllocHomePath(int _len)
int path_len= 0;
char *buf;
if (path == 0)
path= datadir_path;
if (path)
path_len= strlen(path);
len+= path_len;
buf= NdbMem_Allocate(len);
if (path_len > 0)
snprintf(buf, len, "%s%c", path, DIR_SEPARATOR);
snprintf(buf, len, "%s%s", path, DIR_SEPARATOR);
else
buf[0]= 0;
return buf;
}
void
NdbConfig_SetPath(const char* path){
datadir_path= path;
}
char*
NdbConfig_NdbCfgName(int with_ndb_home){
char *buf;
......
......@@ -52,7 +52,10 @@ LDADD += \
$(top_builddir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \
$(top_builddir)/ndb/src/mgmapi/libmgmapi.la \
$(top_builddir)/ndb/src/common/portlib/libportlib.la \
$(top_builddir)/ndb/src/common/util/libgeneral.la
$(top_builddir)/ndb/src/common/util/libgeneral.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -14,6 +14,9 @@
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 <my_sys.h>
#include "Configuration.hpp"
#include <ErrorHandlingMacros.hpp>
#include "GlobalData.hpp"
......@@ -56,6 +59,9 @@ Configuration::init(int argc, const char** argv){
int _deamon = 0;
int _help = 0;
int _print_version = 0;
#ifndef DBUG_OFF
const char *debug_option= 0;
#endif
/**
* Arguments to NDB process
......@@ -66,6 +72,10 @@ Configuration::init(int argc, const char** argv){
{ "nostart", 'n', arg_flag, &_no_start,
"Don't start ndbd immediately. Ndbd will await command from ndb_mgmd", "" },
{ "daemon", 'd', arg_flag, &_deamon, "Start ndbd as daemon", "" },
#ifndef DBUG_OFF
{ "debug", 0, arg_string, &debug_option,
"Specify debug options e.g. d:t:i:o,out.trace", "options" },
#endif
{ "initial", 'i', arg_flag, &_initial,
"Perform initial start of ndbd, including cleaning the file system. Consult documentation before using this", "" },
......@@ -84,15 +94,17 @@ Configuration::init(int argc, const char** argv){
return false;
}
#if 0
ndbout << "no_start=" <<_no_start<< endl;
ndbout << "initial=" <<_initial<< endl;
ndbout << "deamon=" <<_deamon<< endl;
ndbout << "connect_str="<<_connect_str<<endl;
arg_printusage(args, num_args, argv[0], desc);
return false;
#ifndef DBUG_OFF
my_init();
if (debug_option)
DBUG_PUSH(debug_option);
#endif
DBUG_PRINT("info", ("no_start=%d", _no_start));
DBUG_PRINT("info", ("initial=%d", _initial));
DBUG_PRINT("info", ("deamon=%d", _deamon));
DBUG_PRINT("info", ("connect_str=%s", _connect_str));
ndbSetOwnVersion();
if (_print_version) {
......
......@@ -19,6 +19,7 @@
#include "MgmtSrvr.hpp"
#include "MgmtErrorReporter.hpp"
#include <ConfigRetriever.hpp>
#include <NdbOut.hpp>
#include <NdbApiSignal.hpp>
......@@ -512,6 +513,8 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
theConfCount(0),
m_allocated_resources(*this) {
DBUG_ENTER("MgmtSrvr::MgmtSrvr");
_config = NULL;
_isStatPortActive = false;
_isClusterLogStatActive = false;
......@@ -543,37 +546,39 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
for(Uint32 i = 0; i<MAX_NODES; i++)
nodeTypes[i] = (enum ndb_mgm_node_type)-1;
ndb_mgm_configuration_iterator * iter = ndb_mgm_create_configuration_iterator
(config->m_configValues, CFG_SECTION_NODE);
for(ndb_mgm_first(iter); ndb_mgm_valid(iter); ndb_mgm_next(iter)){
unsigned type, id;
if(ndb_mgm_get_int_parameter(iter, CFG_TYPE_OF_SECTION, &type) != 0)
continue;
if(ndb_mgm_get_int_parameter(iter, CFG_NODE_ID, &id) != 0)
continue;
MGM_REQUIRE(id < MAX_NODES);
{
ndb_mgm_configuration_iterator * iter = ndb_mgm_create_configuration_iterator
(config->m_configValues, CFG_SECTION_NODE);
for(ndb_mgm_first(iter); ndb_mgm_valid(iter); ndb_mgm_next(iter)){
unsigned type, id;
if(ndb_mgm_get_int_parameter(iter, CFG_TYPE_OF_SECTION, &type) != 0)
continue;
switch(type){
case NODE_TYPE_DB:
nodeTypes[id] = NDB_MGM_NODE_TYPE_NDB;
break;
case NODE_TYPE_API:
nodeTypes[id] = NDB_MGM_NODE_TYPE_API;
break;
case NODE_TYPE_MGM:
nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM;
break;
case NODE_TYPE_REP:
nodeTypes[id] = NDB_MGM_NODE_TYPE_REP;
break;
case NODE_TYPE_EXT_REP:
default:
break;
if(ndb_mgm_get_int_parameter(iter, CFG_NODE_ID, &id) != 0)
continue;
MGM_REQUIRE(id < MAX_NODES);
switch(type){
case NODE_TYPE_DB:
nodeTypes[id] = NDB_MGM_NODE_TYPE_NDB;
break;
case NODE_TYPE_API:
nodeTypes[id] = NDB_MGM_NODE_TYPE_API;
break;
case NODE_TYPE_MGM:
nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM;
break;
case NODE_TYPE_REP:
nodeTypes[id] = NDB_MGM_NODE_TYPE_REP;
break;
case NODE_TYPE_EXT_REP:
default:
break;
}
}
ndb_mgm_destroy_iterator(iter);
}
ndb_mgm_destroy_iterator(iter);
m_statisticsListner = NULL;
......@@ -589,6 +594,18 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
exit(-1);
}
_ownNodeId = tmp;
{
DBUG_PRINT("info", ("verifyConfig"));
ConfigRetriever cr(NDB_VERSION, NDB_MGM_NODE_TYPE_MGM);
if (!cr.verifyConfig(config->m_configValues, _ownNodeId)) {
ndbout << cr.getErrorString() << endl;
exit(-1);
}
}
DBUG_VOID_RETURN;
}
......
......@@ -109,7 +109,7 @@ struct getargs args[] = {
"Specify cluster configuration file", "filename" },
#ifndef DBUG_OFF
{ "debug", 0, arg_string, &debug_option,
"Specify debug option e.d. d:t:i:o,out.trace", "options" },
"Specify debug options e.g. d:t:i:o,out.trace", "options" },
#endif
{ "daemon", 'd', arg_flag, &glob.daemon,
"Run ndb_mgmd in daemon mode" },
......@@ -143,8 +143,8 @@ NDB_MAIN(mgmsrv){
exit(1);
}
my_init();
#ifndef DBUG_OFF
my_init();
if (debug_option)
DBUG_PUSH(debug_option);
#endif
......
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