diff options
author | unknown <monty@mysql.com> | 2004-09-06 15:14:10 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-09-06 15:14:10 +0300 |
commit | 4ad51359c1b7b5ed854f1af8df06fd6912068d28 (patch) | |
tree | d9ef905036723648a1d354d0523ef8124e4dee76 /ndb/src/common/mgmcommon | |
parent | fa3bfbe45796edd85cce30e62ff1fcfb81df745c (diff) | |
parent | 9a63c8e0e468d7a64dcb7e23f4e5c344eebf635b (diff) | |
download | mariadb-git-4ad51359c1b7b5ed854f1af8df06fd6912068d28.tar.gz |
Merge with 4.1
(Includes merge of arena code in 4.1 and 5.0)
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
VC++Files/sql/mysqld.dsp:
Auto merged
client/mysql.cc:
Auto merged
client/mysqltest.c:
Auto merged
include/my_global.h:
Auto merged
include/my_sys.h:
Auto merged
include/mysql.h:
Auto merged
include/mysql_com.h:
Auto merged
innobase/row/row0sel.c:
Auto merged
libmysql/client_settings.h:
Auto merged
libmysql/libmysql.c:
Auto merged
libmysqld/Makefile.am:
Auto merged
libmysqld/examples/Makefile.am:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
myisam/mi_check.c:
Auto merged
myisam/myisamchk.c:
Auto merged
myisam/sort.c:
Auto merged
mysql-test/r/connect.result:
Auto merged
mysql-test/r/ctype_recoding.result:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/r/func_in.result:
Auto merged
mysql-test/r/func_like.result:
Auto merged
mysql-test/r/gis.result:
Auto merged
mysql-test/r/having.result:
Auto merged
mysql-test/r/heap.result:
Auto merged
mysql-test/r/join.result:
Auto merged
mysql-test/r/key.result:
Auto merged
mysql-test/r/lowercase_table.result:
Auto merged
mysql-test/r/ndb_autodiscover.result:
Auto merged
mysql-test/r/null.result:
Auto merged
mysql-test/r/olap.result:
Auto merged
mysql-test/r/order_by.result:
Auto merged
mysql-test/r/ps_1general.result:
Auto merged
mysql-test/r/ps_2myisam.result:
Auto merged
mysql-test/r/ps_3innodb.result:
Auto merged
mysql-test/r/ps_4heap.result:
Auto merged
mysql-test/r/ps_5merge.result:
Auto merged
mysql-test/r/ps_6bdb.result:
Auto merged
mysql-test/r/range.result:
Auto merged
mysql-test/r/rename.result:
Auto merged
mysql-test/r/show_check.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/union.result:
Auto merged
mysql-test/r/variables.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
mysql-test/t/null.test:
Auto merged
mysql-test/t/ps_1general.test:
Auto merged
mysql-test/t/rpl_charset.test:
Auto merged
mysql-test/t/rpl_heap.test:
Auto merged
mysql-test/t/rpl_relayrotate.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/variables.test:
Auto merged
netware/mysql_test_run.c:
Auto merged
scripts/make_binary_distribution.sh:
Auto merged
scripts/mysql_create_system_tables.sh:
Auto merged
scripts/mysql_fix_privilege_tables.sql:
Auto merged
scripts/mysql_install_db.sh:
Auto merged
sql/ha_berkeley.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/ha_innodb.h:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/handler.h:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_create.cc:
Auto merged
sql/item_create.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/lex.h:
Auto merged
sql/lock.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_sum.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/records.cc:
Auto merged
sql/repl_failsafe.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_acl.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_list.h:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_rename.cc:
Auto merged
sql/sql_select.h:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_string.h:
Auto merged
sql/table.cc:
Auto merged
sql-common/client.c:
Auto merged
client/mysqlbinlog.cc:
Merge with 4.1
configure.in:
Merge with 4.1
include/mysqld_error.h:
Add new error message (1) from 4.1
mysql-test/mysql-test-run.sh:
Merge with 4.1
mysql-test/r/func_gconcat.result:
Merge with 4.1
mysql-test/r/func_if.result:
Merge with 4.1
mysql-test/r/grant.result:
Merge with 4.1
mysql-test/r/join_outer.result:
Merge with 4.1
mysql-test/r/rpl_charset.result:
Merge with 4.1 (This has to be fixed before pushing)
mysql-test/r/system_mysql_db.result:
Merge with 4.1.
Added collation to new privileges
mysql-test/t/grant.test:
Merge with 4.1
mysql-test/t/grant_cache.test:
Merge with 4.1
mysql-test/t/show_check.test:
Merge with 4.1
sql/Makefile.am:
Merge with 4.1
sql/item.cc:
Merge with 4.1
sql/item_cmpfunc.cc:
Merge with 4.1 (arena code)
sql/item_subselect.cc:
Merge with 4.1
sql/item_subselect.h:
Merge with 4.1
sql/item_sum.cc:
Merge with 4.1
sql/item_sum.h:
Merge with 4.1
sql/log.cc:
Merge with 4.1 (Remove code that is not relevant for 5.0)
sql/mysqld.cc:
Merge with 4.1
sql/opt_range.cc:
Merge with 4.1
sql/share/czech/errmsg.txt:
Merge with 4.1
sql/share/danish/errmsg.txt:
Merge with 4.1
sql/share/dutch/errmsg.txt:
Merge with 4.1
sql/share/english/errmsg.txt:
Merge with 4.1
sql/share/estonian/errmsg.txt:
Merge with 4.1
sql/share/french/errmsg.txt:
Merge with 4.1
sql/share/german/errmsg.txt:
Merge with 4.1
sql/share/greek/errmsg.txt:
Merge with 4.1
sql/share/hungarian/errmsg.txt:
Merge with 4.1
sql/share/italian/errmsg.txt:
Merge with 4.1
sql/share/japanese/errmsg.txt:
Merge with 4.1
sql/share/korean/errmsg.txt:
Merge with 4.1
sql/share/norwegian-ny/errmsg.txt:
Merge with 4.1
sql/share/norwegian/errmsg.txt:
Merge with 4.1
sql/share/polish/errmsg.txt:
Merge with 4.1
sql/share/portuguese/errmsg.txt:
Merge with 4.1
sql/share/romanian/errmsg.txt:
Merge with 4.1
sql/share/russian/errmsg.txt:
Merge with 4.1
sql/share/serbian/errmsg.txt:
Merge with 4.1
sql/share/slovak/errmsg.txt:
Merge with 4.1
sql/share/spanish/errmsg.txt:
Merge with 4.1
sql/share/swedish/errmsg.txt:
Merge with 4.1
sql/share/ukrainian/errmsg.txt:
Merge with 4.1
sql/sql_base.cc:
Merge with 4.1
sql/sql_class.cc:
Merge with 4.1
Use arena code from 4.1
sql/sql_class.h:
Merge with 4.1
Use arena code from 4.1
sql/sql_derived.cc:
Merge with 4.1
sql/sql_lex.cc:
Merge with 4.1
sql/sql_lex.h:
Merge with 4.1
sql/sql_parse.cc:
Merge with 4.1
sql/sql_prepare.cc:
Merge with 4.1
sql/sql_select.cc:
Merge with 4.1
sql/sql_table.cc:
Merge with 4.1
sql/sql_union.cc:
Merge with 4.1
sql/sql_yacc.yy:
Merge with 4.1
sql/tztime.cc:
Merge with 4.1
tests/client_test.c:
Merge with 4.1
Diffstat (limited to 'ndb/src/common/mgmcommon')
-rw-r--r-- | ndb/src/common/mgmcommon/ConfigInfo.cpp | 994 | ||||
-rw-r--r-- | ndb/src/common/mgmcommon/ConfigInfo.hpp | 7 | ||||
-rw-r--r-- | ndb/src/common/mgmcommon/ConfigRetriever.cpp | 302 | ||||
-rw-r--r-- | ndb/src/common/mgmcommon/IPCConfig.cpp | 19 | ||||
-rw-r--r-- | ndb/src/common/mgmcommon/InitConfigFileParser.cpp | 45 | ||||
-rw-r--r-- | ndb/src/common/mgmcommon/LocalConfig.cpp | 130 | ||||
-rw-r--r-- | ndb/src/common/mgmcommon/LocalConfig.hpp | 81 | ||||
-rw-r--r-- | ndb/src/common/mgmcommon/NdbConfig.c | 112 |
8 files changed, 774 insertions, 916 deletions
diff --git a/ndb/src/common/mgmcommon/ConfigInfo.cpp b/ndb/src/common/mgmcommon/ConfigInfo.cpp index c2b5fdabf01..552b49727fb 100644 --- a/ndb/src/common/mgmcommon/ConfigInfo.cpp +++ b/ndb/src/common/mgmcommon/ConfigInfo.cpp @@ -14,15 +14,26 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <NdbTCP.h> #include "ConfigInfo.hpp" #include <mgmapi_config_parameters.h> +#include <ndb_limits.h> #define MAX_LINE_LENGTH 255 #define KEY_INTERNAL 0 - +#define MAX_INT_RNIL (RNIL - 1) /**************************************************************************** * Section names ****************************************************************************/ + +const ConfigInfo::AliasPair +ConfigInfo::m_sectionNameAliases[]={ + {"API", "MYSQLD"}, + {"DB", "NDBD"}, + {"MGM", "NDB_MGMD"}, + {0, 0} +}; + const char* ConfigInfo::m_sectionNames[]={ "SYSTEM", @@ -47,24 +58,25 @@ sizeof(m_sectionNames)/sizeof(char*); /**************************************************************************** * Section Rules declarations ****************************************************************************/ -bool transformComputer(InitConfigFileParser::Context & ctx, const char *); -bool transformSystem(InitConfigFileParser::Context & ctx, const char *); -bool transformExternalSystem(InitConfigFileParser::Context & ctx, const char *); -bool transformNode(InitConfigFileParser::Context & ctx, const char *); -bool transformExtNode(InitConfigFileParser::Context & ctx, const char *); -bool transformConnection(InitConfigFileParser::Context & ctx, const char *); -bool applyDefaultValues(InitConfigFileParser::Context & ctx, const char *); -bool checkMandatory(InitConfigFileParser::Context & ctx, const char *); -bool fixPortNumber(InitConfigFileParser::Context & ctx, const char *); -bool fixShmkey(InitConfigFileParser::Context & ctx, const char *); -bool checkDbConstraints(InitConfigFileParser::Context & ctx, const char *); -bool checkConnectionConstraints(InitConfigFileParser::Context &, const char *); -bool fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data); -bool fixHostname(InitConfigFileParser::Context & ctx, const char * data); -bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data); -bool fixExtConnection(InitConfigFileParser::Context & ctx, const char * data); -bool fixDepricated(InitConfigFileParser::Context & ctx, const char *); -bool saveInConfigValues(InitConfigFileParser::Context & ctx, const char *); +static bool transformComputer(InitConfigFileParser::Context & ctx, const char *); +static bool transformSystem(InitConfigFileParser::Context & ctx, const char *); +static bool transformExternalSystem(InitConfigFileParser::Context & ctx, const char *); +static bool transformNode(InitConfigFileParser::Context & ctx, const char *); +static bool transformExtNode(InitConfigFileParser::Context & ctx, const char *); +static bool transformConnection(InitConfigFileParser::Context & ctx, const char *); +static bool applyDefaultValues(InitConfigFileParser::Context & ctx, const char *); +static bool checkMandatory(InitConfigFileParser::Context & ctx, const char *); +static bool fixPortNumber(InitConfigFileParser::Context & ctx, const char *); +static bool fixShmkey(InitConfigFileParser::Context & ctx, const char *); +static bool checkDbConstraints(InitConfigFileParser::Context & ctx, const char *); +static bool checkConnectionConstraints(InitConfigFileParser::Context &, const char *); +static bool checkTCPConstraints(InitConfigFileParser::Context &, const char *); +static bool fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data); +static bool fixHostname(InitConfigFileParser::Context & ctx, const char * data); +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 *); const ConfigInfo::SectionRule ConfigInfo::m_SectionRules[] = { @@ -83,9 +95,6 @@ ConfigInfo::m_SectionRules[] = { { "SCI", transformConnection, 0 }, { "OSE", transformConnection, 0 }, - { "TCP", fixPortNumber, 0 }, - //{ "SHM", fixShmKey, 0 }, - { "DB", fixNodeHostname, 0 }, { "API", fixNodeHostname, 0 }, { "MGM", fixNodeHostname, 0 }, @@ -106,6 +115,10 @@ ConfigInfo::m_SectionRules[] = { { "OSE", fixHostname, "HostName1" }, { "OSE", fixHostname, "HostName2" }, + { "TCP", fixPortNumber, 0 }, // has to come after fixHostName + { "SHM", fixPortNumber, 0 }, // has to come after fixHostName + //{ "SHM", fixShmKey, 0 }, + /** * fixExtConnection must be after fixNodeId */ @@ -128,7 +141,9 @@ ConfigInfo::m_SectionRules[] = { { "SCI", checkConnectionConstraints, 0 }, { "OSE", checkConnectionConstraints, 0 }, - + { "TCP", checkTCPConstraints, "HostName1" }, + { "TCP", checkTCPConstraints, "HostName2" }, + { "*", checkMandatory, 0 }, { "DB", saveInConfigValues, 0 }, @@ -146,13 +161,21 @@ const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule); /**************************************************************************** * Config Rules declarations ****************************************************************************/ -bool addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>§ions, - struct InitConfigFileParser::Context &ctx, - const char * ruleData); +static bool add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, + struct InitConfigFileParser::Context &ctx, + const char * rule_data); +static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, + struct InitConfigFileParser::Context &ctx, + const char * rule_data); +static bool check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>§ions, + struct InitConfigFileParser::Context &ctx, + const char * rule_data); const ConfigInfo::ConfigRule ConfigInfo::m_ConfigRules[] = { - { addNodeConnections, 0 }, + { add_node_connections, 0 }, + { add_server_ports, 0 }, + { check_node_vs_replicas, 0 }, { 0, 0 } }; @@ -166,24 +189,8 @@ struct DepricationTransform { static const DepricationTransform f_deprication[] = { - { "DB", "NoOfIndexPages", "IndexMemory", 0, 8192 } - ,{ "DB", "MemorySpaceIndexes", "IndexMemory", 0, 8192 } - ,{ "DB", "NoOfDataPages", "DataMemory", 0, 8192 } - ,{ "DB", "MemorySpaceTuples", "DataMemory", 0, 8192 } - ,{ "DB", "TransactionInactiveTimeBeforeAbort", "TransactionInactiveTimeout", - 0, 1 } - ,{ "TCP", "ProcessId1", "NodeId1", 0, 1} - ,{ "TCP", "ProcessId2", "NodeId2", 0, 1} - ,{ "TCP", "SendBufferSize", "SendBufferMemory", 0, 16384 } - ,{ "TCP", "MaxReceiveSize", "ReceiveBufferMemory", 0, 16384 } - - ,{ "SHM", "ProcessId1", "NodeId1", 0, 1} - ,{ "SHM", "ProcessId2", "NodeId2", 0, 1} - ,{ "SCI", "ProcessId1", "NodeId1", 0, 1} - ,{ "SCI", "ProcessId2", "NodeId2", 0, 1} - ,{ "OSE", "ProcessId1", "NodeId1", 0, 1} - ,{ "OSE", "ProcessId2", "NodeId2", 0, 1} - ,{ 0, 0, 0, 0, 0} + { "DB", "Discless", "Diskless", 0, 1 }, + { 0, 0, 0, 0, 0} }; /** @@ -241,27 +248,14 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { KEY_INTERNAL, "HostName", "COMPUTER", - "Hostname of computer (e.g. alzato.com)", + "Hostname of computer (e.g. mysql.com)", ConfigInfo::USED, false, ConfigInfo::STRING, MANDATORY, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, - { - CFG_NODE_BYTE_ORDER, - "ByteOrder", - "COMPUTER", - "Not yet implemented", - ConfigInfo::USED, // Actually not used, but since it is MANDATORY, - // we don't want any warning message - false, - ConfigInfo::STRING, - MANDATORY, // Big == 0, Little == 1, NotSet == 2 (?) - 0, - 1 }, - /**************************************************************************** * SYSTEM ***************************************************************************/ @@ -311,7 +305,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 0, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_SYS_CONFIG_GENERATION, @@ -323,7 +317,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 0, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, /*************************************************************************** * DB @@ -350,7 +344,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_NODE_SYSTEM, @@ -362,7 +356,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_NODE_ID, @@ -377,6 +371,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { (MAX_NODES - 1) }, { + KEY_INTERNAL, + "ServerPort", + "DB", + "Port used to setup transporter", + ConfigInfo::USED, + false, + ConfigInfo::INT, + UNDEFINED, + 1, + 65535 }, + + { CFG_DB_NO_REPLICAS, "NoOfReplicas", "DB", @@ -386,7 +392,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, MANDATORY, 1, - 2 }, + 4 }, { CFG_DB_NO_ATTRIBUTES, @@ -398,7 +404,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 1000, 32, - 4096 }, + MAX_INT_RNIL/16 }, { CFG_DB_NO_TABLES, @@ -408,9 +414,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT, - 32, + 128, 8, - 128 }, + MAX_INT_RNIL }, { CFG_DB_NO_INDEXES, @@ -422,7 +428,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 128, 0, - 2048 }, + MAX_INT_RNIL }, { CFG_DB_NO_INDEX_OPS, @@ -434,8 +440,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 8192, 0, - 1000000 - }, + MAX_INT_RNIL + }, { CFG_DB_NO_TRIGGERS, @@ -447,7 +453,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 768, 0, - 2432 }, + MAX_INT_RNIL }, { CFG_DB_NO_TRIGGER_OPS, @@ -457,9 +463,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT, - 1000, + 4000, 0, - 1000000 }, + MAX_INT_RNIL }, { KEY_INTERNAL, @@ -471,7 +477,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, MANDATORY, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_NO_SAVE_MSGS, @@ -483,7 +489,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 25, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_MEMLOCK, @@ -495,33 +501,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, false, 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "SleepWhenIdle", - "DB", - 0, - ConfigInfo::DEPRICATED, - true, - ConfigInfo::BOOL, - true, - 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { - KEY_INTERNAL, - "NoOfSignalsToExecuteBetweenCommunicationInterfacePoll", - "DB", - 0, - ConfigInfo::DEPRICATED, - true, - ConfigInfo::INT, - 20, - 1, - 0x7FFFFFFF }, - - { CFG_DB_WATCHDOG_INTERVAL, "TimeBetweenWatchDogCheck", "DB", @@ -529,9 +511,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, true, ConfigInfo::INT, - 4000, + 6000, 70, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_STOP_ON_ERROR, @@ -543,7 +525,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, true, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_STOP_ON_ERROR_INSERT, @@ -565,9 +547,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT, - 8192, + 32768, 32, - 1000000 }, + MAX_INT_RNIL }, { CFG_DB_NO_TRANSACTIONS, @@ -579,7 +561,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 4096, 32, - 1000000 }, + MAX_INT_RNIL }, { CFG_DB_NO_SCANS, @@ -589,7 +571,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT, - 25, + 256, 2, 500 }, @@ -601,9 +583,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT, - 1024000, + (1024 * 1024), 1024, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_INDEX_MEM, @@ -613,33 +595,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT64, - 3000 * 8192, + 3 * 1024 * 8192, 128 * 8192, - ((Uint64)192000) * ((Uint64)8192) }, - - { - KEY_INTERNAL, - "NoOfIndexPages", - "DB", - "IndexMemory", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - 3000, - 128, - 192000 }, - - { - KEY_INTERNAL, - "MemorySpaceIndexes", - "DB", - "IndexMemory", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 128, - 192000 }, + ((Uint64)MAX_INT_RNIL) * ((Uint64)8192) }, { CFG_DB_DATA_MEM, @@ -649,35 +607,11 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT64, - 10000 * 8192, + 10 * 1024 * 8192, 128 * 8192, - ((Uint64)400000) * ((Uint64)8192) }, + ((Uint64)MAX_INT_RNIL) * ((Uint64)8192) }, { - KEY_INTERNAL, - "NoOfDataPages", - "DB", - "DataMemory", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - 10000, - 128, - 400000 }, - - { - KEY_INTERNAL, - "MemorySpaceTuples", - "DB", - "DataMemory", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 128, - 400000 }, - - { CFG_DB_START_PARTIAL_TIMEOUT, "StartPartialTimeout", "DB", @@ -709,23 +643,11 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, true, ConfigInfo::INT, - 5*60000, + 0, 0, ~0 }, { - KEY_INTERNAL, - "TimeToWaitAlive", - "DB", - "Start{Partial/Partitioned/Failure}Time", - ConfigInfo::DEPRICATED, - true, - ConfigInfo::INT, - 25, - 2, - 4000 }, - - { CFG_DB_HEARTBEAT_INTERVAL, "HeartbeatIntervalDbDb", "DB", @@ -735,7 +657,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 1500, 10, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_API_HEARTBEAT_INTERVAL, @@ -747,7 +669,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 1500, 100, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_LCP_INTERVAL, @@ -783,7 +705,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 8, 1, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { KEY_INTERNAL, @@ -808,7 +730,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 1000, 1000, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_TRANSACTION_INACTIVE_TIMEOUT, @@ -822,9 +744,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, true, ConfigInfo::INT, - 3000, + MAX_INT_RNIL, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT, @@ -837,33 +759,21 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, true, ConfigInfo::INT, - 3000, + 1200, 50, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { KEY_INTERNAL, - "TransactionInactiveTimeBeforeAbort", - "DB", - "TransactionInactiveTimeout", - ConfigInfo::DEPRICATED, - true, - ConfigInfo::INT, - 3000, - 20, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, "NoOfDiskPagesToDiskDuringRestartTUP", "DB", "?", ConfigInfo::USED, true, ConfigInfo::INT, - 50, + 40, 1, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { KEY_INTERNAL, @@ -873,9 +783,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, true, ConfigInfo::INT, - 10, + 40, 1, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { KEY_INTERNAL, @@ -885,9 +795,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, true, ConfigInfo::INT, - 25, + 20, 1, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { KEY_INTERNAL, @@ -897,14 +807,14 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, true, ConfigInfo::INT, - 5, + 20, 1, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_DISCLESS, - "Discless", + "Diskless", "DB", "Run wo/ disk", ConfigInfo::USED, @@ -913,6 +823,20 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { 0, 0, 1}, + + { + KEY_INTERNAL, + "Discless", + "DB", + "Diskless", + ConfigInfo::DEPRICATED, + true, + ConfigInfo::BOOL, + 0, + 0, + 1}, + + { CFG_DB_ARBIT_TIMEOUT, @@ -922,9 +846,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT, - 1000, + 3000, 10, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_FILESYSTEM_PATH, @@ -936,7 +860,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_LOGLEVEL_STARTUP, @@ -1059,7 +983,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, (2 * 1024 * 1024) + (2 * 1024 * 1024), // sum of BackupDataBufferSize and BackupLogBufferSize 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_BACKUP_DATA_BUFFER_MEM, @@ -1071,7 +995,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, (2 * 1024 * 1024), // remember to change BackupMemory 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_BACKUP_LOG_BUFFER_MEM, @@ -1083,7 +1007,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, (2 * 1024 * 1024), // remember to change BackupMemory 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_DB_BACKUP_WRITE_SIZE, @@ -1095,7 +1019,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 32768, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, /*************************************************************************** * REP @@ -1122,7 +1046,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_NODE_SYSTEM, @@ -1134,7 +1058,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_NODE_ID, @@ -1158,7 +1082,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, MANDATORY, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_REP_HEARTBEAT_INTERVAL, @@ -1170,7 +1094,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 3000, 100, - 0x7FFFFFFF }, + MAX_INT_RNIL }, /*************************************************************************** * API @@ -1197,7 +1121,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_NODE_SYSTEM, @@ -1209,7 +1133,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_NODE_ID, @@ -1231,9 +1155,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::STRING, - MANDATORY, 0, - 0x7FFFFFFF }, + 0, + MAX_INT_RNIL }, { CFG_NODE_ARBIT_RANK, @@ -1243,7 +1167,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT, - 2, + 0, 0, 2 }, @@ -1257,7 +1181,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 0, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, /**************************************************************************** * MGM @@ -1284,7 +1208,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_NODE_SYSTEM, @@ -1296,7 +1220,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_NODE_ID, @@ -1320,7 +1244,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, 0, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { KEY_INTERNAL, @@ -1330,9 +1254,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::STRING, - MANDATORY, 0, - 0x7FFFFFFF }, + 0, + MAX_INT_RNIL }, { KEY_INTERNAL, @@ -1344,7 +1268,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 100, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_MGM_PORT, @@ -1354,9 +1278,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT, - 2200, + NDB_BASE_PORT, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { KEY_INTERNAL, @@ -1368,7 +1292,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 2199, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_NODE_ARBIT_RANK, @@ -1378,7 +1302,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::USED, false, ConfigInfo::INT, - 2, + 1, 0, 2 }, @@ -1392,7 +1316,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 0, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, /**************************************************************************** * TCP @@ -1419,7 +1343,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_TCP_HOSTNAME_2, @@ -1431,7 +1355,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_1, @@ -1443,19 +1367,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, MANDATORY, 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "ProcessId1", - "TCP", - "NodeId1", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_2, @@ -1467,43 +1379,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, MANDATORY, 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "ProcessId2", - "TCP", - "NodeId2", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "IpAddress1", - "TCP", - "HostName1", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::STRING, - UNDEFINED, - 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "IpAddress2", - "TCP", - "HostName2", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::STRING, - UNDEFINED, - 0, - 0 }, + MAX_INT_RNIL }, { CFG_CONNECTION_SEND_SIGNAL_ID, @@ -1515,7 +1391,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, true, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { @@ -1528,19 +1404,19 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, false, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { - CFG_TCP_SERVER_PORT, + CFG_CONNECTION_SERVER_PORT, "PortNumber", "TCP", "Port used for this transporter", ConfigInfo::USED, false, ConfigInfo::INT, - 2202, + MANDATORY, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_TCP_SEND_BUFFER_SIZE, @@ -1552,21 +1428,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 16 * 16384, 1 * 16384, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { - KEY_INTERNAL, - "SendBufferSize", - "TCP", - "SendBufferMemory", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - 16, - 1, - 0x7FFFFFFF }, - - { CFG_TCP_RECEIVE_BUFFER_SIZE, "ReceiveBufferMemory", "TCP", @@ -1576,19 +1440,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 4 * 16384, 1 * 16384, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "MaxReceiveSize", - "TCP", - "ReceiveBufferMemory", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - 4, - 1, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_TCP_PROXY, @@ -1603,19 +1455,6 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { 0 }, { - KEY_INTERNAL, - "Compression", - "TCP", - 0, - ConfigInfo::DEPRICATED, - false, - ConfigInfo::BOOL, - false, - 0, - 0x7FFFFFFF }, - - - { CFG_CONNECTION_NODE_1_SYSTEM, "NodeId1_System", "TCP", @@ -1625,7 +1464,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_2_SYSTEM, @@ -1637,7 +1476,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, /**************************************************************************** @@ -1665,20 +1504,20 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, MANDATORY, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { - KEY_INTERNAL, - "ProcessId1", + CFG_CONNECTION_SERVER_PORT, + "PortNumber", "SHM", - "NodeId1", - ConfigInfo::DEPRICATED, + "Port used for this transporter", + ConfigInfo::USED, false, - ConfigInfo::STRING, - UNDEFINED, + ConfigInfo::INT, + MANDATORY, 0, - 0x7FFFFFFF }, - + MAX_INT_RNIL }, + { CFG_CONNECTION_NODE_2, "NodeId2", @@ -1689,19 +1528,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, MANDATORY, 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "ProcessId2", - "SHM", - "NodeId1", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::STRING, - UNDEFINED, - 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_SEND_SIGNAL_ID, @@ -1713,7 +1540,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, false, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { @@ -1726,7 +1553,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, true, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_SHM_KEY, @@ -1738,7 +1565,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, MANDATORY, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_SHM_BUFFER_MEM, @@ -1750,21 +1577,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 1048576, 4096, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { - KEY_INTERNAL, - "Compression", - "SHM", - 0, - ConfigInfo::DEPRICATED, - false, - ConfigInfo::BOOL, - false, - 0, - 0x7FFFFFFF }, - - { CFG_CONNECTION_NODE_1_SYSTEM, "NodeId1_System", "SHM", @@ -1774,7 +1589,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_2_SYSTEM, @@ -1786,7 +1601,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, /**************************************************************************** * SCI @@ -1813,19 +1628,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, MANDATORY, 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "ProcessId1", - "SCI", - "NodeId1", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_2, @@ -1837,19 +1640,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, MANDATORY, 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "ProcessId2", - "SCI", - "NodeId2", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_SCI_ID_0, @@ -1861,7 +1652,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, MANDATORY, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_SCI_ID_1, @@ -1873,7 +1664,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, MANDATORY, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_SEND_SIGNAL_ID, @@ -1885,7 +1676,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, true, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_CHECKSUM, @@ -1897,7 +1688,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, false, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_SCI_SEND_LIMIT, @@ -1909,7 +1700,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 2048, 512, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_SCI_BUFFER_MEM, @@ -1921,67 +1712,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 1048576, 262144, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "Node1_NoOfAdapters", - "SCI", - 0, - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "Node2_NoOfAdapters", - "SCI", - 0, - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "Node1_Adapter", - "SCI", - 0, - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "Node2_Adapter", - "SCI", - 0, - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "Compression", - "SCI", - 0, - ConfigInfo::DEPRICATED, - false, - ConfigInfo::BOOL, - false, - 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_1_SYSTEM, @@ -1993,7 +1724,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_2_SYSTEM, @@ -2005,7 +1736,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, /**************************************************************************** * OSE @@ -2032,7 +1763,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_OSE_HOSTNAME_2, @@ -2044,7 +1775,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_1, @@ -2056,19 +1787,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, MANDATORY, 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "ProcessId1", - "OSE", - "NodeId1", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - UNDEFINED, - 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_2, @@ -2080,19 +1799,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, UNDEFINED, 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "ProcessId2", - "OSE", - "NodeId2", - ConfigInfo::DEPRICATED, - false, - ConfigInfo::INT, - MANDATORY, - 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_SEND_SIGNAL_ID, @@ -2104,7 +1811,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, true, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_CHECKSUM, @@ -2116,7 +1823,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::BOOL, false, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_OSE_PRIO_A_SIZE, @@ -2128,7 +1835,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 1000, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_OSE_PRIO_B_SIZE, @@ -2140,7 +1847,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 1000, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_OSE_RECEIVE_ARRAY_SIZE, @@ -2152,19 +1859,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT, 10, 0, - 0x7FFFFFFF }, - - { - KEY_INTERNAL, - "Compression", - "OSE", - 0, - ConfigInfo::DEPRICATED, - false, - ConfigInfo::BOOL, - false, - 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, { CFG_CONNECTION_NODE_1_SYSTEM, @@ -2176,7 +1871,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL}, { CFG_CONNECTION_NODE_2_SYSTEM, @@ -2188,7 +1883,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::STRING, UNDEFINED, 0, - 0x7FFFFFFF }, + MAX_INT_RNIL }, }; const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo); @@ -2197,22 +1892,21 @@ const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo); /**************************************************************************** * Ctor ****************************************************************************/ -inline void require(bool v) { if(!v) abort();} +static void require(bool v) { if(!v) abort();} -ConfigInfo::ConfigInfo() { +ConfigInfo::ConfigInfo() + : m_info(true), m_systemDefaults(true) +{ + int i; Properties *section; const Properties *oldpinfo; - m_info.setCaseInsensitiveNames(true); - m_systemDefaults.setCaseInsensitiveNames(true); - - for (int i=0; i<m_NoOfParams; i++) { + for (i=0; i<m_NoOfParams; i++) { const ParamInfo & param = m_ParamInfo[i]; // Create new section if it did not exist if (!m_info.getCopy(param._section, §ion)) { - Properties newsection; - newsection.setCaseInsensitiveNames(true); + Properties newsection(true); m_info.put(param._section, &newsection); } @@ -2220,7 +1914,7 @@ ConfigInfo::ConfigInfo() { m_info.getCopy(param._section, §ion); // Create pinfo (parameter info) entry - Properties pinfo; + Properties pinfo(true); pinfo.put("Id", param._paramId); pinfo.put("Fname", param._fname); pinfo.put("Description", param._description); @@ -2248,8 +1942,7 @@ ConfigInfo::ConfigInfo() { if(param._type != ConfigInfo::SECTION){ Properties * p; if(!m_systemDefaults.getCopy(param._section, &p)){ - p = new Properties(); - p->setCaseInsensitiveNames(true); + p = new Properties(true); } if(param._type != STRING && param._default != UNDEFINED && @@ -2261,7 +1954,7 @@ ConfigInfo::ConfigInfo() { } } - for (int i=0; i<m_NoOfParams; i++) { + for (i=0; i<m_NoOfParams; i++) { if(m_ParamInfo[i]._section == NULL){ ndbout << "Check that each entry has a section failed." << endl; ndbout << "Parameter \"" << m_ParamInfo[i]._fname << endl; @@ -2376,6 +2069,14 @@ ConfigInfo::isSection(const char * section) const { return false; } +const char* +ConfigInfo::getAlias(const char * section) const { + for (int i = 0; m_sectionNameAliases[i].name != 0; i++) + if(!strcmp(section, m_sectionNameAliases[i].alias)) + return m_sectionNameAliases[i].name; + return 0; +} + bool ConfigInfo::verify(const Properties * section, const char* fname, Uint64 value) const { @@ -2489,11 +2190,27 @@ transformNode(InitConfigFileParser::Context & ctx, const char * data){ Uint32 id; if(!ctx.m_currentSection->get("Id", &id)){ + Uint32 nextNodeId= 1; + ctx.m_userProperties.get("NextNodeId", &nextNodeId); + id= nextNodeId; + while (ctx.m_userProperties.get("AllocatedNodeId_", id, &id)) + id++; + ctx.m_userProperties.put("NextNodeId", id+1, true); + ctx.m_currentSection->put("Id", id); +#if 0 ctx.reportError("Mandatory parameter Id missing from section " "[%s] starting at line: %d", ctx.fname, ctx.m_sectionLineno); return false; +#endif + } else if(ctx.m_userProperties.get("AllocatedNodeId_", id, &id)) { + ctx.reportError("Duplicate Id in section " + "[%s] starting at line: %d", + ctx.fname, ctx.m_sectionLineno); + return false; } + + ctx.m_userProperties.put("AllocatedNodeId_", id, id); snprintf(ctx.pname, sizeof(ctx.pname), "Node_%d", id); ctx.m_currentSection->put("Type", ctx.fname); @@ -2502,6 +2219,13 @@ transformNode(InitConfigFileParser::Context & ctx, const char * data){ ctx.m_userProperties.get("NoOfNodes", &nodes); ctx.m_userProperties.put("NoOfNodes", ++nodes, true); + /** + * Update count (per type) + */ + nodes = 0; + ctx.m_userProperties.get(ctx.fname, &nodes); + ctx.m_userProperties.put(ctx.fname, ++nodes, true); + return true; } @@ -2510,10 +2234,16 @@ fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data){ const char * compId; if(!ctx.m_currentSection->get("ExecuteOnComputer", &compId)){ - ctx.reportError("Parameter \"ExecuteOnComputer\" missing from section " - "[%s] starting at line: %d", - ctx.fname, ctx.m_sectionLineno); - return false; + require(ctx.m_currentSection->put("HostName", "")); + + const char * type; + if(ctx.m_currentSection->get("Type", &type) && strcmp(type,"DB") == 0) { + ctx.reportError("Parameter \"ExecuteOnComputer\" missing from DB section" + " [%s] starting at line: %d", + ctx.fname, ctx.m_sectionLineno); + return false; + } + return true; } const Properties * computer; @@ -2598,6 +2328,9 @@ transformSystem(InitConfigFileParser::Context & ctx, const char * data){ ctx.fname, ctx.m_sectionLineno); return false; } + + ndbout << "transformSystem " << name << endl; + snprintf(ctx.pname, sizeof(ctx.pname), "SYSTEM_%s", name); return true; @@ -2638,6 +2371,22 @@ transformComputer(InitConfigFileParser::Context & ctx, const char * data){ ctx.m_userProperties.get("NoOfComputers", &computers); ctx.m_userProperties.put("NoOfComputers", ++computers, true); + const char * hostname = 0; + ctx.m_currentSection->get("HostName", &hostname); + if(!hostname){ + return true; + } + + if(!strcmp(hostname, "localhost") || !strcmp(hostname, "127.0.0.1")){ + if(ctx.m_userProperties.get("$computer-localhost", &hostname)){ + ctx.reportError("Mixing of localhost with other hostname(%s) is illegal", + hostname); + return false; + } + } else { + ctx.m_userProperties.put("$computer-localhost", hostname); + } + return true; } @@ -2725,7 +2474,7 @@ checkMandatory(InitConfigFileParser::Context & ctx, const char * data){ * Transform a string "NodeidX" (e.g. "uppsala.32") * into a Uint32 "NodeIdX" (e.g. 32) and a string "SystemX" (e.g. "uppsala"). */ -bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data) +static bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data) { char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")]; char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")]; @@ -2761,7 +2510,7 @@ bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data) * - name of external system in parameter extSystemName, and * - nodeId of external node in parameter extSystemNodeId. */ -bool +static bool isExtConnection(InitConfigFileParser::Context & ctx, const char **extSystemName, Uint32 * extSystemNodeId){ @@ -2789,7 +2538,7 @@ isExtConnection(InitConfigFileParser::Context & ctx, * If connection is to an external system, then move connection into * external system configuration (i.e. a sub-property). */ -bool +static bool fixExtConnection(InitConfigFileParser::Context & ctx, const char * data){ const char * extSystemName; @@ -2844,7 +2593,7 @@ fixExtConnection(InitConfigFileParser::Context & ctx, const char * data){ * -# Via Node's ExecuteOnComputer lookup Hostname * -# Add HostName to Connection */ -bool +static bool fixHostname(InitConfigFileParser::Context & ctx, const char * data){ char buf[] = "NodeIdX"; buf[6] = data[sizeof("HostNam")]; @@ -2867,28 +2616,61 @@ fixHostname(InitConfigFileParser::Context & ctx, const char * data){ /** * Connection rule: Fix port number (using a port number adder) */ -bool +static bool fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){ - if(!ctx.m_currentSection->contains("PortNumber")){ - Uint32 adder = 0; - ctx.m_userProperties.get("PortNumberAdder", &adder); - Uint32 base = 0; - if(!(ctx.m_userDefaults && ctx.m_userDefaults->get("PortNumber", &base)) && - !ctx.m_systemDefaults->get("PortNumber", &base)){ - return false; + Uint32 id1= 0, id2= 0; + require(ctx.m_currentSection->get("NodeId1", &id1)); + require(ctx.m_currentSection->get("NodeId2", &id2)); + id1 = id1 < id2 ? id1 : id2; + + const Properties * node; + require(ctx.m_config->get("Node", id1, &node)); + BaseString hostname; + require(node->get("HostName", hostname)); + + if (hostname.c_str()[0] == 0) { + ctx.reportError("Hostname required on nodeid %d since it will act as server.", id1); + return false; + } + + Uint32 port= 0; + if (!node->get("ServerPort", &port) && !ctx.m_userProperties.get("ServerPort_", id1, &port)) { + Uint32 adder= 0; + { + BaseString server_port_adder(hostname); + server_port_adder.append("_ServerPortAdder"); + ctx.m_userProperties.get(server_port_adder.c_str(), &adder); + ctx.m_userProperties.put(server_port_adder.c_str(), adder+1, true); + } + + Uint32 base= 0; + if (!ctx.m_userProperties.get("ServerPortBase", &base)){ + if(!(ctx.m_userDefaults && ctx.m_userDefaults->get("PortNumber", &base)) && + !ctx.m_systemDefaults->get("PortNumber", &base)) { + base= NDB_BASE_PORT+2; + // ctx.reportError("Cannot retrieve base port number"); + // return false; + } + ctx.m_userProperties.put("ServerPortBase", base); } - ctx.m_currentSection->put("PortNumber", base + adder); - adder++; - ctx.m_userProperties.put("PortNumberAdder", adder, true); + port= base + adder; + ctx.m_userProperties.put("ServerPort_", id1, port); } + + if(ctx.m_currentSection->contains("PortNumber")) { + ndbout << "PortNumber should no longer be specificied per connection, please remove from config. Will be changed to " << port << endl; + ctx.m_currentSection->put("PortNumber", port, true); + } else + ctx.m_currentSection->put("PortNumber", port); + return true; } /** * DB Node rule: Check various constraints */ -bool +static bool checkDbConstraints(InitConfigFileParser::Context & ctx, const char *){ Uint32 t1 = 0, t2 = 0; @@ -2921,7 +2703,7 @@ checkDbConstraints(InitConfigFileParser::Context & ctx, const char *){ /** * Connection rule: Check varius constraints */ -bool +static bool checkConnectionConstraints(InitConfigFileParser::Context & ctx, const char *){ Uint32 id1 = 0, id2 = 0; @@ -2977,6 +2759,22 @@ checkConnectionConstraints(InitConfigFileParser::Context & ctx, const char *){ ctx.fname, ctx.m_sectionLineno); return false; } + + return true; +} + +static bool +checkTCPConstraints(InitConfigFileParser::Context & ctx, const char * data){ + + const char * host; + struct in_addr addr; + if(ctx.m_currentSection->get(data, &host) && strlen(host) && + Ndb_getInAddr(&addr, host)){ + ctx.reportError("Unable to lookup/illegal hostname %s" + " - [%s] starting at line: %d", + host, ctx.fname, ctx.m_sectionLineno); + return false; + } return true; } @@ -3000,7 +2798,8 @@ transform(InitConfigFileParser::Context & ctx, require(ctx.m_currentSection->getTypeOf(oldName, &oldType)); ConfigInfo::Type newType = ctx.m_info->getType(ctx.m_currentInfo, newName); if(!((oldType == PropertiesType_Uint32 || oldType == PropertiesType_Uint64) - && (newType == ConfigInfo::INT || newType == ConfigInfo::INT64))){ + && (newType == ConfigInfo::INT || newType == ConfigInfo::INT64 || newType == ConfigInfo::BOOL))){ + ndbout << "oldType: " << (int)oldType << ", newType: " << (int)newType << endl; ctx.reportError("Unable to handle type conversion w.r.t deprication %s %s" "- [%s] starting at line: %d", oldName, newName, @@ -3019,23 +2818,24 @@ transform(InitConfigFileParser::Context & ctx, return false; } - if(newType == ConfigInfo::INT){ + if(newType == ConfigInfo::INT || newType == ConfigInfo::BOOL){ require(dst.put(newName, (Uint32)newVal)); - } else { + } else if(newType == ConfigInfo::INT64) { require(dst.put64(newName, newVal)); } return true; } -bool +static bool fixDepricated(InitConfigFileParser::Context & ctx, const char * data){ + const char * name; /** * Transform old values to new values * Transform new values to old values (backward compatible) */ - Properties tmp; + Properties tmp(true); Properties::Iterator it(ctx.m_currentSection); - for (const char* name = it.first(); name != NULL; name = it.next()) { + for (name = it.first(); name != NULL; name = it.next()) { const DepricationTransform * p = &f_deprication[0]; while(p->m_section != 0){ if(strcmp(p->m_section, ctx.fname) == 0){ @@ -3056,7 +2856,7 @@ fixDepricated(InitConfigFileParser::Context & ctx, const char * data){ } Properties::Iterator it2(&tmp); - for (const char* name = it2.first(); name != NULL; name = it2.next()) { + for (name = it2.first(); name != NULL; name = it2.next()) { PropertiesType type; require(tmp.getTypeOf(name, &type)); switch(type){ @@ -3086,7 +2886,7 @@ fixDepricated(InitConfigFileParser::Context & ctx, const char * data){ return true; } -bool +static bool saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){ const Properties * sec; if(!ctx.m_currentInfo->get(ctx.fname, &sec)){ @@ -3151,22 +2951,24 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){ default: abort(); } + require(ok); } ctx.m_configValues.closeSection(); } while(0); return true; } -bool -addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>§ions, +static bool +add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, - const char * ruleData) + const char * rule_data) { + Uint32 i; Properties * props= ctx.m_config; - Properties p_connections; - Properties p_connections2; + Properties p_connections(true); + Properties p_connections2(true); - for (Uint32 i = 0;; i++){ + for (i = 0;; i++){ const Properties * tmp; Uint32 nodeId1, nodeId2; @@ -3184,11 +2986,11 @@ addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>§ions, Uint32 nNodes; ctx.m_userProperties.get("NoOfNodes", &nNodes); - Properties p_db_nodes; - Properties p_api_mgm_nodes; + Properties p_db_nodes(true); + Properties p_api_mgm_nodes(true); - Uint32 i_db= 0, i_api_mgm= 0; - for (Uint32 i= 0, n= 0; n < nNodes; i++){ + Uint32 i_db= 0, i_api_mgm= 0, n; + for (i= 0, n= 0; n < nNodes; i++){ const Properties * tmp; if(!props->get("Node", i, &tmp)) continue; n++; @@ -3205,13 +3007,13 @@ addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>§ions, Uint32 nodeId1, nodeId2, dummy; - for (Uint32 i= 0; p_db_nodes.get("", i, &nodeId1); i++){ + for (i= 0; p_db_nodes.get("", i, &nodeId1); i++){ for (Uint32 j= i+1;; j++){ if(!p_db_nodes.get("", j, &nodeId2)) break; if(!p_connections2.get("", nodeId1+nodeId2<<16, &dummy)) { ConfigInfo::ConfigRuleSection s; s.m_sectionType= BaseString("TCP"); - s.m_sectionData= new Properties; + s.m_sectionData= new Properties(true); char buf[16]; snprintf(buf, sizeof(buf), "%u", nodeId1); s.m_sectionData->put("NodeId1", buf); @@ -3222,13 +3024,13 @@ addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>§ions, } } - for (Uint32 i= 0; p_api_mgm_nodes.get("", i, &nodeId1); i++){ + for (i= 0; p_api_mgm_nodes.get("", i, &nodeId1); i++){ if(!p_connections.get("", nodeId1, &dummy)) { for (Uint32 j= 0;; j++){ if(!p_db_nodes.get("", j, &nodeId2)) break; ConfigInfo::ConfigRuleSection s; s.m_sectionType= BaseString("TCP"); - s.m_sectionData= new Properties; + s.m_sectionData= new Properties(true); char buf[16]; snprintf(buf, sizeof(buf), "%u", nodeId1); s.m_sectionData->put("NodeId1", buf); @@ -3241,3 +3043,63 @@ addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>§ions, return true; } + + +static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, + struct InitConfigFileParser::Context &ctx, + const char * rule_data) +{ +#if 0 + Properties * props= ctx.m_config; + Properties computers(true); + Uint32 port_base = NDB_BASE_PORT+2; + + Uint32 nNodes; + ctx.m_userProperties.get("NoOfNodes", &nNodes); + + for (Uint32 i= 0, n= 0; n < nNodes; i++){ + Properties * tmp; + if(!props->get("Node", i, &tmp)) continue; + n++; + + const char * type; + if(!tmp->get("Type", &type)) continue; + + Uint32 port; + if (tmp->get("ServerPort", &port)) continue; + + Uint32 computer; + if (!tmp->get("ExecuteOnComputer", &computer)) continue; + + Uint32 adder= 0; + computers.get("",computer, &adder); + + if (strcmp(type,"DB") == 0) { + adder++; + tmp->put("ServerPort", port_base+adder); + computers.put("",computer, adder); + } + } +#endif + return true; +} + +static bool +check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>§ions, + struct InitConfigFileParser::Context &ctx, + const char * rule_data) +{ + Uint32 db_nodes = 0; + Uint32 replicas = 0; + ctx.m_userProperties.get("DB", &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" + "No of nodes must be dividable with no or replicas"); + return false; + } + + return true; +} + +template class Vector<ConfigInfo::ConfigRuleSection>; diff --git a/ndb/src/common/mgmcommon/ConfigInfo.hpp b/ndb/src/common/mgmcommon/ConfigInfo.hpp index 79c17b436fe..9a954fe78d5 100644 --- a/ndb/src/common/mgmcommon/ConfigInfo.hpp +++ b/ndb/src/common/mgmcommon/ConfigInfo.hpp @@ -61,6 +61,11 @@ public: Uint64 _max; }; + struct AliasPair{ + const char * name; + const char * alias; + }; + /** * Entry for one section rule */ @@ -100,6 +105,7 @@ public: * @note Result is not defined if section/name are wrong! */ bool verify(const Properties* secti, const char* fname, Uint64 value) const; + const char* getAlias(const char*) const; bool isSection(const char*) const; const char* getDescription(const Properties * sec, const char* fname) const; @@ -123,6 +129,7 @@ private: static const ParamInfo m_ParamInfo[]; static const int m_NoOfParams; + static const AliasPair m_sectionNameAliases[]; static const char* m_sectionNames[]; static const int m_noOfSectionNames; diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index d2c622593de..2e809907058 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -37,37 +37,26 @@ #include <mgmapi.h> #include <mgmapi_config_parameters.h> +#include <mgmapi_configuration.hpp> #include <ConfigValues.hpp> #include <NdbHost.h> //**************************************************************************** //**************************************************************************** -ConfigRetriever::ConfigRetriever() { +ConfigRetriever::ConfigRetriever(Uint32 version, Uint32 node_type) { - _localConfigFileName = NULL; - m_defaultConnectString = NULL; - - - errorString = 0; - _localConfig = new LocalConfig(); - m_connectString = NULL; + m_handle= 0; + m_version = version; + m_node_type = node_type; } ConfigRetriever::~ConfigRetriever(){ - if(_localConfigFileName != 0) - free(_localConfigFileName); - - if(m_defaultConnectString != 0) - free(m_defaultConnectString); - if(m_connectString != 0) - free(m_connectString); - - if(errorString != 0) - free(errorString); - - delete _localConfig; + if (m_handle) { + ndb_mgm_disconnect(m_handle); + ndb_mgm_destroy_handle(&m_handle); + } } @@ -75,67 +64,51 @@ ConfigRetriever::~ConfigRetriever(){ //**************************************************************************** int -ConfigRetriever::init(bool onlyNodeId) { - if (_localConfig->init(onlyNodeId, m_connectString, _localConfigFileName, m_defaultConnectString)) { - return _ownNodeId = (*_localConfig)._ownNodeId; +ConfigRetriever::init() { + if (!_localConfig.init(m_connectString.c_str(), + _localConfigFileName.c_str())){ + + setError(CR_ERROR, "error in retrieving contact info for mgmtsrvr"); + _localConfig.printError(); + _localConfig.printUsage(); + return -1; } - - setError(CR_ERROR, "error in retrieving contact info for mgmtsrvr"); - _localConfig->printError(); - _localConfig->printUsage(); - - return -1; -} -//**************************************************************************** -//**************************************************************************** -//**************************************************************************** -//**************************************************************************** -struct ndb_mgm_configuration* -ConfigRetriever::getConfig(int verId, int nodeType) { + return _ownNodeId = _localConfig._ownNodeId; +} - int res = init(); - if (res == -1) { - return 0; - } +int +ConfigRetriever::do_connect(){ - if (_localConfig->items == 0){ - setError(CR_ERROR,"No Management Servers configured in local config file"); - return 0; + if(!m_handle) + m_handle= ndb_mgm_create_handle(); + + if (m_handle == 0) { + setError(CR_ERROR, "Unable to allocate mgm handle"); + return -1; } int retry = 1; int retry_max = 12; // Max number of retry attempts int retry_interval= 5; // Seconds between each retry - do { + while(retry < retry_max){ Uint32 type = CR_ERROR; - for (int i = 0; i<_localConfig->items; i++){ - MgmtSrvrId * m = _localConfig->ids[i]; - struct ndb_mgm_configuration * p = 0; + BaseString tmp; + for (int i = 0; i<_localConfig.ids.size(); i++){ + MgmtSrvrId * m = &_localConfig.ids[i]; switch(m->type){ case MgmId_TCP: - p = getConfig(m->data.tcp.remoteHost, m->data.tcp.port, verId); - break; - case MgmId_File: - p = getConfig(m->data.file.filename, verId); - break; - default: - setError(CR_ERROR, "Unknown error type"); - break; - } - - if (p != 0) { - if(!verifyConfig(p, nodeType)){ - free(p); + tmp.assfmt("%s:%d", m->name.c_str(), m->port); + if (ndb_mgm_connect(m_handle, tmp.c_str()) == 0) { return 0; } - return p; + setError(CR_RETRY, ndb_mgm_get_latest_error_desc(m_handle)); + case MgmId_File: + break; } - if(latestErrorType == CR_RETRY) - type = CR_RETRY; - } // for - - if(type == CR_RETRY){ + } + + if(latestErrorType == CR_RETRY){ REPORT_WARNING("Failed to retrieve cluster configuration"); ndbout << "(Cause of failure: " << getErrorString() << ")" << endl; ndbout << "Attempt " << retry << " of " << retry_max << ". " @@ -146,60 +119,63 @@ ConfigRetriever::getConfig(int verId, int nodeType) { break; } retry++; - - } while (retry <= retry_max); + } - return 0; + ndb_mgm_destroy_handle(&m_handle); + m_handle= 0; + return -1; } -ndb_mgm_configuration * -ConfigRetriever::getConfig(const char * mgmhost, - short port, - int versionId){ - - NdbMgmHandle h; - h = ndb_mgm_create_handle(); - if (h == NULL) { - setError(CR_ERROR, "Unable to allocate mgm handle"); - return 0; - } +//**************************************************************************** +//**************************************************************************** +//**************************************************************************** +//**************************************************************************** +struct ndb_mgm_configuration* +ConfigRetriever::getConfig() { + + struct ndb_mgm_configuration * p = 0; - BaseString tmp; - tmp.assfmt("%s:%d", mgmhost, port); - if (ndb_mgm_connect(h, tmp.c_str()) != 0) { - setError(CR_RETRY, ndb_mgm_get_latest_error_desc(h)); - ndb_mgm_destroy_handle(&h); + if(m_handle != 0){ + p = getConfig(m_handle); + } else { + for (int i = 0; i<_localConfig.ids.size(); i++){ + MgmtSrvrId * m = &_localConfig.ids[i]; + switch(m->type){ + case MgmId_File: + p = getConfig(m->name.c_str()); + break; + case MgmId_TCP: + break; + } + if(p) + break; + } + } + if(p == 0) return 0; + + if(!verifyConfig(p)){ + free(p); + p= 0; } + + return p; +} - ndb_mgm_configuration * conf = ndb_mgm_get_configuration(h, versionId); +ndb_mgm_configuration * +ConfigRetriever::getConfig(NdbMgmHandle m_handle){ + + ndb_mgm_configuration * conf = ndb_mgm_get_configuration(m_handle,m_version); if(conf == 0){ - setError(CR_ERROR, ndb_mgm_get_latest_error_desc(h)); - } - - ndb_mgm_disconnect(h); - ndb_mgm_destroy_handle(&h); - - return conf; -#if 0 - bool compatible; - if (global_ndb_check) - compatible = ndbCompatible_ndb_mgmt(versionId, version); - else - compatible = ndbCompatible_api_mgmt(versionId, version); - - if(!compatible){ // if(version != versionId){ - NDB_CLOSE_SOCKET(sockfd); - snprintf(err_buf, sizeof(err_buf), "Management Server: Invalid version. " - "Version from server: %d Own version: %d", version, versionId); - setError(CR_ERROR, err_buf); + setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle)); return 0; } -#endif + + return conf; } ndb_mgm_configuration * -ConfigRetriever::getConfig(const char * filename, int versionId){ +ConfigRetriever::getConfig(const char * filename){ struct stat sbuf; const int res = stat(filename, &sbuf); @@ -242,60 +218,29 @@ ConfigRetriever::getConfig(const char * filename, int versionId){ void ConfigRetriever::setError(ErrorType et, const char * s){ - if(errorString != 0){ - free(errorString); - } - if(s == 0) - errorString = 0; - else - errorString = strdup(s); + errorString.assign(s ? s : ""); latestErrorType = et; } const char * ConfigRetriever::getErrorString(){ - return errorString; + return errorString.c_str(); } void ConfigRetriever::setLocalConfigFileName(const char * localConfigFileName) { - if(_localConfigFileName != 0) - free(_localConfigFileName); - if(localConfigFileName != 0) - _localConfigFileName = strdup(localConfigFileName); - else - _localConfigFileName = 0; + _localConfigFileName.assign(localConfigFileName ? localConfigFileName : ""); } void ConfigRetriever::setConnectString(const char * connectString) { - if(m_connectString != 0) - free(m_connectString); - if (connectString != 0) { - m_connectString = strdup(connectString); - } else { - m_connectString = 0; - } -} - -/** - * @note Do not use! Use the one above if possible. /elathal - */ -void -ConfigRetriever::setDefaultConnectString(const char * defaultConnectString) { - if(m_defaultConnectString != 0) - free(m_defaultConnectString); - if (defaultConnectString != 0) { - m_defaultConnectString = strdup(defaultConnectString); - } else { - m_defaultConnectString = 0; - } + m_connectString.assign(connectString ? connectString : ""); } bool -ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, - int type){ +ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){ + char buf[255]; ndb_mgm_configuration_iterator * it; it = ndb_mgm_create_configuration_iterator((struct ndb_mgm_configuration *)conf, CFG_SECTION_NODE); @@ -308,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, getOwnNodeId()) != 0){ - snprintf(buf, 255, "Unable to find node with id: %d", getOwnNodeId()); + if(ndb_mgm_find(it, CFG_NODE_ID, _ownNodeId) != 0){ + snprintf(buf, 255, "Unable to find node with id: %d", _ownNodeId); setError(CR_ERROR, buf); return false; } @@ -323,12 +268,15 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, char localhost[MAXHOSTNAMELEN]; if(NdbHost_GetHostName(localhost) != 0){ - snprintf(buf, 255, "Unable to own hostname"); + snprintf(buf, 255, "Unable to get own hostname"); setError(CR_ERROR, buf); return false; } do { + if(strlen(hostname) == 0) + break; + if(strcasecmp(hostname, localhost) == 0) break; @@ -363,11 +311,67 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, return false; } - if(_type != type){ + if(_type != m_node_type){ snprintf(buf, 255, "Supplied node type(%d) and config node type(%d) " - " don't match", type, _type); + " don't match", m_node_type, _type); setError(CR_ERROR, buf); return false; } + + /** + * Check hostnames + */ + ndb_mgm_configuration_iterator iter(* conf, CFG_SECTION_CONNECTION); + for(iter.first(); iter.valid(); iter.next()){ + + Uint32 type = CONNECTION_TYPE_TCP + 1; + if(iter.get(CFG_TYPE_OF_SECTION, &type)) continue; + if(type != CONNECTION_TYPE_TCP) continue; + + Uint32 nodeId1, nodeId2, remoteNodeId; + 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); + + const char * name; + struct in_addr addr; + BaseString tmp; + if(!iter.get(CFG_TCP_HOSTNAME_1, &name) && strlen(name)){ + if(Ndb_getInAddr(&addr, name) != 0){ + tmp.assfmt("Unable to lookup/illegal hostname %s, " + "connection from node %d to node %d", + name, _ownNodeId, remoteNodeId); + setError(CR_ERROR, tmp.c_str()); + return false; + } + } + + if(!iter.get(CFG_TCP_HOSTNAME_2, &name) && strlen(name)){ + if(Ndb_getInAddr(&addr, name) != 0){ + tmp.assfmt("Unable to lookup/illegal hostname %s, " + "connection from node %d to node %d", + name, _ownNodeId, remoteNodeId); + setError(CR_ERROR, tmp.c_str()); + return false; + } + } + } return true; } + +Uint32 +ConfigRetriever::allocNodeId(){ + unsigned nodeid= _ownNodeId; + + if(m_handle != 0){ + int res= ndb_mgm_alloc_nodeid(m_handle, m_version, &nodeid, m_node_type); + if(res != 0) { + setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle)); + return 0; + } + } + + return _ownNodeId= nodeid; +} diff --git a/ndb/src/common/mgmcommon/IPCConfig.cpp b/ndb/src/common/mgmcommon/IPCConfig.cpp index ba5fe7ace80..a76c541f3f6 100644 --- a/ndb/src/common/mgmcommon/IPCConfig.cpp +++ b/ndb/src/common/mgmcommon/IPCConfig.cpp @@ -339,12 +339,13 @@ IPCConfig::getNodeType(NodeId id) const { return out; } +#include <mgmapi.h> Uint32 IPCConfig::configureTransporters(Uint32 nodeId, const class ndb_mgm_configuration & config, class TransporterRegistry & tr){ - Uint32 noOfTransportersCreated = 0; + Uint32 noOfTransportersCreated= 0, server_port= 0; ndb_mgm_configuration_iterator iter(config, CFG_SECTION_CONNECTION); for(iter.first(); iter.valid(); iter.next()){ @@ -364,6 +365,16 @@ IPCConfig::configureTransporters(Uint32 nodeId, Uint32 type = ~0; if(iter.get(CFG_TYPE_OF_SECTION, &type)) continue; + Uint32 tmp_server_port= 0; + if(iter.get(CFG_CONNECTION_SERVER_PORT, &tmp_server_port)) break; + if (nodeId <= nodeId1 && nodeId <= nodeId2) { + if (server_port && server_port != tmp_server_port) { + ndbout << "internal error in config setup of server ports line= " << __LINE__ << endl; + exit(-1); + } + server_port= tmp_server_port; + } + switch(type){ case CONNECTION_TYPE_SHM:{ SHM_TransporterConfiguration conf; @@ -377,6 +388,8 @@ IPCConfig::configureTransporters(Uint32 nodeId, if(iter.get(CFG_SHM_KEY, &conf.shmKey)) break; if(iter.get(CFG_SHM_BUFFER_MEM, &conf.shmSize)) break; + conf.port= tmp_server_port; + if(!tr.createTransporter(&conf)){ ndbout << "Failed to create SHM Transporter from: " << conf.localNodeId << " to: " << conf.remoteNodeId << endl; @@ -428,10 +441,10 @@ IPCConfig::configureTransporters(Uint32 nodeId, if(iter.get(CFG_TCP_HOSTNAME_1, &host1)) break; if(iter.get(CFG_TCP_HOSTNAME_2, &host2)) break; - if(iter.get(CFG_TCP_SERVER_PORT, &conf.port)) break; if(iter.get(CFG_TCP_SEND_BUFFER_SIZE, &conf.sendBufferSize)) break; if(iter.get(CFG_TCP_RECEIVE_BUFFER_SIZE, &conf.maxReceiveSize)) break; + conf.port= tmp_server_port; const char * proxy; if (!iter.get(CFG_TCP_PROXY, &proxy)) { if (strlen(proxy) > 0 && nodeId2 == nodeId) { @@ -490,6 +503,8 @@ IPCConfig::configureTransporters(Uint32 nodeId, } } + tr.m_service_port= server_port; + return noOfTransportersCreated; } diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp index d52bc54db52..7c842508491 100644 --- a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp +++ b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp @@ -43,10 +43,10 @@ InitConfigFileParser::~InitConfigFileParser() { // Read Config File //**************************************************************************** InitConfigFileParser::Context::Context(const ConfigInfo * info) - : m_configValues(1000, 20) { + : m_configValues(1000, 20), m_userProperties(true) { - m_config = new Properties(); - m_defaults = new Properties(); + m_config = new Properties(true); + m_defaults = new Properties(true); } InitConfigFileParser::Context::~Context(){ @@ -115,7 +115,7 @@ InitConfigFileParser::parseConfig(FILE * file) { snprintf(ctx.fname, sizeof(ctx.fname), section); free(section); ctx.type = InitConfigFileParser::DefaultSection; ctx.m_sectionLineno = ctx.m_lineno; - ctx.m_currentSection = new Properties(); + ctx.m_currentSection = new Properties(true); ctx.m_userDefaults = NULL; ctx.m_currentInfo = m_info->getInfo(ctx.fname); ctx.m_systemDefaults = m_info->getDefaults(ctx.fname); @@ -137,7 +137,7 @@ InitConfigFileParser::parseConfig(FILE * file) { free(section); ctx.type = InitConfigFileParser::Section; ctx.m_sectionLineno = ctx.m_lineno; - ctx.m_currentSection = new Properties(); + ctx.m_currentSection = new Properties(true); ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults); ctx.m_currentInfo = m_info->getInfo(ctx.fname); ctx.m_systemDefaults = m_info->getDefaults(ctx.fname); @@ -222,6 +222,8 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { char tmpLine[MAX_LINE_LENGTH]; char fname[MAX_LINE_LENGTH], rest[MAX_LINE_LENGTH]; char* t; + const char *separator_list[]= {":", "=", 0}; + const char *separator= 0; if (ctx.m_currentSection == NULL){ ctx.reportError("Value specified outside section"); @@ -233,7 +235,14 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { // ************************************* // Check if a separator exists in line // ************************************* - if (!strchr(tmpLine, ':')) { + for(int i= 0; separator_list[i] != 0; i++) { + if(strchr(tmpLine, separator_list[i][0])) { + separator= separator_list[i]; + break; + } + } + + if (separator == 0) { ctx.reportError("Parse error"); return false; } @@ -241,13 +250,13 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { // ******************************************* // Get pointer to substring before separator // ******************************************* - t = strtok(tmpLine, ":"); + t = strtok(tmpLine, separator); // ***************************************** // Count number of tokens before separator // ***************************************** if (sscanf(t, "%120s%120s", fname, rest) != 1) { - ctx.reportError("Multiple names before \':\'"); + ctx.reportError("Multiple names before \'%c\'", separator[0]); return false; } if (!ctx.m_currentInfo->contains(fname)) { @@ -475,8 +484,24 @@ 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); + if (tmp_alias) { + free(tmp); + tmp= strdup(tmp_alias); + } + } + // Lookup token among sections - if(!m_info->isSection(tmp)) return NULL; + if(!m_info->isSection(tmp)) { + free(tmp); + return NULL; + } if(m_info->getInfo(tmp)) return tmp; free(tmp); @@ -497,7 +522,7 @@ InitConfigFileParser::parseDefaultSectionHeader(const char* line) const { if (no != 2) return NULL; // Not correct keyword at end - if (!strcmp(token2, "DEFAULT") == 0) return NULL; + if (!strcasecmp(token2, "DEFAULT") == 0) return NULL; if(m_info->getInfo(token1)){ return strdup(token1); diff --git a/ndb/src/common/mgmcommon/LocalConfig.cpp b/ndb/src/common/mgmcommon/LocalConfig.cpp index 12e685ced34..0440ce84dba 100644 --- a/ndb/src/common/mgmcommon/LocalConfig.cpp +++ b/ndb/src/common/mgmcommon/LocalConfig.cpp @@ -17,17 +17,16 @@ #include "LocalConfig.hpp" #include <NdbEnv.h> #include <NdbConfig.h> +#include <NdbAutoPtr.hpp> LocalConfig::LocalConfig(){ - ids = 0; size = 0; items = 0; error_line = 0; error_msg[0] = 0; + _ownNodeId= 0; } bool -LocalConfig::init(bool onlyNodeId, - const char *connectString, - const char *fileName, - const char *defaultConnectString) { +LocalConfig::init(const char *connectString, + const char *fileName) { /** * Escalation: * 1. Check connectString @@ -39,8 +38,8 @@ LocalConfig::init(bool onlyNodeId, */ //1. Check connectString - if(connectString != 0) { - if(readConnectString(connectString, onlyNodeId)){ + if(connectString != 0 && connectString[0] != 0){ + if(readConnectString(connectString)){ return true; } return false; @@ -49,7 +48,7 @@ LocalConfig::init(bool onlyNodeId, //2. Check given filename if (fileName && strlen(fileName) > 0) { bool fopenError; - if(readFile(fileName, fopenError, onlyNodeId)){ + if(readFile(fileName, fopenError)){ return true; } return false; @@ -59,7 +58,7 @@ LocalConfig::init(bool onlyNodeId, char buf[255]; if(NdbEnv_GetEnv("NDB_CONNECTSTRING", buf, sizeof(buf)) && strlen(buf) != 0){ - if(readConnectString(buf, onlyNodeId)){ + if(readConnectString(buf)){ return true; } return false; @@ -68,10 +67,10 @@ LocalConfig::init(bool onlyNodeId, //4. Check Ndb.cfg in NDB_HOME { bool fopenError; - char buf[256]; - if(readFile(NdbConfig_NdbCfgName(buf, sizeof(buf), 1 /*true*/), fopenError, onlyNodeId)){ + char *buf= NdbConfig_NdbCfgName(1 /*true*/); + NdbAutoPtr<char> tmp_aptr(buf); + if(readFile(buf, fopenError)) return true; - } if (!fopenError) return false; } @@ -79,20 +78,20 @@ LocalConfig::init(bool onlyNodeId, //5. Check Ndb.cfg in cwd { bool fopenError; - char buf[256]; - if(readFile(NdbConfig_NdbCfgName(buf, sizeof(buf), 0 /*false*/), fopenError, onlyNodeId)){ + char *buf= NdbConfig_NdbCfgName(0 /*false*/); + NdbAutoPtr<char> tmp_aptr(buf); + if(readFile(buf, fopenError)) return true; - } if (!fopenError) return false; } - //6. Check defaultConnectString - if(defaultConnectString != 0) { - if(readConnectString(defaultConnectString, onlyNodeId)){ + //7. Check + { + char buf[256]; + snprintf(buf, sizeof(buf), "host=localhost:%u", NDB_BASE_PORT); + if(readConnectString(buf)) return true; - } - return false; } setError(0, ""); @@ -101,30 +100,8 @@ LocalConfig::init(bool onlyNodeId, } LocalConfig::~LocalConfig(){ - for(int i = 0; i<items; i++){ - if(ids[i]->type == MgmId_TCP) - free(ids[i]->data.tcp.remoteHost); - else if(ids[i]->type == MgmId_File) - free(ids[i]->data.file.filename); - delete ids[i]; - } - if(ids != 0) - delete[] ids; } -void LocalConfig::add(MgmtSrvrId * i){ - if(items == size){ - MgmtSrvrId ** tmp = new MgmtSrvrId * [size+10]; - if(ids != 0){ - memcpy(tmp, ids, items*sizeof(MgmtSrvrId *)); - delete []ids; - } - ids = tmp; - } - ids[items] = i; - items++; -} - void LocalConfig::setError(int lineNumber, const char * _msg) { error_line = lineNumber; strncpy(error_msg, _msg, sizeof(error_msg)); @@ -144,22 +121,22 @@ void LocalConfig::printUsage() const { ndbout << "1. Put a Ndb.cfg file in the directory where you start"<<endl << " the node. "<< endl << " Ex: Ndb.cfg" << endl - << " | nodeid=11;host=localhost:2200"<<endl<<endl; + << " | host=localhost:"<<NDB_BASE_PORT<<endl; ndbout << "2. Use the environment variable NDB_CONNECTSTRING to "<<endl << " provide this information." <<endl << " Ex: " << endl - << " >export NDB_CONNECTSTRING=\"nodeid=11;host=localhost:2200\"" + << " >export NDB_CONNECTSTRING=\"host=localhost:"<<NDB_BASE_PORT<<"\"" <<endl<<endl; } -char *nodeIdTokens[] = { +const char *nodeIdTokens[] = { "OwnProcessId %i", "nodeid=%i", 0 }; -char *hostNameTokens[] = { +const char *hostNameTokens[] = { "host://%[^:]:%i", "host=%[^:]:%i", "%[^:]:%i", @@ -167,7 +144,7 @@ char *hostNameTokens[] = { 0 }; -char *fileNameTokens[] = { +const char *fileNameTokens[] = { "file://%s", "file=%s", 0 @@ -183,15 +160,15 @@ LocalConfig::parseNodeId(const char * buf){ bool LocalConfig::parseHostName(const char * buf){ - char tempString[100]; + char tempString[1024]; int port; for(int i = 0; hostNameTokens[i] != 0; i++) { if (sscanf(buf, hostNameTokens[i], tempString, &port) == 2) { - MgmtSrvrId* mgmtSrvrId = new MgmtSrvrId(); - mgmtSrvrId->type = MgmId_TCP; - mgmtSrvrId->data.tcp.remoteHost = strdup(tempString); - mgmtSrvrId->data.tcp.port = port; - add(mgmtSrvrId); + MgmtSrvrId mgmtSrvrId; + mgmtSrvrId.type = MgmId_TCP; + mgmtSrvrId.name.assign(tempString); + mgmtSrvrId.port = port; + ids.push_back(mgmtSrvrId); return true; } } @@ -200,13 +177,13 @@ LocalConfig::parseHostName(const char * buf){ bool LocalConfig::parseFileName(const char * buf){ - char tempString[100]; + char tempString[1024]; for(int i = 0; fileNameTokens[i] != 0; i++) { if (sscanf(buf, fileNameTokens[i], tempString) == 1) { - MgmtSrvrId* mgmtSrvrId = new MgmtSrvrId(); - mgmtSrvrId->type = MgmId_File; - mgmtSrvrId->data.file.filename = strdup(tempString); - add(mgmtSrvrId); + MgmtSrvrId mgmtSrvrId; + mgmtSrvrId.type = MgmId_File; + mgmtSrvrId.name.assign(tempString); + ids.push_back(mgmtSrvrId); return true; } } @@ -214,17 +191,15 @@ LocalConfig::parseFileName(const char * buf){ } bool -LocalConfig::parseString(const char * connectString, bool onlyNodeId, char *line){ - bool return_value = true; - +LocalConfig::parseString(const char * connectString, char *line){ char * for_strtok; char * copy = strdup(connectString); + NdbAutoPtr<char> tmp_aptr(copy); bool b_nodeId = false; bool found_other = false; - for (char *tok = strtok_r(copy,";",&for_strtok); - tok != 0 && !(onlyNodeId && b_nodeId); + for (char *tok = strtok_r(copy,";",&for_strtok); tok != 0; tok = strtok_r(NULL, ";", &for_strtok)) { if (tok[0] == '#') continue; @@ -232,28 +207,27 @@ LocalConfig::parseString(const char * connectString, bool onlyNodeId, char *line if (!b_nodeId) // only one nodeid definition allowed if (b_nodeId = parseNodeId(tok)) continue; - if (onlyNodeId) - continue; if (found_other = parseHostName(tok)) continue; if (found_other = parseFileName(tok)) continue; - snprintf(line, 150, "Unexpected entry: \"%s\"", tok); - return_value = false; - break; + if (line) + snprintf(line, 150, "Unexpected entry: \"%s\"", tok); + return false; } - if (return_value && !onlyNodeId && !found_other) { - return_value = false; - snprintf(line, 150, "Missing host/file name extry in \"%s\"", connectString); + if (!found_other) { + if (line) + snprintf(line, 150, "Missing host/file name extry in \"%s\"", + connectString); + return false; } - free(copy); - return return_value; + return true; } -bool LocalConfig::readFile(const char * filename, bool &fopenError, bool onlyNodeId) +bool LocalConfig::readFile(const char * filename, bool &fopenError) { char line[150], line2[150]; @@ -284,7 +258,7 @@ bool LocalConfig::readFile(const char * filename, bool &fopenError, bool onlyNod strcat(theString, line); } - bool return_value = parseString(theString, onlyNodeId, line); + bool return_value = parseString(theString, line); if (!return_value) { snprintf(line2, 150, "Reading %s: %s", filename, line); @@ -297,12 +271,14 @@ bool LocalConfig::readFile(const char * filename, bool &fopenError, bool onlyNod } bool -LocalConfig::readConnectString(const char * connectString, bool onlyNodeId){ +LocalConfig::readConnectString(const char * connectString){ char line[150], line2[150]; - bool return_value = parseString(connectString, onlyNodeId, line); + bool return_value = parseString(connectString, line); if (!return_value) { snprintf(line2, 150, "Reading NDB_CONNECTSTRING \"%s\": %s", connectString, line); setError(0,line2); } return return_value; } + +template class Vector<MgmtSrvrId>; diff --git a/ndb/src/common/mgmcommon/LocalConfig.hpp b/ndb/src/common/mgmcommon/LocalConfig.hpp deleted file mode 100644 index eb676bf9bed..00000000000 --- a/ndb/src/common/mgmcommon/LocalConfig.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/* 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 LocalConfig_H -#define LocalConfig_H - -#include <ndb_global.h> -#include <NdbOut.hpp> - -//**************************************************************************** -// Description: The class LocalConfig corresponds to the information possible -// to give in the local configuration file. -//***************************************************************************** - -enum MgmtSrvrId_Type { - MgmId_TCP = 0, - MgmId_File = 1 -}; - -struct MgmtSrvrId { - MgmtSrvrId_Type type; - union { - struct { - char * remoteHost; - unsigned int port; - } tcp; - struct { - char * filename; - } file; - } data; -}; - -struct LocalConfig { - - int _ownNodeId; - - int size; - int items; - MgmtSrvrId ** ids; - - int error_line; - char error_msg[256]; - - LocalConfig(); - ~LocalConfig(); - bool init(bool onlyNodeId = false, - const char *connectString = 0, - const char *fileName = 0, - const char *defaultConnectString = 0); - - void add(MgmtSrvrId *i); - - void printError() const; - void printUsage() const; - - void setError(int lineNumber, const char * _msg); - bool readConnectString(const char * connectString, bool onlyNodeId = false); - bool readFile(const char * filename, bool &fopenError, bool onlyNodeId = false); - bool parseLine(char * line, int lineNumber); - - bool parseNodeId(const char *buf); - bool parseHostName(const char *buf); - bool parseFileName(const char *buf); - bool parseString(const char *buf, bool onlyNodeId, char *line); -}; - -#endif // LocalConfig_H - diff --git a/ndb/src/common/mgmcommon/NdbConfig.c b/ndb/src/common/mgmcommon/NdbConfig.c index 827ef34a840..6b609b22fa4 100644 --- a/ndb/src/common/mgmcommon/NdbConfig.c +++ b/ndb/src/common/mgmcommon/NdbConfig.c @@ -18,43 +18,93 @@ #include <NdbConfig.h> #include <NdbEnv.h> -const char* -NdbConfig_HomePath(char* buf, int buflen){ - const char* p; - p = NdbEnv_GetEnv("NDB_HOME", buf, buflen); - if (p == NULL){ - strlcpy(buf, "", buflen); - p = buf; - } else { - const int len = strlen(buf); - if(len != 0 && buf[len-1] != '/'){ - buf[len] = '/'; - buf[len+1] = 0; - } - } - return p; -} - -const char* -NdbConfig_NdbCfgName(char* buf, int buflen, int with_ndb_home){ - if (with_ndb_home) - NdbConfig_HomePath(buf, buflen); +static char* +NdbConfig_AllocHomePath(int _len) +{ + const char *path= NdbEnv_GetEnv("NDB_HOME", 0, 0); + int len= _len; + int path_len= 0; + char *buf; + + if (path) + path_len= strlen(path); + + len+= path_len; + buf= malloc(len); + if (path_len > 0) + snprintf(buf, len, "%s%s", path, DIR_SEPARATOR); else - buf[0] = 0; - strlcat(buf, "Ndb.cfg", buflen); + buf[0]= 0; + + return buf; +} + +char* +NdbConfig_NdbCfgName(int with_ndb_home){ + char *buf; + int len= 0; + + if (with_ndb_home) { + buf= NdbConfig_AllocHomePath(128); + len= strlen(buf); + } else + buf= malloc(128); + snprintf(buf+len, 128, "Ndb.cfg"); + return buf; +} + +char* +NdbConfig_ErrorFileName(int node_id){ + char *buf= NdbConfig_AllocHomePath(128); + int len= strlen(buf); + snprintf(buf+len, 128, "ndb_%u_error.log", node_id); + return buf; +} + +char* +NdbConfig_ClusterLogFileName(int node_id){ + char *buf= NdbConfig_AllocHomePath(128); + int len= strlen(buf); + snprintf(buf+len, 128, "ndb_%u_cluster.log", node_id); + return buf; +} + +char* +NdbConfig_SignalLogFileName(int node_id){ + char *buf= NdbConfig_AllocHomePath(128); + int len= strlen(buf); + snprintf(buf+len, 128, "ndb_%u_signal.log", node_id); + return buf; +} + +char* +NdbConfig_TraceFileName(int node_id, int file_no){ + char *buf= NdbConfig_AllocHomePath(128); + int len= strlen(buf); + snprintf(buf+len, 128, "ndb_%u_trace.log.%u", node_id, file_no); + return buf; +} + +char* +NdbConfig_NextTraceFileName(int node_id){ + char *buf= NdbConfig_AllocHomePath(128); + int len= strlen(buf); + snprintf(buf+len, 128, "ndb_%u_trace.log.next", node_id); return buf; } -const char* -NdbConfig_ErrorFileName(char* buf, int buflen){ - NdbConfig_HomePath(buf, buflen); - strlcat(buf, "error.log", buflen); +char* +NdbConfig_PidFileName(int node_id){ + char *buf= NdbConfig_AllocHomePath(128); + int len= strlen(buf); + snprintf(buf+len, 128, "ndb_%u.pid", node_id); return buf; } -const char* -NdbConfig_ClusterLogFileName(char* buf, int buflen){ - NdbConfig_HomePath(buf, buflen); - strlcat(buf, "cluster.log", buflen); +char* +NdbConfig_StdoutFileName(int node_id){ + char *buf= NdbConfig_AllocHomePath(128); + int len= strlen(buf); + snprintf(buf+len, 128, "ndb_%u_out.log", node_id); return buf; } |