18 #include <ndb_global.h>
22 #include "ConfigInfo.hpp"
23 #include <mgmapi_config_parameters.h>
24 #include <ndb_limits.h>
25 #include "InitConfigFileParser.hpp"
27 #include <Bitmask.hpp>
29 #include <ndb_version.h>
32 #include "ConfigInfo.hpp"
33 #include <mgmapi_config_parameters.h>
34 #include <ndb_version.h>
37 #define KEY_INTERNAL 0
38 #define MAX_INT_RNIL 0xfffffeff
39 #define MAX_INT32 0xffffffff
40 #define MAX_PORT_NO 65535
42 #define _STR_VALUE(x) #x
43 #define STR_VALUE(x) _STR_VALUE(x)
49 #define DB_TOKEN_PRINT "ndbd(DB)"
50 #define MGM_TOKEN_PRINT "ndb_mgmd(MGM)"
51 #define API_TOKEN_PRINT "mysqld(API)"
54 #define MGM_TOKEN "MGM"
55 #define API_TOKEN "API"
59 ConfigInfo::m_sectionNameAliases[]={
60 {API_TOKEN,
"MYSQLD"},
62 {MGM_TOKEN,
"NDB_MGMD"},
67 ConfigInfo::m_sectionNames[]={
79 const int ConfigInfo::m_noOfSectionNames =
80 sizeof(m_sectionNames)/
sizeof(
char*);
110 ConfigInfo::m_SectionRules[] = {
111 {
"SYSTEM", transformSystem, 0 },
112 {
"COMPUTER", transformComputer, 0 },
114 { DB_TOKEN, transformNode, 0 },
115 { API_TOKEN, transformNode, 0 },
116 { MGM_TOKEN, transformNode, 0 },
118 { MGM_TOKEN, fixShmUniqueId, 0 },
120 {
"TCP", checkConnectionSupport, 0 },
121 {
"SHM", checkConnectionSupport, 0 },
122 {
"SCI", checkConnectionSupport, 0 },
124 {
"TCP", transformConnection, 0 },
125 {
"SHM", transformConnection, 0 },
126 {
"SCI", transformConnection, 0 },
128 { DB_TOKEN, fixNodeHostname, 0 },
129 { API_TOKEN, fixNodeHostname, 0 },
130 { MGM_TOKEN, fixNodeHostname, 0 },
132 {
"TCP", fixNodeId,
"NodeId1" },
133 {
"TCP", fixNodeId,
"NodeId2" },
134 {
"SHM", fixNodeId,
"NodeId1" },
135 {
"SHM", fixNodeId,
"NodeId2" },
136 {
"SCI", fixNodeId,
"NodeId1" },
137 {
"SCI", fixNodeId,
"NodeId2" },
139 {
"TCP", uniqueConnection,
"TCP" },
140 {
"SHM", uniqueConnection,
"SHM" },
141 {
"SCI", uniqueConnection,
"SCI" },
143 {
"TCP", fixHostname,
"HostName1" },
144 {
"TCP", fixHostname,
"HostName2" },
145 {
"SHM", fixHostname,
"HostName1" },
146 {
"SHM", fixHostname,
"HostName2" },
147 {
"SCI", fixHostname,
"HostName1" },
148 {
"SCI", fixHostname,
"HostName2" },
149 {
"SHM", fixHostname,
"HostName1" },
150 {
"SHM", fixHostname,
"HostName2" },
152 {
"TCP", fixPortNumber, 0 },
153 {
"SHM", fixPortNumber, 0 },
154 {
"SCI", fixPortNumber, 0 },
156 {
"*", applyDefaultValues,
"user" },
157 {
"*", fixDeprecated, 0 },
158 {
"*", applyDefaultValues,
"system" },
160 {
"SHM", fixShmKey, 0 },
162 { DB_TOKEN, checkLocalhostHostnameMix, 0 },
163 { API_TOKEN, checkLocalhostHostnameMix, 0 },
164 { MGM_TOKEN, checkLocalhostHostnameMix, 0 },
166 { DB_TOKEN, fixFileSystemPath, 0 },
167 { DB_TOKEN, fixBackupDataDir, 0 },
169 { DB_TOKEN, checkDbConstraints, 0 },
170 { DB_TOKEN, checkThreadConfig, 0 },
172 { API_TOKEN, checkThreadPrioSpec, 0 },
173 { MGM_TOKEN, checkThreadPrioSpec, 0 },
175 {
"TCP", checkConnectionConstraints, 0 },
176 {
"SHM", checkConnectionConstraints, 0 },
177 {
"SCI", checkConnectionConstraints, 0 },
179 {
"TCP", checkTCPConstraints,
"HostName1" },
180 {
"TCP", checkTCPConstraints,
"HostName2" },
181 {
"SCI", checkTCPConstraints,
"HostName1" },
182 {
"SCI", checkTCPConstraints,
"HostName2" },
183 {
"SHM", checkTCPConstraints,
"HostName1" },
184 {
"SHM", checkTCPConstraints,
"HostName2" },
186 {
"*", checkMandatory, 0 }
188 const int ConfigInfo::m_NoOfRules =
sizeof(m_SectionRules)/
sizeof(SectionRule);
195 const char * rule_data);
198 const char * rule_data);
201 const char * rule_data);
204 const char * rule_data);
207 const char * rule_data);
210 const char * rule_data);
215 const char * rule_data);
218 ConfigInfo::m_ConfigRules[] = {
219 { add_system_section, 0 },
220 { sanity_checks, 0 },
221 { add_node_connections, 0 },
222 { set_connection_priorities, 0 },
223 { check_node_vs_replicas, 0 },
224 { check_mutually_exclusive, 0 },
225 { saveSectionsInConfigValues,
"SYSTEM,Node,Connection" },
230 const char * m_section;
231 const char * m_oldName;
232 const char * m_newName;
239 { DB_TOKEN,
"Discless",
"Diskless", 0, 1 },
240 { DB_TOKEN,
"Id",
"NodeId", 0, 1 },
241 { API_TOKEN,
"Id",
"NodeId", 0, 1 },
242 { MGM_TOKEN,
"Id",
"NodeId", 0, 1 },
249 {
"Disabled", ARBIT_METHOD_DISABLED },
250 {
"Default", ARBIT_METHOD_DEFAULT },
251 {
"WaitExternal", ARBIT_METHOD_WAITEXTERNAL },
257 {
"abort", OPERATION_REDO_PROBLEM_ACTION_ABORT },
258 {
"queue", OPERATION_REDO_PROBLEM_ACTION_QUEUE },
298 ConfigInfo::CI_SECTION,
309 ConfigInfo::CI_STRING,
317 "Hostname of computer (e.g. mysql.com)",
320 ConfigInfo::CI_STRING,
331 ConfigInfo::CI_STRING,
346 ConfigInfo::CI_SECTION,
347 (
const char *)CFG_SECTION_SYSTEM,
354 "Name of system (NDB Cluster)",
357 ConfigInfo::CI_STRING,
362 CFG_SYS_PRIMARY_MGM_NODE,
365 "Node id of Primary "MGM_TOKEN_PRINT
" node",
371 STR_VALUE(MAX_INT_RNIL) },
378 CFG_SYS_CONFIG_GENERATION,
379 "ConfigGenerationNumber",
381 "Configuration generation number",
387 STR_VALUE(MAX_INT_RNIL) },
399 ConfigInfo::CI_SECTION,
400 (
const char *)NODE_TYPE_DB,
405 CFG_DB_SUBSCRIPTIONS,
406 "MaxNoOfSubscriptions",
408 "Max no of subscriptions (default 0 == MaxNoOfTables)",
414 STR_VALUE(MAX_INT_RNIL) },
418 "MaxNoOfSubscribers",
420 "Max no of subscribers (default 0 == 2 * MaxNoOfTables)",
426 STR_VALUE(MAX_INT_RNIL) },
429 CFG_DB_SUB_OPERATIONS,
430 "MaxNoOfConcurrentSubOperations",
432 "Max no of concurrent subscriber operations",
438 STR_VALUE(MAX_INT_RNIL) },
442 "TcpBind_INADDR_ANY",
444 "Bind IP_ADDR_ANY so that connections can be made from anywhere (for autogenerated connections)",
456 "Name of computer for this node",
459 ConfigInfo::CI_STRING,
467 "Name of system for this node",
470 ConfigInfo::CI_STRING,
484 STR_VALUE(MAX_DATA_NODE_ID) },
490 "Number identifying the database node ("DB_TOKEN_PRINT
")",
496 STR_VALUE(MAX_DATA_NODE_ID) },
502 "Port used to setup transporter for incoming connections from API nodes",
508 STR_VALUE(MAX_PORT_NO) },
514 "Number of copies of all data in the database (1-4)",
516 CI_RESTART_SYSTEM | CI_RESTART_INITIAL,
523 CFG_DB_NO_ATTRIBUTES,
526 "Total number of attributes stored in database. I.e. sum over all tables",
532 STR_VALUE(MAX_INT_RNIL) },
538 "Total number of tables stored in the database",
544 STR_VALUE(NDB_MAX_TABLES) },
547 CFG_DB_NO_ORDERED_INDEXES,
548 "MaxNoOfOrderedIndexes",
550 "Total number of ordered indexes that can be defined in the system",
556 STR_VALUE(MAX_INT_RNIL) },
559 CFG_DB_NO_UNIQUE_HASH_INDEXES,
560 "MaxNoOfUniqueHashIndexes",
562 "Total number of unique hash indexes that can be defined in the system",
568 STR_VALUE(MAX_INT_RNIL) },
575 "MaxNoOfOrderedIndexes or MaxNoOfUniqueHashIndexes",
581 STR_VALUE(MAX_INT_RNIL) },
585 "MaxNoOfConcurrentIndexOperations",
587 "Total number of index operations that can execute simultaneously on one "DB_TOKEN_PRINT
" node",
593 STR_VALUE(MAX_INT_RNIL)
600 "Total number of triggers that can be defined in the system",
606 STR_VALUE(MAX_INT_RNIL) },
609 CFG_DB_NO_TRIGGER_OPS,
610 "MaxNoOfFiredTriggers",
612 "Total number of triggers that can fire simultaneously in one "DB_TOKEN_PRINT
" node",
618 STR_VALUE(MAX_INT_RNIL) },
624 "String referencing an earlier defined COMPUTER",
627 ConfigInfo::CI_STRING,
633 "MaxNoOfSavedMessages",
635 "Max number of error messages in error log and max number of trace files",
641 STR_VALUE(MAX_INT_RNIL) },
644 CFG_DB_EXECUTE_LOCK_CPU,
645 "LockExecuteThreadToCPU",
647 "CPU list indicating which CPU will run the execution thread(s)",
650 ConfigInfo::CI_BITMASK,
657 CFG_DB_MAINT_LOCK_CPU,
658 "LockMaintThreadsToCPU",
660 "CPU ID indicating which CPU will run the maintenance threads",
669 CFG_DB_REALTIME_SCHEDULER,
672 "If yes, then NDB Cluster threads will be scheduled as real-time threads",
682 "LockPagesInMainMemory",
684 "If set to yes, then NDB Cluster data will not be swapped out to disk",
693 CFG_DB_WATCHDOG_INTERVAL,
694 "TimeBetweenWatchDogCheck",
696 "Time between execution checks inside a database node",
702 STR_VALUE(MAX_INT_RNIL) },
705 CFG_DB_SCHED_EXEC_TIME,
706 "SchedulerExecutionTimer",
708 "Number of microseconds to execute in scheduler before sending",
717 CFG_DB_SCHED_SPIN_TIME,
718 "SchedulerSpinTimer",
720 "Number of microseconds to execute in scheduler before sleeping",
729 CFG_DB_WATCHDOG_INTERVAL_INITIAL,
730 "TimeBetweenWatchDogCheckInitial",
732 "Time between execution checks inside a database node in the early start phases when memory is allocated",
738 STR_VALUE(MAX_INT_RNIL) },
741 CFG_DB_STOP_ON_ERROR,
744 "If set to N, "DB_TOKEN_PRINT
" automatically restarts/recovers in case of node failure",
753 CFG_DB_STOP_ON_ERROR_INSERT,
754 "RestartOnErrorInsert",
756 "See src/kernel/vm/Emulator.hpp NdbRestartType for details",
766 "MaxNoOfConcurrentOperations",
768 "Max number of operation records in transaction coordinator",
774 STR_VALUE(MAX_INT_RNIL) },
777 CFG_DB_MAX_DML_OPERATIONS_PER_TRANSACTION,
778 "MaxDMLOperationsPerTransaction",
780 "Max DML-operations in one transaction (0 == no limit)",
784 STR_VALUE(MAX_INT32),
791 "MaxNoOfLocalOperations",
793 "Max number of operation records defined in the local storage node",
799 STR_VALUE(MAX_INT_RNIL) },
802 CFG_DB_NO_LOCAL_SCANS,
805 "Max number of fragment scans in parallel in the local storage node",
811 STR_VALUE(MAX_INT_RNIL) },
815 "BatchSizePerLocalScan",
817 "Used to calculate the number of lock records for scan with hold lock",
821 STR_VALUE(DEF_BATCH_SIZE),
823 STR_VALUE(MAX_PARALLEL_OP_PER_SCAN) },
826 CFG_DB_NO_TRANSACTIONS,
827 "MaxNoOfConcurrentTransactions",
829 "Max number of transaction executing concurrently on the "DB_TOKEN_PRINT
" node",
835 STR_VALUE(MAX_INT_RNIL) },
839 "MaxNoOfConcurrentScans",
841 "Max number of scans executing concurrently on the "DB_TOKEN_PRINT
" node",
850 CFG_DB_TRANS_BUFFER_MEM,
851 "TransactionBufferMemory",
853 "Dynamic buffer space (in bytes) for key and attribute data allocated for each "DB_TOKEN_PRINT
" node",
859 STR_VALUE(MAX_INT_RNIL) },
865 "Number bytes on each "DB_TOKEN_PRINT
" node allocated for storing indexes",
868 ConfigInfo::CI_INT64,
877 "Number bytes on each "DB_TOKEN_PRINT
" node allocated for storing data",
880 ConfigInfo::CI_INT64,
886 CFG_DB_UNDO_INDEX_BUFFER,
889 "Number bytes on each "DB_TOKEN_PRINT
" node allocated for writing UNDO logs for index part",
895 STR_VALUE(MAX_INT_RNIL)},
898 CFG_DB_UNDO_DATA_BUFFER,
901 "Number bytes on each "DB_TOKEN_PRINT
" node allocated for writing UNDO logs for data part",
907 STR_VALUE(MAX_INT_RNIL)},
913 "Number bytes on each "DB_TOKEN_PRINT
" node allocated for writing REDO logs",
919 STR_VALUE(MAX_INT_RNIL)},
922 CFG_DB_LONG_SIGNAL_BUFFER,
925 "Number bytes on each "DB_TOKEN_PRINT
" node allocated for internal long messages",
931 STR_VALUE(MAX_INT_RNIL)},
934 CFG_DB_DISK_PAGE_BUFFER_MEMORY,
935 "DiskPageBufferMemory",
937 "Number bytes on each "DB_TOKEN_PRINT
" node allocated for disk page buffer cache",
940 ConfigInfo::CI_INT64,
947 "SharedGlobalMemory",
949 "Total number bytes on each "DB_TOKEN_PRINT
" node allocated for any use",
952 ConfigInfo::CI_INT64,
953 #if NDB_VERSION_D < NDB_MAKE_VERSION(7,2,0)
962 CFG_DB_START_PARTIAL_TIMEOUT,
963 "StartPartialTimeout",
965 "Time to wait before trying to start wo/ all nodes. 0=Wait forever",
971 STR_VALUE(MAX_INT_RNIL) },
974 CFG_DB_START_PARTITION_TIMEOUT,
975 "StartPartitionedTimeout",
977 "Time to wait before trying to start partitioned. 0=Wait forever",
983 STR_VALUE(MAX_INT_RNIL) },
986 CFG_DB_START_FAILURE_TIMEOUT,
987 "StartFailureTimeout",
989 "Time to wait before terminating. 0=Wait forever",
995 STR_VALUE(MAX_INT_RNIL) },
998 CFG_DB_START_NO_NODEGROUP_TIMEOUT,
999 "StartNoNodegroupTimeout",
1001 "Time to wait for nodes wo/ nodegroup before trying to start (0=forever)",
1007 STR_VALUE(MAX_INT_RNIL) },
1010 CFG_DB_HEARTBEAT_INTERVAL,
1011 "HeartbeatIntervalDbDb",
1013 "Time between "DB_TOKEN_PRINT
"-"DB_TOKEN_PRINT
" heartbeats. "DB_TOKEN_PRINT
" considered dead after 3 missed HBs",
1017 #if NDB_VERSION_D < NDB_MAKE_VERSION(7,2,0)
1023 STR_VALUE(MAX_INT_RNIL) },
1026 CFG_DB_CONNECT_CHECK_DELAY,
1027 "ConnectCheckIntervalDelay",
1029 "Time between "DB_TOKEN_PRINT
" connectivity check stages. "DB_TOKEN_PRINT
" considered suspect after 1 and dead after 2 intervals.",
1035 STR_VALUE(MAX_INT_RNIL) },
1038 CFG_DB_API_HEARTBEAT_INTERVAL,
1039 "HeartbeatIntervalDbApi",
1041 "Time between "API_TOKEN_PRINT
"-"DB_TOKEN_PRINT
" heartbeats. "API_TOKEN_PRINT
" connection closed after 3 missed HBs",
1047 STR_VALUE(MAX_INT_RNIL) },
1050 CFG_DB_LCP_INTERVAL,
1051 "TimeBetweenLocalCheckpoints",
1053 "Time between taking snapshots of the database (expressed in 2log of bytes)",
1062 CFG_DB_GCP_INTERVAL,
1063 "TimeBetweenGlobalCheckpoints",
1065 "Time between doing group commit of transactions to disk",
1074 CFG_DB_MICRO_GCP_INTERVAL,
1075 "TimeBetweenEpochs",
1077 "Time between epochs (syncronization used e.g for replication)",
1086 CFG_DB_MICRO_GCP_TIMEOUT,
1087 "TimeBetweenEpochsTimeout",
1089 "Timeout for time between epochs. Exceeding will cause node shutdown.",
1093 #if NDB_VERSION_D < NDB_MAKE_VERSION(7,2,0)
1102 CFG_DB_MAX_BUFFERED_EPOCHS,
1103 "MaxBufferedEpochs",
1105 "Allowed numbered of epochs that a subscribing node can lag behind (unprocessed epochs). Exceeding will cause lagging subscribers to be disconnected.",
1114 CFG_DB_NO_REDOLOG_FILES,
1115 "NoOfFragmentLogFiles",
1117 "No of 16 Mbyte Redo log files in each of 4 file sets belonging to "DB_TOKEN_PRINT
" node",
1123 STR_VALUE(MAX_INT_RNIL) },
1126 CFG_DB_REDOLOG_FILE_SIZE,
1127 "FragmentLogFileSize",
1129 "Size of each Redo log file",
1139 "InitFragmentLogFiles",
1141 "Initialize fragment logfiles (sparse/full)",
1144 ConfigInfo::CI_STRING,
1152 "No of unbound threads for file access (currently only for DD)",
1158 STR_VALUE(MAX_INT_RNIL) },
1161 CFG_DB_MAX_OPEN_FILES,
1164 "Max number of files open per "DB_TOKEN_PRINT
" node.(One thread is created per file)",
1170 STR_VALUE(MAX_INT_RNIL) },
1173 CFG_DB_INITIAL_OPEN_FILES,
1174 "InitialNoOfOpenFiles",
1176 "Initial number of files open per "DB_TOKEN_PRINT
" node.(One thread is created per file)",
1182 STR_VALUE(MAX_INT_RNIL) },
1185 CFG_DB_TRANSACTION_CHECK_INTERVAL,
1186 "TimeBetweenInactiveTransactionAbortCheck",
1188 "Time between inactive transaction checks",
1194 STR_VALUE(MAX_INT_RNIL) },
1197 CFG_DB_TRANSACTION_INACTIVE_TIMEOUT,
1198 "TransactionInactiveTimeout",
1200 "Time application can wait before executing another transaction part (ms).\n"
1201 "This is the time the transaction coordinator waits for the application\n"
1202 "to execute or send another part (query, statement) of the transaction.\n"
1203 "If the application takes too long time, the transaction gets aborted.\n"
1204 "Timeout set to 0 means that we don't timeout at all on application wait.",
1208 STR_VALUE(MAX_INT_RNIL),
1210 STR_VALUE(MAX_INT_RNIL) },
1213 CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT,
1214 "TransactionDeadlockDetectionTimeout",
1216 "Time transaction can be executing in a DB node (ms).\n"
1217 "This is the time the transaction coordinator waits for each database node\n"
1218 "of the transaction to execute a request. If the database node takes too\n"
1219 "long time, the transaction gets aborted.",
1225 STR_VALUE(MAX_INT_RNIL) },
1228 CFG_DB_LCP_DISC_PAGES_TUP_SR,
1229 "NoOfDiskPagesToDiskDuringRestartTUP",
1231 "DiskCheckpointSpeedSr",
1237 STR_VALUE(MAX_INT_RNIL) },
1240 CFG_DB_LCP_DISC_PAGES_TUP,
1241 "NoOfDiskPagesToDiskAfterRestartTUP",
1243 "DiskCheckpointSpeed",
1249 STR_VALUE(MAX_INT_RNIL) },
1252 CFG_DB_LCP_DISC_PAGES_ACC_SR,
1253 "NoOfDiskPagesToDiskDuringRestartACC",
1255 "DiskCheckpointSpeedSr",
1261 STR_VALUE(MAX_INT_RNIL) },
1264 CFG_DB_LCP_DISC_PAGES_ACC,
1265 "NoOfDiskPagesToDiskAfterRestartACC",
1267 "DiskCheckpointSpeed",
1273 STR_VALUE(MAX_INT_RNIL) },
1282 CI_RESTART_INITIAL | CI_RESTART_SYSTEM,
1283 ConfigInfo::CI_BOOL,
1294 CI_RESTART_INITIAL | CI_RESTART_SYSTEM,
1295 ConfigInfo::CI_BOOL,
1303 CFG_DB_ARBIT_TIMEOUT,
1304 "ArbitrationTimeout",
1306 "Max time (milliseconds) database partion waits for arbitration signal",
1310 #if NDB_VERSION_D < NDB_MAKE_VERSION(7,2,0)
1316 STR_VALUE(MAX_INT_RNIL) },
1319 CFG_DB_ARBIT_METHOD,
1322 "How to perform arbitration to avoid split-brain issue when node(s) fail",
1325 ConfigInfo::CI_ENUM,
1327 (
const char*)arbit_method_typelib,
1335 "Data directory for this node",
1337 CI_CHECK_WRITABLE | CI_RESTART_INITIAL,
1338 ConfigInfo::CI_STRING,
1343 CFG_DB_FILESYSTEM_PATH,
1346 "Path to directory where the "DB_TOKEN_PRINT
" node stores its data (directory must exist)",
1348 CI_CHECK_WRITABLE | CI_RESTART_INITIAL,
1349 ConfigInfo::CI_STRING,
1354 CFG_LOGLEVEL_STARTUP,
1357 "Node startup info printed on stdout",
1366 CFG_LOGLEVEL_SHUTDOWN,
1369 "Node shutdown info printed on stdout",
1378 CFG_LOGLEVEL_STATISTICS,
1379 "LogLevelStatistic",
1381 "Transaction, operation, transporter info printed on stdout",
1390 CFG_LOGLEVEL_CHECKPOINT,
1391 "LogLevelCheckpoint",
1393 "Local and Global checkpoint info printed on stdout",
1402 CFG_LOGLEVEL_NODERESTART,
1403 "LogLevelNodeRestart",
1405 "Node restart, node failure info printed on stdout",
1414 CFG_LOGLEVEL_CONNECTION,
1415 "LogLevelConnection",
1417 "Node connect/disconnect info printed on stdout",
1426 CFG_LOGLEVEL_CONGESTION,
1427 "LogLevelCongestion",
1429 "Congestion info printed on stdout",
1441 "Transporter, heartbeat errors printed on stdout",
1453 "Heartbeat and log info printed on stdout",
1465 CFG_DB_PARALLEL_BACKUPS,
1468 "Maximum number of parallel backups",
1477 CFG_DB_BACKUP_DATADIR,
1480 "Path to where to store backups",
1482 CI_CHECK_WRITABLE | CI_RESTART_INITIAL,
1483 ConfigInfo::CI_STRING,
1488 CFG_DB_DISK_SYNCH_SIZE,
1491 "Data written to a file before a synch is forced",
1497 STR_VALUE(MAX_INT_RNIL) },
1500 CFG_DB_CHECKPOINT_SPEED,
1501 "DiskCheckpointSpeed",
1503 "Bytes per second allowed to be written by checkpoint",
1509 STR_VALUE(MAX_INT_RNIL) },
1512 CFG_DB_CHECKPOINT_SPEED_SR,
1513 "DiskCheckpointSpeedInRestart",
1515 "Bytes per second allowed to be written by checkpoint during restart",
1521 STR_VALUE(MAX_INT_RNIL) },
1527 "Total memory allocated for backups per node (in bytes)",
1533 STR_VALUE(MAX_INT_RNIL) },
1536 CFG_DB_BACKUP_DATA_BUFFER_MEM,
1537 "BackupDataBufferSize",
1539 "Default size of databuffer for a backup (in bytes)",
1545 STR_VALUE(MAX_INT_RNIL) },
1548 CFG_DB_BACKUP_LOG_BUFFER_MEM,
1549 "BackupLogBufferSize",
1551 "Default size of logbuffer for a backup (in bytes)",
1557 STR_VALUE(MAX_INT_RNIL) },
1560 CFG_DB_BACKUP_WRITE_SIZE,
1563 "Default size of filesystem writes made by backup (in bytes)",
1569 STR_VALUE(MAX_INT_RNIL) },
1572 CFG_DB_BACKUP_MAX_WRITE_SIZE,
1573 "BackupMaxWriteSize",
1575 "Max size of filesystem writes made by backup (in bytes)",
1581 STR_VALUE(MAX_INT_RNIL) },
1584 CFG_DB_STRING_MEMORY,
1587 "Default size of string memory (1-100 -> %of max, >100 -> actual bytes)",
1593 STR_VALUE(MAX_INT_RNIL) },
1596 CFG_DB_MAX_ALLOCATE,
1599 "Maximum size of allocation to use when allocating memory for tables",
1608 CFG_DB_MEMREPORT_FREQUENCY,
1609 "MemReportFrequency",
1611 "Frequency of mem reports in seconds, 0 = only when passing %-limits",
1617 STR_VALUE(MAX_INT_RNIL) },
1620 CFG_DB_BACKUP_REPORT_FREQUENCY,
1621 "BackupReportFrequency",
1623 "Frequency of backup status reports during backup in seconds",
1629 STR_VALUE(MAX_INT_RNIL) },
1632 CFG_DB_STARTUP_REPORT_FREQUENCY,
1633 "StartupStatusReportFrequency",
1635 "Frequency of various status reports during startup in seconds",
1641 STR_VALUE(MAX_INT_RNIL) },
1647 "Use O_DIRECT file write/read when possible",
1650 ConfigInfo::CI_BOOL,
1655 CFG_DB_COMPRESSED_BACKUP,
1658 "Use zlib to compress BACKUPs as they are written",
1661 ConfigInfo::CI_BOOL,
1666 CFG_DB_COMPRESSED_LCP,
1669 "Write compressed LCPs using zlib",
1672 ConfigInfo::CI_BOOL,
1678 CFG_TOTAL_SEND_BUFFER_MEMORY,
1679 "TotalSendBufferMemory",
1681 "Total memory to use for send buffers in all transporters",
1687 STR_VALUE(MAX_INT_RNIL)
1691 CFG_RESERVED_SEND_BUFFER_MEMORY,
1692 "ReservedSendBufferMemory",
1694 "Amount of bytes (out of TotalSendBufferMemory) to reserve for connection\n"
1695 "between data nodes. This memory will not be available for connections to\n"
1696 "management server or API nodes.",
1702 STR_VALUE(MAX_INT_RNIL)
1709 "Nodegroup for node, only used during initial cluster start",
1720 "MaxNoOfExecutionThreads",
1722 "For ndbmtd, specify max no of execution threads",
1732 CFG_NDBMT_LQH_WORKERS,
1733 "__ndbmt_lqh_workers",
1735 "For ndbmtd specify no of lqh workers",
1745 CFG_NDBMT_LQH_THREADS,
1746 "__ndbmt_lqh_threads",
1748 "For ndbmtd specify no of lqh threads",
1761 "For ndbmtd use mt-classic",
1764 ConfigInfo::CI_BOOL,
1771 CFG_DB_MT_THREAD_CONFIG,
1774 "Thread configuration",
1777 ConfigInfo::CI_STRING,
1784 CFG_DB_DD_FILESYSTEM_PATH,
1787 "Path to directory where the "DB_TOKEN_PRINT
" node stores its disk-data/undo-files",
1789 CI_CHECK_WRITABLE | CI_RESTART_INITIAL,
1790 ConfigInfo::CI_STRING,
1795 CFG_DB_DD_DATAFILE_PATH,
1796 "FileSystemPathDataFiles",
1798 "Path to directory where the "DB_TOKEN_PRINT
" node stores its disk-data-files",
1800 CI_CHECK_WRITABLE | CI_RESTART_INITIAL,
1801 ConfigInfo::CI_STRING,
1806 CFG_DB_DD_UNDOFILE_PATH,
1807 "FileSystemPathUndoFiles",
1809 "Path to directory where the "DB_TOKEN_PRINT
" node stores its disk-undo-files",
1811 CI_CHECK_WRITABLE | CI_RESTART_INITIAL,
1812 ConfigInfo::CI_STRING,
1817 CFG_DB_DD_LOGFILEGROUP_SPEC,
1818 "InitialLogfileGroup",
1820 "Logfile group that will be created during initial start",
1822 CI_RESTART_SYSTEM | CI_RESTART_INITIAL,
1823 ConfigInfo::CI_STRING,
1828 CFG_DB_DD_TABLEPACE_SPEC,
1829 "InitialTablespace",
1831 "Tablespace that will be created during initial start",
1833 CI_RESTART_SYSTEM | CI_RESTART_INITIAL,
1834 ConfigInfo::CI_STRING,
1839 CFG_DB_LCP_TRY_LOCK_TIMEOUT,
1842 "Time in seconds that LCP will poll for checkpoint mutex, before putting it self in lock-queue",
1853 CFG_DB_MT_BUILD_INDEX,
1854 "BuildIndexThreads",
1856 "No of threads to use for building ordered indexes during system/node restart",
1868 "Heartbeat circle is ordered by the given values "
1869 "which must be non-zero and distinct",
1881 "Tracelevel for ndbd's dictionary",
1890 CFG_DB_MAX_START_FAIL,
1891 "MaxStartFailRetries",
1893 "Maximum retries when Ndbd fails in startup, requires StopOnError=0. "
1900 STR_VALUE(MAX_INT_RNIL)
1904 CFG_DB_START_FAIL_DELAY_SECS,
1905 "StartFailRetryDelay",
1907 "Delay in seconds after start failure prior to retry. "
1908 "Requires StopOnError= 0",
1914 STR_VALUE(MAX_INT_RNIL)
1918 CFG_DB_EVENTLOG_BUFFER_SIZE,
1919 "EventLogBufferSize",
1921 "Size of circular buffer of ndb_logevent (inside datanodes)",
1934 "Enable/disable numa support (currently linux only)",
1944 CFG_DB_REDO_OVERCOMMIT_LIMIT,
1945 "RedoOverCommitLimit",
1947 "Limit for how long it will take to flush current "
1948 "RedoBuffer before action is taken (in seconds)",
1954 STR_VALUE(MAX_INT_RNIL)
1958 CFG_DB_REDO_OVERCOMMIT_COUNTER,
1959 "RedoOverCommitCounter",
1961 "If RedoOverCommitLimit has been reached RedoOverCommitCounter"
1962 " in a row times, transactions will be aborted",
1968 STR_VALUE(MAX_INT_RNIL)
1975 "Allocate memory after connection to ndb_mgmd has been established",
1987 "TwoPassInitialNodeRestartCopy",
1989 "Copy data in 2 passes for initial node restart, "
1990 "this enables multi-threaded-ordered index build for initial node restart",
1993 ConfigInfo::CI_BOOL,
2000 CFG_DB_PARALLEL_SCANS_PER_FRAG,
2001 "MaxParallelScansPerFragment",
2003 "Max parallel scans per fragment (tup or tux). If this limit is reached "
2004 " scans will be serialized using a queue.",
2008 #if NDB_VERSION_D < NDB_MAKE_VERSION(7,2,0)
2014 STR_VALUE(MAX_INT_RNIL)
2020 CFG_DB_INDEX_STAT_AUTO_CREATE,
2021 "IndexStatAutoCreate",
2023 "Make create index also create initial index stats",
2033 CFG_DB_INDEX_STAT_AUTO_UPDATE,
2034 "IndexStatAutoUpdate",
2036 "Monitor each index for changes and trigger automatic stats updates."
2037 " See IndexStatTrigger options",
2047 CFG_DB_INDEX_STAT_SAVE_SIZE,
2048 "IndexStatSaveSize",
2050 "Maximum bytes allowed for the saved stats of one index."
2051 " At least 1 sample is produced regardless of size limit."
2052 " The size is scaled up by a factor from IndexStatSaveScale."
2053 " The value affects size of stats saved in NDB system tables"
2054 " and in mysqld memory cache",
2060 STR_VALUE(MAX_INT_RNIL)
2064 CFG_DB_INDEX_STAT_SAVE_SCALE,
2065 "IndexStatSaveScale",
2067 "Factor to scale up IndexStatSaveSize for a large index."
2068 " Given in units of 0.01."
2069 " Multiplied by a logarithmic index size."
2070 " Value 0 disables scaling",
2076 STR_VALUE(MAX_INT_RNIL)
2080 CFG_DB_INDEX_STAT_TRIGGER_PCT,
2081 "IndexStatTriggerPct",
2083 "Percent change (in DML ops) to schedule index stats update."
2084 " The value is scaled down by a factor from IndexStatTriggerScale."
2085 " Value 0 disables the trigger",
2091 STR_VALUE(MAX_INT_RNIL)
2095 CFG_DB_INDEX_STAT_TRIGGER_SCALE,
2096 "IndexStatTriggerScale",
2098 "Factor to scale down IndexStatTriggerPct for a large index."
2099 " Given in units of 0.01."
2100 " Multiplied by a logarithmic index size."
2101 " Value 0 disables scaling",
2107 STR_VALUE(MAX_INT_RNIL)
2111 CFG_DB_INDEX_STAT_UPDATE_DELAY,
2112 "IndexStatUpdateDelay",
2114 "Minimum delay in seconds between automatic index stats updates"
2115 " for a given index."
2116 " Value 0 means no delay",
2122 STR_VALUE(MAX_INT_RNIL)
2135 ConfigInfo::CI_SECTION,
2136 (
const char *)NODE_TYPE_API,
2144 "Use WAN TCP setting as default",
2147 ConfigInfo::CI_BOOL,
2157 "Name of computer for this node",
2160 ConfigInfo::CI_STRING,
2168 "Name of system for this node",
2171 ConfigInfo::CI_STRING,
2185 STR_VALUE(MAX_NODES_ID) },
2191 "Number identifying application node ("API_TOKEN_PRINT
")",
2197 STR_VALUE(MAX_NODES_ID) },
2201 "ExecuteOnComputer",
2203 "String referencing an earlier defined COMPUTER",
2206 ConfigInfo::CI_STRING,
2211 CFG_NODE_ARBIT_RANK,
2214 "If 0, then "API_TOKEN_PRINT
" is not arbitrator. Kernel selects arbitrators in order 1, 2",
2223 CFG_NODE_ARBIT_DELAY,
2226 "When asked to arbitrate, arbitrator waits this long before voting (msec)",
2232 STR_VALUE(MAX_INT_RNIL) },
2235 CFG_MAX_SCAN_BATCH_SIZE,
2238 "The maximum collective batch size for one scan",
2242 STR_VALUE(MAX_SCAN_BATCH_SIZE),
2247 CFG_BATCH_BYTE_SIZE,
2250 "The default batch size in bytes",
2254 STR_VALUE(SCAN_BATCH_SIZE),
2262 "The default batch size in number of records",
2266 STR_VALUE(DEF_BATCH_SIZE),
2268 STR_VALUE(MAX_PARALLEL_OP_PER_SCAN) },
2274 "Specifies which DB nodes to connect",
2277 ConfigInfo::CI_STRING,
2284 CFG_TOTAL_SEND_BUFFER_MEMORY,
2285 "TotalSendBufferMemory",
2287 "Total memory to use for send buffers in all transporters",
2293 STR_VALUE(MAX_INT_RNIL)
2300 "Specifies if an api node should reconnect when fully disconnected from cluster",
2303 ConfigInfo::CI_BOOL,
2311 "HeartbeatThreadPriority",
2313 "Specify thread properties of heartbeat thread",
2316 ConfigInfo::CI_STRING,
2320 CFG_DEFAULT_OPERATION_REDO_PROBLEM_ACTION,
2321 "DefaultOperationRedoProblemAction",
2323 "If Redo-log is having problem, should operation default "
2324 "(unless overridden on transaction/operation level) abort "
2325 "or be put on queue",
2328 ConfigInfo::CI_ENUM,
2329 #if NDB_VERSION_D < NDB_MAKE_VERSION(7,2,0)
2334 (
const char*)default_operation_redo_problem_action_typelib,
2348 ConfigInfo::CI_SECTION,
2349 (
const char *)NODE_TYPE_MGM,
2357 "Use WAN TCP setting as default",
2360 ConfigInfo::CI_BOOL,
2370 "Name of computer for this node",
2373 ConfigInfo::CI_STRING,
2381 "Data directory for this node",
2384 ConfigInfo::CI_STRING,
2392 "Name of system for this node",
2395 ConfigInfo::CI_STRING,
2409 STR_VALUE(MAX_NODES_ID) },
2415 "Number identifying the management server node ("MGM_TOKEN_PRINT
")",
2421 STR_VALUE(MAX_NODES_ID) },
2424 CFG_LOG_DESTINATION,
2427 "String describing where logmessages are sent",
2430 ConfigInfo::CI_STRING,
2436 "ExecuteOnComputer",
2438 "String referencing an earlier defined COMPUTER",
2441 ConfigInfo::CI_STRING,
2447 "MaxNoOfSavedEvents",
2455 STR_VALUE(MAX_INT_RNIL) },
2461 "Port number to give commands to/fetch configurations from management server",
2465 STR_VALUE(NDB_PORT),
2467 STR_VALUE(MAX_PORT_NO) },
2473 "Port number used to get statistical information from a management server",
2479 STR_VALUE(MAX_PORT_NO) },
2482 CFG_NODE_ARBIT_RANK,
2485 "If 0, then "MGM_TOKEN_PRINT
" is not arbitrator. Kernel selects arbitrators in order 1, 2",
2494 CFG_NODE_ARBIT_DELAY,
2503 STR_VALUE(MAX_INT_RNIL) },
2506 CFG_TOTAL_SEND_BUFFER_MEMORY,
2507 "TotalSendBufferMemory",
2509 "Total memory to use for send buffers in all transporters",
2515 STR_VALUE(MAX_INT_RNIL)
2520 "HeartbeatThreadPriority",
2522 "Specify thread properties of heartbeat thread",
2525 ConfigInfo::CI_STRING,
2533 CFG_SECTION_CONNECTION,
2536 "Connection section",
2539 ConfigInfo::CI_SECTION,
2540 (
const char *)CONNECTION_TYPE_TCP,
2545 CFG_CONNECTION_HOSTNAME_1,
2548 "Name/IP of computer on one side of the connection",
2551 ConfigInfo::CI_STRING,
2556 CFG_CONNECTION_HOSTNAME_2,
2559 "Name/IP of computer on one side of the connection",
2562 ConfigInfo::CI_STRING,
2567 CFG_CONNECTION_NODE_1,
2570 "Id of node ("DB_TOKEN_PRINT
", "API_TOKEN_PRINT
" or "MGM_TOKEN_PRINT
") on one side of the connection",
2573 ConfigInfo::CI_STRING,
2578 CFG_CONNECTION_NODE_2,
2581 "Id of node ("DB_TOKEN_PRINT
", "API_TOKEN_PRINT
" or "MGM_TOKEN_PRINT
") on one side of the connection",
2584 ConfigInfo::CI_STRING,
2589 CFG_CONNECTION_GROUP,
2600 CFG_CONNECTION_NODE_ID_SERVER,
2611 CFG_CONNECTION_SEND_SIGNAL_ID,
2614 "Sends id in each signal. Used in trace files.",
2617 ConfigInfo::CI_BOOL,
2624 CFG_CONNECTION_CHECKSUM,
2627 "If checksum is enabled, all signals between nodes are checked for errors",
2630 ConfigInfo::CI_BOOL,
2636 CFG_CONNECTION_SERVER_PORT,
2645 STR_VALUE(MAX_PORT_NO) },
2648 CFG_TCP_SEND_BUFFER_SIZE,
2651 "Bytes of buffer for signals sent from this node",
2657 STR_VALUE(MAX_INT_RNIL) },
2660 CFG_TCP_RECEIVE_BUFFER_SIZE,
2661 "ReceiveBufferMemory",
2663 "Bytes of buffer for signals received by this node",
2669 STR_VALUE(MAX_INT_RNIL) },
2678 ConfigInfo::CI_STRING,
2683 CFG_CONNECTION_NODE_1_SYSTEM,
2686 "System for node 1 in connection",
2689 ConfigInfo::CI_STRING,
2694 CFG_CONNECTION_NODE_2_SYSTEM,
2697 "System for node 2 in connection",
2700 ConfigInfo::CI_STRING,
2705 CFG_TCP_SND_BUF_SIZE,
2708 "Value used for SO_SNDBUF",
2718 CFG_TCP_RCV_BUF_SIZE,
2721 "Value used for SO_RCVBUF",
2731 CFG_TCP_MAXSEG_SIZE,
2734 "Value used for TCP_MAXSEG",
2744 CFG_TCP_BIND_INADDR_ANY,
2745 "TcpBind_INADDR_ANY",
2747 "Bind InAddrAny instead of hostname for server part of connection",
2750 ConfigInfo::CI_BOOL,
2755 CFG_CONNECTION_OVERLOAD,
2758 "Number of unsent bytes that must be in the send buffer before the\n"
2759 "connection is considered overloaded",
2765 STR_VALUE(MAX_INT_RNIL)
2772 CFG_SECTION_CONNECTION,
2775 "Connection section",
2778 ConfigInfo::CI_SECTION,
2779 (
const char *)CONNECTION_TYPE_SHM,
2783 CFG_CONNECTION_HOSTNAME_1,
2786 "Name/IP of computer on one side of the connection",
2789 ConfigInfo::CI_STRING,
2794 CFG_CONNECTION_HOSTNAME_2,
2797 "Name/IP of computer on one side of the connection",
2800 ConfigInfo::CI_STRING,
2805 CFG_CONNECTION_SERVER_PORT,
2814 STR_VALUE(MAX_PORT_NO) },
2820 "Signum to be used for signalling",
2826 STR_VALUE(MAX_INT_RNIL) },
2829 CFG_CONNECTION_NODE_1,
2832 "Id of node ("DB_TOKEN_PRINT
", "API_TOKEN_PRINT
" or "MGM_TOKEN_PRINT
") on one side of the connection",
2835 ConfigInfo::CI_STRING,
2840 CFG_CONNECTION_NODE_2,
2843 "Id of node ("DB_TOKEN_PRINT
", "API_TOKEN_PRINT
" or "MGM_TOKEN_PRINT
") on one side of the connection",
2846 ConfigInfo::CI_STRING,
2851 CFG_CONNECTION_GROUP,
2862 CFG_CONNECTION_NODE_ID_SERVER,
2873 CFG_CONNECTION_SEND_SIGNAL_ID,
2876 "Sends id in each signal. Used in trace files.",
2879 ConfigInfo::CI_BOOL,
2886 CFG_CONNECTION_CHECKSUM,
2889 "If checksum is enabled, all signals between nodes are checked for errors",
2892 ConfigInfo::CI_BOOL,
2901 "A shared memory key",
2907 STR_VALUE(MAX_INT_RNIL) },
2913 "Size of shared memory segment",
2919 STR_VALUE(MAX_INT_RNIL) },
2922 CFG_CONNECTION_NODE_1_SYSTEM,
2925 "System for node 1 in connection",
2928 ConfigInfo::CI_STRING,
2933 CFG_CONNECTION_NODE_2_SYSTEM,
2936 "System for node 2 in connection",
2939 ConfigInfo::CI_STRING,
2944 CFG_CONNECTION_OVERLOAD,
2947 "Number of unsent bytes that must be in the send buffer before the\n"
2948 "connection is considered overloaded",
2954 STR_VALUE(MAX_INT_RNIL)
2961 CFG_SECTION_CONNECTION,
2964 "Connection section",
2967 ConfigInfo::CI_SECTION,
2968 (
const char *)CONNECTION_TYPE_SCI,
2973 CFG_CONNECTION_NODE_1,
2976 "Id of node ("DB_TOKEN_PRINT
", "API_TOKEN_PRINT
" or "MGM_TOKEN_PRINT
") on one side of the connection",
2979 ConfigInfo::CI_STRING,
2984 CFG_CONNECTION_NODE_2,
2987 "Id of node ("DB_TOKEN_PRINT
", "API_TOKEN_PRINT
" or "MGM_TOKEN_PRINT
") on one side of the connection",
2990 ConfigInfo::CI_STRING,
2995 CFG_CONNECTION_GROUP,
3006 CFG_CONNECTION_NODE_ID_SERVER,
3017 CFG_CONNECTION_HOSTNAME_1,
3020 "Name/IP of computer on one side of the connection",
3023 ConfigInfo::CI_STRING,
3028 CFG_CONNECTION_HOSTNAME_2,
3031 "Name/IP of computer on one side of the connection",
3034 ConfigInfo::CI_STRING,
3039 CFG_CONNECTION_SERVER_PORT,
3048 STR_VALUE(MAX_PORT_NO) },
3054 "SCI-node id for adapter 0 on Host1 (a computer can have two adapters)",
3060 STR_VALUE(MAX_INT_RNIL) },
3066 "SCI-node id for adapter 1 on Host1 (a computer can have two adapters)",
3072 STR_VALUE(MAX_INT_RNIL) },
3078 "SCI-node id for adapter 0 on Host2 (a computer can have two adapters)",
3084 STR_VALUE(MAX_INT_RNIL) },
3090 "SCI-node id for adapter 1 on Host2 (a computer can have two adapters)",
3096 STR_VALUE(MAX_INT_RNIL) },
3099 CFG_CONNECTION_SEND_SIGNAL_ID,
3102 "Sends id in each signal. Used in trace files.",
3105 ConfigInfo::CI_BOOL,
3111 CFG_CONNECTION_CHECKSUM,
3114 "If checksum is enabled, all signals between nodes are checked for errors",
3117 ConfigInfo::CI_BOOL,
3126 "Transporter send buffer contents are sent when this no of bytes is buffered",
3138 "Size of shared memory segment",
3144 STR_VALUE(MAX_INT_RNIL) },
3147 CFG_CONNECTION_NODE_1_SYSTEM,
3150 "System for node 1 in connection",
3153 ConfigInfo::CI_STRING,
3158 CFG_CONNECTION_NODE_2_SYSTEM,
3161 "System for node 2 in connection",
3164 ConfigInfo::CI_STRING,
3169 CFG_CONNECTION_OVERLOAD,
3172 "Number of unsent bytes that must be in the send buffer before the\n"
3173 "connection is considered overloaded",
3179 STR_VALUE(MAX_INT_RNIL)
3184 const int ConfigInfo::m_NoOfParams =
sizeof(m_ParamInfo) /
sizeof(ParamInfo);
3191 #define require(x) require_exit_or_core(x, -1)
3193 ConfigInfo::ConfigInfo()
3194 : m_info(true), m_systemDefaults(true)
3200 for (i=0; i<m_NoOfParams; i++) {
3201 const ParamInfo & param = m_ParamInfo[
i];
3202 Uint64 default_uint64;
3206 if (!m_info.getCopy(param._section, §ion)) {
3208 m_info.put(param._section, &newsection);
3211 m_info.getCopy(param._section, §ion);
3216 pinfo.put(
"Id", param._paramId);
3217 pinfo.put(
"Fname", param._fname);
3218 pinfo.put(
"Description", param._description);
3223 const Uint32
flags = param._flags;
3224 const Uint32 allowed_flags = (CI_ONLINE_UPDATEABLE | CI_CHECK_WRITABLE |
3225 CI_RESTART_SYSTEM | CI_RESTART_INITIAL);
3227 require((flags & ~allowed_flags) == 0);
3229 if (flags & CI_ONLINE_UPDATEABLE)
3233 require((flags & CI_RESTART_INITIAL) == 0 &&
3234 (flags & CI_RESTART_SYSTEM) == 0);
3241 if ((flags & CI_RESTART_INITIAL) || (flags & CI_RESTART_SYSTEM))
3242 require(strcmp(param._section, DB_TOKEN) == 0);
3244 pinfo.put(
"Flags", flags);
3246 pinfo.put(
"Type", param._type);
3248 const Status status = param._status;
3249 require(status == CI_USED ||
3250 status == CI_EXPERIMENTAL ||
3251 status == CI_DEPRECATED ||
3252 status == CI_NOTIMPLEMENTED ||
3253 status == CI_INTERNAL);
3254 pinfo.put(
"Status", status);
3256 switch (param._type) {
3260 require(InitConfigFileParser::convertStringToBool(param._min, tmp_bool));
3261 pinfo.put64(
"Min", tmp_bool);
3262 require(InitConfigFileParser::convertStringToBool(param._max, tmp_bool));
3263 pinfo.put64(
"Max", tmp_bool);
3265 if(param._default == MANDATORY)
3266 pinfo.put(
"Mandatory", (Uint32)1);
3267 else if(param._default)
3269 require(InitConfigFileParser::convertStringToBool(param._default,
3271 pinfo.put(
"Default", tmp_bool);
3280 require(InitConfigFileParser::convertStringToUint64(param._min, tmp_uint64));
3281 pinfo.put64(
"Min", tmp_uint64);
3282 require(InitConfigFileParser::convertStringToUint64(param._max, tmp_uint64));
3283 pinfo.put64(
"Max", tmp_uint64);
3285 if(param._default == MANDATORY)
3286 pinfo.put(
"Mandatory", (Uint32)1);
3287 else if(param._default)
3289 require(InitConfigFileParser::convertStringToUint64(param._default,
3291 pinfo.put64(
"Default", tmp_uint64);
3296 pinfo.put(
"SectionType", (Uint32)UintPtr(param._default));
3301 assert(param._max == 0);
3308 require(pinfo.put(
"values", &values));
3310 if(param._default == MANDATORY)
3311 pinfo.put(
"Mandatory", (Uint32)1);
3312 else if(param._default)
3318 Uint32 default_value;
3319 require(values.get(param._default, &default_value));
3320 require(pinfo.put(
"Default", default_value));
3323 require(pinfo.put(
"DefaultString", param._default));
3328 assert(param._min == 0);
3329 assert(param._max == 0);
3331 if(param._default == MANDATORY)
3332 pinfo.put(
"Mandatory", (Uint32)1);
3333 else if(param._default)
3334 pinfo.put(
"Default", param._default);
3338 assert(param._min == 0);
3341 require(InitConfigFileParser::convertStringToUint64(param._max,
3343 pinfo.put64(
"Max", tmp_uint64);
3345 if(param._default == MANDATORY)
3346 pinfo.put(
"Mandatory", (Uint32)1);
3347 else if(param._default)
3348 pinfo.put(
"Default", param._default);
3353 if (section->get(param._fname, &oldpinfo)) {
3354 ndbout <<
"Error: Parameter " << param._fname
3355 <<
" defined twice in section " << param._section
3361 section->
put(param._fname, &pinfo);
3364 m_info.put(param._section, section,
true);
3367 if(param._type != ConfigInfo::CI_SECTION){
3369 if(!m_systemDefaults.getCopy(param._section, &p)){
3372 if(param._default &&
3373 param._default != MANDATORY){
3374 switch (param._type)
3380 require(p->
put(param._fname, param._default));
3384 require(InitConfigFileParser::convertStringToBool(param._default, default_bool));
3385 require(p->
put(param._fname, default_bool));
3392 require(InitConfigFileParser::convertStringToUint64(param._default, default_uint64));
3393 require(p->put64(param._fname, Uint64(default_uint64)));
3402 Uint32 default_value;
3403 require(verify_enum(getInfo(param._section),
3404 param._fname, param._default,
3406 require(p->
put(param._fname, default_value));
3412 require(m_systemDefaults.put(param._section, p,
true));
3417 for (i=0; i<m_NoOfParams; i++) {
3418 if(m_ParamInfo[i]._section == NULL){
3419 ndbout <<
"Check that each entry has a section failed." << endl;
3420 ndbout <<
"Parameter \"" << m_ParamInfo[
i]._fname << endl;
3421 ndbout <<
"Edit file " << __FILE__ <<
"." << endl;
3425 if(m_ParamInfo[i]._type == ConfigInfo::CI_SECTION)
3428 const Properties * p = getInfo(m_ParamInfo[i]._section);
3429 if (!p || !p->
contains(m_ParamInfo[i]._fname)) {
3430 ndbout <<
"Check that each pname has an fname failed." << endl;
3431 ndbout <<
"Parameter \"" << m_ParamInfo[
i]._fname
3432 <<
"\" does not exist in section \""
3433 << m_ParamInfo[
i]._section <<
"\"." << endl;
3434 ndbout <<
"Edit file " << __FILE__ <<
"." << endl;
3444 inline void warning(
const char * src,
const char * arg){
3445 ndbout <<
"Illegal call to ConfigInfo::" << src <<
"() - " << arg << endl;
3450 ConfigInfo::getInfo(
const char * section)
const {
3452 if(!m_info.get(section, &p)){
3460 ConfigInfo::getDefaults(
const char * section)
const {
3462 if(!m_systemDefaults.get(section, &p)){
3472 const char* fname,
const char *
type){
3475 if (section->get(fname, &p) && p->get(type, &val32)) {
3480 if(p && p->get(type, &val64)){
3485 if(section->get(fname, &p)){
3489 warning(type, fname);
3496 const char* fname,
const char * type){
3499 if (section->get(fname, &p) && p->get(type, &val)) {
3502 warning(type, fname);
3507 ConfigInfo::getMax(
const Properties * section,
const char* fname)
const {
3508 return getInfoInt(section, fname,
"Max");
3512 ConfigInfo::getMin(
const Properties * section,
const char* fname)
const {
3513 return getInfoInt(section, fname,
"Min");
3517 ConfigInfo::getDefault(
const Properties * section,
const char* fname)
const {
3518 return getInfoInt(section, fname,
"Default");
3522 ConfigInfo::getDefaultString(
const Properties * section,
3523 const char* fname)
const
3525 switch (getType(section, fname))
3527 case ConfigInfo::CI_BITMASK:
3528 case ConfigInfo::CI_STRING:
3529 return getInfoString(section, fname,
"Default");
3531 case ConfigInfo::CI_ENUM:
3538 return getInfoString(section, fname,
"DefaultString");
3549 ConfigInfo::hasDefault(
const Properties * section,
const char* fname)
const {
3551 require(section->get(fname, &p));
3556 ConfigInfo::getMandatory(
const Properties * section,
const char* fname)
const {
3558 require(section->get(fname, &p));
3563 ConfigInfo::getDescription(
const Properties * section,
3564 const char* fname)
const {
3565 return getInfoString(section, fname,
"Description");
3569 ConfigInfo::isSection(
const char * section)
const {
3570 for (
int i = 0; i<m_noOfSectionNames; i++) {
3571 if(!strcasecmp(section, m_sectionNames[i]))
return true;
3577 ConfigInfo::nameToAlias(
const char *
name) {
3578 for (
int i = 0; m_sectionNameAliases[
i].name != 0; i++)
3579 if(!strcasecmp(name, m_sectionNameAliases[i].name))
3580 return m_sectionNameAliases[
i].alias;
3585 ConfigInfo::getAlias(
const char * section) {
3586 for (
int i = 0; m_sectionNameAliases[
i].name != 0; i++)
3587 if(!strcasecmp(section, m_sectionNameAliases[i].alias))
3588 return m_sectionNameAliases[
i].name;
3593 ConfigInfo::sectionName(Uint32 section_type, Uint32 type)
const {
3595 switch (section_type){
3596 case CFG_SECTION_SYSTEM:
3600 case CFG_SECTION_NODE:
3603 return DB_TOKEN_PRINT;
3606 return MGM_TOKEN_PRINT;
3609 return API_TOKEN_PRINT;
3617 case CFG_SECTION_CONNECTION:
3619 case CONNECTION_TYPE_TCP:
3622 case CONNECTION_TYPE_SHM:
3625 case CONNECTION_TYPE_SCI:
3639 return "<unknown section>";
3643 section2PrimaryKeys[]={
3644 {API_TOKEN,
"NodeId"},
3645 {DB_TOKEN,
"NodeId"},
3646 {MGM_TOKEN,
"NodeId"},
3647 {
"TCP",
"NodeId1,NodeId2"},
3648 {
"SCI",
"NodeId1,NodeId2"},
3649 {
"SHM",
"NodeId1,NodeId2"},
3654 sectionPrimaryKeys(
const char * name) {
3655 for (
int i = 0; section2PrimaryKeys[
i].name != 0; i++)
3656 if(!strcasecmp(name, section2PrimaryKeys[i].name))
3657 return section2PrimaryKeys[
i].alias;
3663 Uint64 value)
const {
3666 min = getInfoInt(section, fname,
"Min");
3667 max = getInfoInt(section, fname,
"Max");
3669 warning(
"verify", fname);
3671 if (value >= min && value <= max)
3679 ConfigInfo::verify_enum(
const Properties * section,
const char* fname,
3680 const char* value, Uint32& value_int)
const {
3683 require(section->get(fname, &p));
3684 require(p->get(
"values", &values));
3686 if (values->get(value, &value_int))
3693 ConfigInfo::get_enum_values(
const Properties * section,
const char* fname,
3697 require(section->get(fname, &p));
3698 require(p->get(
"values", &values));
3700 const char* separator =
"";
3702 for (
const char* name = it.first(); name != NULL; name = it.next())
3704 list.
appfmt(
"%s%s", separator, name);
3711 ConfigInfo::getType(
const Properties * section,
const char* fname)
const {
3712 return (ConfigInfo::Type) getInfoInt(section, fname,
"Type");
3716 ConfigInfo::getStatus(
const Properties * section,
const char* fname)
const {
3721 ConfigInfo::getFlags(
const Properties* section,
const char* fname)
const {
3722 return (Uint32)getInfoInt(section, fname,
"Flags");
3738 virtual void start() {}
3739 virtual void end() {}
3741 virtual void section_start(
const char* name,
const char* alias,
3742 const char* primarykeys = NULL) {}
3743 virtual void section_end(
const char* name) {}
3745 virtual void parameter(
const char* section_name,
3747 const char* param_name,
3757 virtual void section_start(
const char* name,
const char* alias,
3758 const char* primarykeys = NULL) {
3759 fprintf(m_out,
"****** %s ******\n\n", name);
3762 virtual void parameter(
const char* section_name,
3764 const char* param_name,
3766 switch (info.getType(section, param_name)) {
3767 case ConfigInfo::CI_BOOL:
3768 fprintf(m_out,
"%s (Boolean value)\n", param_name);
3769 fprintf(m_out,
"%s\n", info.getDescription(section, param_name));
3771 if (info.getMandatory(section, param_name))
3772 fprintf(m_out,
"MANDATORY (Legal values: Y, N)\n");
3773 else if (info.hasDefault(section, param_name))
3775 if (info.getDefault(section, param_name) ==
false)
3776 fprintf(m_out,
"Default: N (Legal values: Y, N)\n");
3777 else if (info.getDefault(section, param_name) ==
true)
3778 fprintf(m_out,
"Default: Y (Legal values: Y, N)\n");
3780 fprintf(m_out,
"UNKNOWN\n");
3782 fprintf(m_out,
"\n");
3785 case ConfigInfo::CI_INT:
3786 case ConfigInfo::CI_INT64:
3787 fprintf(m_out,
"%s (Non-negative Integer)\n", param_name);
3788 fprintf(m_out,
"%s\n", info.getDescription(section, param_name));
3789 if (info.getMandatory(section, param_name))
3790 fprintf(m_out,
"MANDATORY (");
3791 else if (info.hasDefault(section, param_name))
3792 fprintf(m_out,
"Default: %llu (",
3793 info.getDefault(section, param_name));
3795 fprintf(m_out,
"(");
3796 fprintf(m_out,
"Min: %llu, ", info.getMin(section, param_name));
3797 fprintf(m_out,
"Max: %llu)\n", info.getMax(section, param_name));
3798 fprintf(m_out,
"\n");
3801 case ConfigInfo::CI_BITMASK:
3802 case ConfigInfo::CI_ENUM:
3803 case ConfigInfo::CI_STRING:
3804 fprintf(m_out,
"%s (String)\n", param_name);
3805 fprintf(m_out,
"%s\n", info.getDescription(section, param_name));
3806 if (info.getMandatory(section, param_name))
3807 fprintf(m_out,
"MANDATORY\n");
3808 else if (info.hasDefault(section, param_name))
3809 fprintf(m_out,
"Default: %s\n",
3810 info.getDefaultString(section, param_name));
3811 fprintf(m_out,
"\n");
3813 case ConfigInfo::CI_SECTION:
3823 void print_xml(
const char* name,
const Properties& pairs,
3824 bool close =
true) {
3827 for (
int i= 0; i < m_indent; i++)
3828 fprintf(m_out,
" ");
3829 fprintf(m_out,
"<%s", name);
3830 for (
const char* name = it.first(); name != NULL; name = it.next()) {
3831 require(pairs.get(name, &value));
3832 fprintf(m_out,
" %s=\"%s\"", name, value);
3835 fprintf(m_out,
"/");
3836 fprintf(m_out,
">\n");
3842 assert(m_indent == 0);
3845 virtual void start() {
3848 pairs.
put(
"protocolversion",
"1");
3849 pairs.
put(
"ndbversionstring", ndbGetOwnVersionString());
3850 Uint32 ndbversion = ndbGetOwnVersion();
3851 buf.
assfmt(
"%u", ndbversion);
3852 pairs.
put(
"ndbversion", buf.
c_str());
3853 buf.
assfmt(
"%u", ndbGetMajor(ndbversion));
3854 pairs.
put(
"ndbversionmajor", buf.
c_str());
3855 buf.
assfmt(
"%u", ndbGetMinor(ndbversion));
3856 pairs.
put(
"ndbversionminor", buf.
c_str());
3857 buf.
assfmt(
"%u", ndbGetBuild(ndbversion));
3858 pairs.
put(
"ndbversionbuild", buf.
c_str());
3860 print_xml(
"configvariables", pairs,
false);
3863 virtual void end() {
3866 print_xml(
"/configvariables", pairs,
false);
3869 virtual void section_start(
const char* name,
const char* alias,
3870 const char* primarykeys = NULL) {
3872 pairs.
put(
"name", alias ? alias : name);
3874 pairs.
put(
"primarykeys", primarykeys);
3875 print_xml(
"section", pairs,
false);
3878 virtual void section_end(
const char* name) {
3881 print_xml(
"/section", pairs,
false);
3884 virtual void parameter(
const char* section_name,
3886 const char* param_name,
3890 pairs.
put(
"name", param_name);
3891 pairs.
put(
"comment", info.getDescription(section, param_name));
3893 switch (info.getType(section, param_name)) {
3894 case ConfigInfo::CI_BOOL:
3895 pairs.
put(
"type",
"bool");
3897 if (info.getMandatory(section, param_name))
3898 pairs.
put(
"mandatory",
"true");
3899 else if (info.hasDefault(section, param_name))
3901 if (info.getDefault(section, param_name) ==
false)
3902 pairs.
put(
"default",
"false");
3903 else if (info.getDefault(section, param_name) ==
true)
3904 pairs.
put(
"default",
"true");
3908 case ConfigInfo::CI_INT:
3909 case ConfigInfo::CI_INT64:
3910 pairs.
put(
"type",
"unsigned");
3912 if (info.getMandatory(section, param_name))
3913 pairs.
put(
"mandatory",
"true");
3914 else if (info.hasDefault(section, param_name))
3916 buf.
assfmt(
"%llu", info.getDefault(section, param_name));
3919 buf.
assfmt(
"%llu", info.getMin(section, param_name));
3921 buf.
assfmt(
"%llu", info.getMax(section, param_name));
3925 case ConfigInfo::CI_BITMASK:
3926 case ConfigInfo::CI_ENUM:
3927 case ConfigInfo::CI_STRING:
3928 pairs.
put(
"type",
"string");
3930 if (info.getMandatory(section, param_name))
3931 pairs.
put(
"mandatory",
"true");
3932 else if (info.hasDefault(section, param_name))
3933 pairs.
put(
"default", info.getDefaultString(section, param_name));
3936 case ConfigInfo::CI_SECTION:
3941 Uint32 flags = info.getFlags(section, param_name);
3943 if (flags & ConfigInfo::CI_CHECK_WRITABLE)
3950 if (flags & ConfigInfo::CI_RESTART_SYSTEM)
3951 pairs.
put(
"restart",
"system");
3954 if (flags & ConfigInfo::CI_RESTART_INITIAL)
3955 pairs.
put(
"initial",
"true");
3958 Uint32 status = info.getStatus(section, param_name);
3960 if (status & ConfigInfo::CI_EXPERIMENTAL)
3961 buf.
append(
"experimental");
3964 pairs.
put(
"supported", buf.
c_str());
3966 print_xml(
"param", pairs);
3970 void ConfigInfo::print(
const char* section)
const {
3972 print_impl(section, pretty_printer);
3975 void ConfigInfo::print_xml(
const char* section)
const {
3977 print_impl(section, xml_printer);
3982 ConfigInfo::is_internal_section(
const Properties* sec)
const
3986 for (
const char*
n = it.first();
n != NULL;
n = it.next()) {
3988 getType(sec,
n) == ConfigInfo:: CI_SECTION)
3995 void ConfigInfo::print_impl(
const char* section_filter,
4000 for (
const char* s = it.first(); s != NULL; s = it.next()) {
4001 if (section_filter && strcmp(section_filter, s))
4006 if (is_internal_section(sec))
4009 const char* section_alias = nameToAlias(s);
4010 printer.section_start(s, section_alias, sectionPrimaryKeys(s));
4014 for (
const char*
n = it.first();
n != NULL;
n = it.next()) {
4019 printer.parameter(s, sec,
n, *
this);
4021 printer.section_end(s);
4024 if (strcmp(s,
"SYSTEM") == 0)
4028 default_section_name.
assfmt(
"%s %s",
4029 section_alias ? section_alias : s,
4031 printer.section_start(s, default_section_name.
c_str());
4034 for (
const char*
n = it.first();
n != NULL;
n = it.next()) {
4039 printer.parameter(s, sec,
n, *
this);
4041 printer.section_end(s);
4060 if(!ctx.m_currentSection->get(
"NodeId", &
id) && !ctx.m_currentSection->get(
"Id", &
id)){
4061 Uint32 nextNodeId= 1;
4062 ctx.m_userProperties.get(
"NextNodeId", &nextNodeId);
4064 while (ctx.m_userProperties.get(
"AllocatedNodeId_",
id, &line))
4066 if (
id != nextNodeId)
4068 fprintf(stderr,
"Cluster configuration warning line %d: "
4069 "Could not use next node id %d for section [%s], "
4070 "using next unused node id %d.\n",
4073 ctx.m_currentSection->
put(
"NodeId",
id);
4074 }
else if(ctx.m_userProperties.get(
"AllocatedNodeId_",
id, &line)) {
4075 ctx.reportError(
"Duplicate nodeid in section "
4076 "[%s] starting at line: %d. Previously used on line %d.",
4083 ctx.reportError(
"too many nodes configured, only up to %d nodes supported.",
4089 ctx.m_userProperties.
put(
"NextNodeId",
id+1,
true);
4094 ctx.m_currentSection->
put(
"Type", ctx.
fname);
4097 ctx.m_userProperties.get(
"NoOfNodes", &nodes);
4098 ctx.m_userProperties.
put(
"NoOfNodes", ++nodes,
true);
4104 ctx.m_userProperties.get(ctx.
fname, &nodes);
4105 ctx.m_userProperties.
put(ctx.
fname, ++nodes,
true);
4112 DBUG_ENTER(
"checkLocalhostHostnameMix");
4113 const char * hostname= 0;
4114 ctx.m_currentSection->get(
"HostName", &hostname);
4115 if (hostname == 0 || hostname[0] == 0)
4118 Uint32 localhost_used= 0;
4119 if(!strcmp(hostname,
"localhost") || !strcmp(hostname,
"127.0.0.1")){
4121 ctx.m_userProperties.
put(
"$computer-localhost-used", localhost_used);
4122 if(!ctx.m_userProperties.get(
"$computer-localhost", &hostname))
4125 ctx.m_userProperties.get(
"$computer-localhost-used", &localhost_used);
4126 ctx.m_userProperties.
put(
"$computer-localhost", hostname);
4129 if (localhost_used) {
4130 ctx.reportError(
"Mixing of localhost (default for [NDBD]HostName) with other hostname(%s) is illegal",
4141 const char * hostname;
4142 DBUG_ENTER(
"fixNodeHostname");
4144 if (ctx.m_currentSection->get(
"HostName", &hostname))
4145 DBUG_RETURN(checkLocalhostHostnameMix(ctx,0));
4147 const char * compId;
4148 if(!ctx.m_currentSection->get(
"ExecuteOnComputer", &compId))
4154 if(!ctx.m_config->get(tmp, &computer)){
4155 ctx.reportError(
"Computer \"%s\" not declared"
4156 "- [%s] starting at line: %d",
4161 if(!computer->get(
"HostName", &hostname)){
4162 ctx.reportError(
"HostName missing in [COMPUTER] (Id: %s) "
4163 " - [%s] starting at line: %d",
4168 require(ctx.m_currentSection->
put(
"HostName", hostname));
4169 DBUG_RETURN(checkLocalhostHostnameMix(ctx,0));
4174 DBUG_ENTER(
"fixFileSystemPath");
4177 if (ctx.m_currentSection->get(
"FileSystemPath", &path))
4180 if (ctx.m_currentSection->get(
"DataDir", &path)) {
4181 require(ctx.m_currentSection->
put(
"FileSystemPath", path));
4193 if (ctx.m_currentSection->get(
"BackupDataDir", &path))
4196 if (ctx.m_currentSection->get(
"FileSystemPath", &path)) {
4197 require(ctx.m_currentSection->
put(
"BackupDataDir", path));
4212 if (strcasecmp(
"TCP",ctx.
fname) == 0)
4216 else if (strcasecmp(
"SHM",ctx.
fname) == 0)
4218 #ifndef NDB_SHM_TRANSPORTER
4222 else if (strcasecmp(
"SCI",ctx.
fname) == 0)
4224 #ifndef NDB_SCI_TRANSPORTER
4231 ctx.reportError(
"Binary not compiled with this connection support, "
4232 "[%s] starting at line: %d",
4245 Uint32 connections = 0;
4246 ctx.m_userProperties.get(
"NoOfConnections", &connections);
4248 ctx.m_userProperties.
put(
"NoOfConnections", ++connections,
true);
4250 ctx.m_currentSection->
put(
"Type", ctx.
fname);
4261 if(!ctx.m_currentSection->get(
"Name", &name)){
4262 ctx.reportError(
"Mandatory parameter Name missing from section "
4263 "[%s] starting at line: %d",
4270 ctx.m_currentSection->
put(
"Type", ctx.
fname);
4281 if(!ctx.m_currentSection->get(
"Id", &
id)){
4282 ctx.reportError(
"Mandatory parameter Id missing from section "
4283 "[%s] starting at line: %d",
4289 Uint32 computers = 0;
4290 ctx.m_userProperties.get(
"NoOfComputers", &computers);
4291 ctx.m_userProperties.
put(
"NoOfComputers", ++computers,
true);
4293 const char * hostname = 0;
4294 ctx.m_currentSection->get(
"HostName", &hostname);
4299 return checkLocalhostHostnameMix(ctx,0);
4309 DBUG_ENTER(
"applyDefaultValues");
4310 if(defaults != NULL){
4313 for(
const char * name = it.first(); name != NULL; name = it.next()){
4314 (void) ctx.m_info->getStatus(ctx.m_currentInfo, name);
4315 if(!ctx.m_currentSection->
contains(name)){
4316 switch (ctx.m_info->getType(ctx.m_currentInfo, name)){
4317 case ConfigInfo::CI_ENUM:
4318 case ConfigInfo::CI_INT:
4319 case ConfigInfo::CI_BOOL:{
4321 require(defaults->get(name, &val));
4322 ctx.m_currentSection->
put(name, val);
4323 DBUG_PRINT(
"info",(
"%s=%d #default",name,val));
4326 case ConfigInfo::CI_INT64:{
4328 require(defaults->get(name, &val));
4329 ctx.m_currentSection->put64(name, val);
4330 DBUG_PRINT(
"info",(
"%s=%lld #default",name,val));
4333 case ConfigInfo::CI_BITMASK:
4334 case ConfigInfo::CI_STRING:{
4336 require(defaults->get(name, &val));
4337 ctx.m_currentSection->
put(name, val);
4338 DBUG_PRINT(
"info",(
"%s=%s #default",name,val));
4341 case ConfigInfo::CI_SECTION:
4348 switch (ctx.m_info->getType(ctx.m_currentInfo, name)){
4349 case ConfigInfo::CI_ENUM:
4350 case ConfigInfo::CI_INT:
4351 case ConfigInfo::CI_BOOL:{
4353 require(ctx.m_currentSection->get(name, &val));
4354 DBUG_PRINT(
"info",(
"%s=%d",name,val));
4357 case ConfigInfo::CI_INT64:{
4359 require(ctx.m_currentSection->get(name, &val));
4360 DBUG_PRINT(
"info",(
"%s=%lld",name,val));
4363 case ConfigInfo::CI_BITMASK:
4364 case ConfigInfo::CI_STRING:{
4366 require(ctx.m_currentSection->get(name, &val));
4367 DBUG_PRINT(
"info",(
"%s=%s",name,val));
4370 case ConfigInfo::CI_SECTION:
4383 if(strcmp(data,
"user") == 0)
4384 applyDefaultValues(ctx, ctx.m_userDefaults);
4385 else if (strcmp(data,
"system") == 0)
4386 applyDefaultValues(ctx, ctx.m_systemDefaults);
4400 for(
const char * name = it.first(); name != NULL; name = it.next()){
4402 require(ctx.m_currentInfo->get(name, &info));
4404 if(info->get(
"Mandatory", &val)){
4406 require(info->get(
"Fname", &fname));
4407 if(!ctx.m_currentSection->
contains(fname)){
4408 ctx.reportError(
"Mandatory parameter %s missing from section "
4409 "[%s] starting at line: %d",
4426 char buf[] =
"NodeIdX"; buf[6] = data[
sizeof(
"NodeI")];
4427 char sysbuf[] =
"SystemX"; sysbuf[6] = data[
sizeof(
"NodeI")];
4429 if(!ctx.m_currentSection->get(buf, &nodeId))
4431 ctx.reportError(
"Mandatory parameter %s missing from section"
4432 "[%s] starting at line: %d",
4439 int tokens = str.split(token_list,
".", 2);
4445 ctx.reportError(
"Value for mandatory parameter %s missing from section "
4446 "[%s] starting at line: %d",
4451 const char* token1 = token_list[0].c_str();
4455 id = strtol(token1, &p, 10);
4456 if (errno != 0 || id <= 0x0 || id > MAX_NODES)
4458 ctx.reportError(
"Illegal value for mandatory parameter %s from section "
4459 "[%s] starting at line: %d",
4463 require(ctx.m_currentSection->
put(buf,
id,
true));
4465 assert(tokens == 2 && token_list.size() == 2);
4466 const char* token2 = token_list[1].c_str();
4470 id = strtol(token2, &p, 10);
4471 if (errno != 0 || id <= 0x0 || id > MAX_NODES)
4473 ctx.reportError(
"Illegal value for mandatory parameter %s from section "
4474 "[%s] starting at line: %d",
4478 require(ctx.m_currentSection->
put(buf,
id,
true));
4479 require(ctx.m_currentSection->
put(sysbuf, token1));
4495 char buf[] =
"NodeIdX"; buf[6] = data[
sizeof(
"HostNam")];
4496 char sysbuf[] =
"SystemX"; sysbuf[6] = data[
sizeof(
"HostNam")];
4498 if(!ctx.m_currentSection->
contains(data)){
4500 require(ctx.m_currentSection->get(buf, &
id));
4503 if(!ctx.m_config->get(
"Node",
id, &node))
4505 ctx.reportError(
"Unknown node: \"%d\" specified in connection "
4506 "[%s] starting at line: %d",
4511 const char * hostname;
4512 require(node->get(
"HostName", &hostname));
4513 require(ctx.m_currentSection->
put(data, hostname));
4524 DBUG_ENTER(
"fixPortNumber");
4527 const char *hostName1;
4528 const char *hostName2;
4529 require(ctx.m_currentSection->get(
"NodeId1", &id1));
4530 require(ctx.m_currentSection->get(
"NodeId2", &id2));
4531 require(ctx.m_currentSection->get(
"HostName1", &hostName1));
4532 require(ctx.m_currentSection->get(
"HostName2", &hostName2));
4533 DBUG_PRINT(
"info",(
"NodeId1=%d HostName1=\"%s\"",id1,hostName1));
4534 DBUG_PRINT(
"info",(
"NodeId2=%d HostName2=\"%s\"",id2,hostName2));
4537 require(ctx.m_config->get(
"Node", id1, &node1));
4538 require(ctx.m_config->get(
"Node", id2, &node2));
4540 const char *type1, *type2;
4541 require(node1->get(
"Type", &type1));
4542 require(node2->get(
"Type", &type2));
4546 Uint32 nodeIdServer = id1 < id2 ? id1 : id2;
4547 if(strcmp(type1, API_TOKEN) == 0 || strcmp(type2, MGM_TOKEN) == 0)
4549 else if(strcmp(type2, API_TOKEN) == 0 || strcmp(type1, MGM_TOKEN) == 0)
4551 ctx.m_currentSection->
put(
"NodeIdServer", nodeIdServer);
4553 if (id2 == nodeIdServer) {
4555 const char *tmp= hostName1;
4556 hostName1= hostName2;
4570 const char *tmp= type1;
4579 if (hostname.c_str()[0] == 0) {
4580 ctx.reportError(
"Hostname required on nodeid %d since it will "
4581 "act as server.", id1);
4585 Uint32 bindAnyAddr = 0;
4586 node1->get(
"TcpBind_INADDR_ANY", &bindAnyAddr);
4589 ctx.m_currentSection->
put(
"TcpBind_INADDR_ANY", 1,
true);
4593 if(strcmp(type1, MGM_TOKEN)==0)
4594 node1->get(
"PortNumber",&port);
4595 else if(strcmp(type2, MGM_TOKEN)==0)
4596 node2->get(
"PortNumber",&port);
4599 !node1->get(
"ServerPort", &port) &&
4600 !ctx.m_userProperties.get(
"ServerPort_", id1, &port))
4608 if(ctx.m_userDefaults && ctx.m_userDefaults->get(
"PortNumber", &base))
4613 server_port_adder.append(
"_ServerPortAdder");
4614 ctx.m_userProperties.get(server_port_adder.c_str(), &adder);
4615 ctx.m_userProperties.
put(server_port_adder.c_str(), adder+1,
true);
4619 ctx.m_userProperties.
put(
"ServerPort_", id1, port);
4623 if(ctx.m_currentSection->
contains(
"PortNumber")) {
4624 ndbout <<
"PortNumber should no longer be specificied "
4625 <<
"per connection, please remove from config. "
4626 <<
"Will be changed to " << port << endl;
4627 ctx.m_currentSection->
put(
"PortNumber", port,
true);
4631 ctx.m_currentSection->
put(
"PortNumber", port);
4634 DBUG_PRINT(
"info", (
"connection %d-%d port %d host %s",
4635 id1, id2, port, hostname.c_str()));
4643 DBUG_ENTER(
"fixShmUniqueId");
4645 ctx.m_userProperties.get(ctx.
fname, &nodes);
4648 Uint32 portno= NDB_PORT;
4649 ctx.m_currentSection->get(
"PortNumber", &portno);
4650 ctx.m_userProperties.
put(
"ShmUniqueId", portno);
4659 DBUG_ENTER(
"fixShmKey");
4661 static int last_signum= -1;
4663 if(!ctx.m_currentSection->get(
"Signum", &signum))
4667 ctx.reportError(
"Unable to set default parameter for [SHM]Signum"
4668 " please specify [SHM DEFAULT]Signum");
4671 ctx.m_currentSection->
put(
"Signum", signum);
4672 DBUG_PRINT(
"info",(
"Added Signum=%u", signum));
4674 if ( last_signum != (
int)signum && last_signum >= 0 )
4676 ctx.reportError(
"All shared memory transporters must have same [SHM]Signum defined."
4677 " Use [SHM DEFAULT]Signum");
4680 last_signum= (int)signum;
4683 Uint32 id1= 0, id2= 0, key= 0;
4684 require(ctx.m_currentSection->get(
"NodeId1", &id1));
4685 require(ctx.m_currentSection->get(
"NodeId2", &id2));
4686 if(!ctx.m_currentSection->get(
"ShmKey", &key))
4688 require(ctx.m_userProperties.get(
"ShmUniqueId", &key));
4689 key= key << 16 | (id1 > id2 ? id1 << 8 | id2 : id2 << 8 | id1);
4690 ctx.m_currentSection->
put(
"ShmKey", key);
4691 DBUG_PRINT(
"info",(
"Added ShmKey=0x%x", key));
4703 Uint32 t1 = 0, t2 = 0;
4704 ctx.m_currentSection->get(
"MaxNoOfConcurrentOperations", &t1);
4705 ctx.m_currentSection->get(
"MaxNoOfConcurrentTransactions", &t2);
4708 ctx.reportError(
"MaxNoOfConcurrentOperations must be greater than "
4709 "MaxNoOfConcurrentTransactions - [%s] starting at line: %d",
4714 Uint32 replicas = 0, otherReplicas;
4715 ctx.m_currentSection->get(
"NoOfReplicas", &replicas);
4716 if(ctx.m_userProperties.get(
"NoOfReplicas", &otherReplicas)){
4717 if(replicas != otherReplicas){
4718 ctx.reportError(
"NoOfReplicas defined differently on different nodes"
4719 " - [%s] starting at line: %d",
4724 ctx.m_userProperties.
put(
"NoOfReplicas", replicas);
4734 Uint32 noOfTables = 0,
4735 noOfOrderedIndexes = 0,
4736 noOfUniqueHashIndexes = 0;
4737 ctx.m_currentSection->get(
"MaxNoOfTables", &noOfTables);
4738 ctx.m_currentSection->get(
"MaxNoOfOrderedIndexes", &noOfOrderedIndexes);
4739 ctx.m_currentSection->get(
"MaxNoOfUniqueHashIndexes", &noOfUniqueHashIndexes);
4741 Uint64 sum= (Uint64)noOfTables + noOfOrderedIndexes + noOfUniqueHashIndexes;
4743 if (sum > ((Uint32)~0 - 2)) {
4744 ctx.reportError(
"The sum of MaxNoOfTables, MaxNoOfOrderedIndexes and"
4745 " MaxNoOfUniqueHashIndexes must not exceed %u - [%s]"
4746 " starting at line: %d",
4754 #include <NdbThread.h>
4761 const char * spec = 0;
4762 if (ctx.m_currentSection->get(
"HeartbeatThreadPriority", &spec))
4764 int ret = NdbThread_SetHighPrioProperties(spec);
4765 NdbThread_SetHighPrioProperties(0);
4768 ctx.reportError(
"Unable to parse HeartbeatThreadPriority: %s", spec);
4776 #include "../kernel/vm/mt_thr_config.hpp"
4783 Uint32 maxExecuteThreads = 0;
4784 Uint32 lqhThreads = 0;
4786 const char * thrconfig = 0;
4787 const char * locktocpu = 0;
4790 if (ctx.m_currentSection->get(
"LockExecuteThreadToCPU", &locktocpu))
4792 tmp.setLockExecuteThreadToCPU(locktocpu);
4795 ctx.m_currentSection->get(
"MaxNoOfExecutionThreads", &maxExecuteThreads);
4796 ctx.m_currentSection->get(
"__ndbmt_lqh_threads", &lqhThreads);
4797 ctx.m_currentSection->get(
"__ndbmt_classic", &classic);
4799 if (ctx.m_currentSection->get(
"ThreadConfig", &thrconfig))
4801 int ret = tmp.do_parse(thrconfig);
4804 ctx.reportError(
"Unable to parse ThreadConfig: %s",
4805 tmp.getErrorMessage());
4809 if (maxExecuteThreads)
4811 ctx.reportWarning(
"ThreadConfig overrides MaxNoOfExecutionThreads");
4816 ctx.reportWarning(
"ThreadConfig overrides __ndbmt_lqh_threads");
4821 ctx.reportWarning(
"ThreadConfig overrides __ndbmt_classic");
4824 else if (maxExecuteThreads || lqhThreads || classic)
4826 int ret = tmp.do_parse(maxExecuteThreads, lqhThreads, classic);
4829 ctx.reportError(
"Unable to set thread configuration: %s",
4830 tmp.getErrorMessage());
4835 if (tmp.getInfoMessage())
4837 ctx.reportWarning(
"%s", tmp.getInfoMessage());
4842 ctx.m_currentSection->
put(
"ThreadConfig", tmp.getConfigString());
4854 Uint32 id1 = 0, id2 = 0;
4855 ctx.m_currentSection->get(
"NodeId1", &id1);
4856 ctx.m_currentSection->get(
"NodeId2", &id2);
4859 ctx.reportError(
"Illegal connection from node to itself"
4860 " - [%s] starting at line: %d",
4866 if(!ctx.m_config->get(
"Node", id1, &node1)){
4867 ctx.reportError(
"Connection refering to undefined node: %d"
4868 " - [%s] starting at line: %d",
4874 if(!ctx.m_config->get(
"Node", id2, &node2)){
4875 ctx.reportError(
"Connection refering to undefined node: %d"
4876 " - [%s] starting at line: %d",
4883 require(node1->get(
"Type", &type1));
4884 require(node2->get(
"Type", &type2));
4891 if((strcmp(type1, DB_TOKEN) != 0 && strcmp(type2, DB_TOKEN) != 0) &&
4892 !(strcmp(type1, MGM_TOKEN) == 0 && strcmp(type2, MGM_TOKEN) == 0))
4894 ctx.reportError(
"Invalid connection between node %d (%s) and node %d (%s)"
4895 " - [%s] starting at line: %d",
4896 id1, type1, id2, type2,
4910 Uint32 lo_node, hi_node;
4916 require(ctx.m_currentSection->get(
"NodeId1", &lo_node) ==
true);
4917 require(ctx.m_currentSection->get(
"NodeId2", &hi_node) ==
true);
4919 if(lo_node > hi_node)
4921 const Uint32 tmp_node = hi_node;
4926 key.
assfmt(
"Link_%d_%d", lo_node, hi_node);
4931 const char * old_defn;
4932 if(ctx.m_userProperties.get(key.
c_str(), &old_defn))
4933 ctx.reportError(
"%s connection is a duplicate of the existing %s",
4949 struct in_addr addr;
4950 if(ctx.m_currentSection->get(data, &host) && strlen(host) &&
4951 Ndb_getInAddr(&addr, host)){
4952 ctx.reportError(
"Unable to lookup/illegal hostname %s"
4953 " - [%s] starting at line: %d",
4964 const char * oldName,
4965 const char * newName,
4966 double add,
double mul){
4968 if(ctx.m_currentSection->
contains(newName)){
4969 ctx.reportError(
"Both %s and %s specified"
4970 " - [%s] starting at line: %d",
4976 PropertiesType oldType;
4977 require(ctx.m_currentSection->getTypeOf(oldName, &oldType));
4978 ConfigInfo::Type newType = ctx.m_info->getType(ctx.m_currentInfo, newName);
4980 if(!((oldType == PropertiesType_Uint32 || oldType == PropertiesType_Uint64)
4981 && (newType == ConfigInfo::CI_INT || newType == ConfigInfo::CI_INT64 || newType == ConfigInfo::CI_BOOL))){
4982 ndbout <<
"oldType: " << (int)oldType <<
", newType: " << (
int)newType << endl;
4983 ctx.reportError("Unable
to handle type conversion w.r.t deprecation %s %s"
4984 "- [%s] starting at line: %d",
4986 ctx.fname, ctx.m_sectionLineno);
4990 require(ctx.m_currentSection->get(oldName, &oldVal));
4992 Uint64 newVal = (Uint64)((Int64)oldVal * mul + add);
4993 if(!ctx.m_info->verify(ctx.m_currentInfo, newName, newVal)){
4994 ctx.reportError(
"Unable to handle deprecation, new value not within bounds"
4995 "%s %s - [%s] starting at line: %d",
5001 if(newType == ConfigInfo::CI_INT || newType == ConfigInfo::CI_BOOL){
5002 require(dst.
put(newName, (Uint32)newVal));
5003 }
else if(newType == ConfigInfo::CI_INT64) {
5004 require(dst.put64(newName, newVal));
5018 for (name = it.first(); name != NULL; name = it.next()) {
5020 while(p->m_section != 0){
5021 if(strcmp(p->m_section, ctx.
fname) == 0){
5022 double mul = p->m_mul;
5023 double add = p->m_add;
5024 if(strcasecmp(name, p->m_oldName) == 0){
5025 if(!transform(ctx, tmp, name, p->m_newName, add, mul)){
5028 }
else if(strcasecmp(name, p->m_newName) == 0) {
5029 if(!transform(ctx, tmp, name, p->m_oldName, -add/mul,1.0/mul)){
5039 for (name = it2.first(); name != NULL; name = it2.next()) {
5040 PropertiesType
type;
5041 require(tmp.getTypeOf(name, &type));
5043 case PropertiesType_Uint32:{
5045 require(tmp.get(name, &val));
5046 require(ctx.m_currentSection->
put(name, val));
5049 case PropertiesType_char:{
5051 require(tmp.get(name, &val));
5052 require(ctx.m_currentSection->
put(name, val));
5055 case PropertiesType_Uint64:{
5057 require(tmp.get(name, &val));
5058 require(ctx.m_currentSection->put64(name, val));
5061 case PropertiesType_Properties:
5072 if(!ctx.m_currentInfo->get(ctx.
fname, &sec)){
5078 const char *secName;
5079 Uint32
id, status, typeVal;
5080 require(sec->get(
"Fname", &secName));
5081 require(sec->get(
"Id", &
id));
5082 require(sec->get(
"Status", &status));
5083 require(sec->get(
"SectionType", &typeVal));
5086 ndbout_c(
"skipping section %s", ctx.
fname);
5091 ctx.m_userProperties.get(
"$Section",
id, &no);
5092 ctx.m_userProperties.
put(
"$Section",
id, no+1,
true);
5094 ctx.m_configValues.openSection(
id, no);
5095 ctx.m_configValues.put(CFG_TYPE_OF_SECTION, typeVal);
5098 for (
const char*
n = it.first();
n != NULL;
n = it.next()) {
5100 if(!ctx.m_currentInfo->get(
n, &info))
5104 info->get(
"Id", &
id);
5106 if(
id == KEY_INTERNAL)
5110 PropertiesType
type;
5111 require(ctx.m_currentSection->getTypeOf(
n, &type));
5113 case PropertiesType_Uint32:{
5115 require(ctx.m_currentSection->get(
n, &val));
5116 ok = ctx.m_configValues.put(
id, val);
5119 case PropertiesType_Uint64:{
5121 require(ctx.m_currentSection->get(
n, &val));
5122 ok = ctx.m_configValues.put64(
id, val);
5125 case PropertiesType_char:{
5127 require(ctx.m_currentSection->get(
n, &val));
5128 ok = ctx.m_configValues.put(
id, val);
5136 ctx.m_configValues.closeSection();
5145 const char * rule_data)
5147 if (!ctx.m_userProperties.
contains(
"SYSTEM")) {
5151 time_t now = ::time((time_t*)NULL);
5152 struct tm* tm_now = ::localtime(&now);
5156 "MC_%d%.2d%.2d%.2d%.2d%.2d",
5157 tm_now->tm_year + 1900,
5166 s.m_sectionData->
put(
"Name", name_buf);
5167 s.m_sectionData->
put(
"Type",
"SYSTEM");
5171 sections.push_back(s);
5180 const char * rule_data)
5182 Uint32 db_nodes = 0;
5183 Uint32 mgm_nodes = 0;
5184 Uint32 api_nodes = 0;
5185 if (!ctx.m_userProperties.get(
"DB", &db_nodes)) {
5186 ctx.reportError(
"At least one database node (ndbd) should be defined in config file");
5189 if (!ctx.m_userProperties.get(
"MGM", &mgm_nodes)) {
5190 ctx.reportError(
"At least one management server node (ndb_mgmd) should be defined in config file");
5193 if (!ctx.m_userProperties.get(
"API", &api_nodes)) {
5194 ctx.reportError(
"At least one application node (for the mysqld) should be defined in config file");
5204 Uint32 nodeId1,
const char * hostname,
5207 Bitmask<(MAX_NODES+31)/32> bitmap;
5211 str.split(arr,
",");
5212 for (Uint32 i = 0; i<arr.size(); i++)
5215 long val = strtol(arr[i].c_str(), &endptr, 10);
5218 ctx.reportError(
"Unable to parse ConnectionMap(\"%s\" for "
5219 "node: %d, hostname: %s",
5220 map, nodeId1, hostname);
5223 if (! (val > 0 && val < MAX_NDB_NODES))
5225 ctx.reportError(
"Invalid node in in ConnectionMap(\"%s\" for "
5226 "node: %d, hostname: %s",
5227 map, nodeId1, hostname);
5232 return bitmap.get(nodeId2);
5239 Uint32 nodeId1, Uint32 nodeId2,
bool use_shm)
5243 const char * map = 0;
5244 const char *hostname1= 0, *hostname2= 0;
5248 require(ctx.m_config->get(
"Node", nodeId1, &tmp));
5249 tmp->get(
"HostName", &hostname1);
5252 tmp->get(
"wan", &wan);
5255 if (tmp->get(
"ConnectionMap", &map))
5257 if ((ret = check_connection(ctx, map, nodeId1, hostname1, nodeId2)) != 1)
5259 return ret == 0 ?
true :
false;
5263 require(ctx.m_config->get(
"Node", nodeId2, &tmp));
5264 tmp->get(
"HostName", &hostname2);
5267 tmp->get(
"wan", &wan);
5270 if (tmp->get(
"ConnectionMap", &map))
5272 if ((ret = check_connection(ctx, map, nodeId2, hostname2, nodeId1)) != 1)
5274 return ret == 0 ?
true :
false;
5281 s.m_sectionData->
put(
"NodeId1", buf);
5283 s.m_sectionData->
put(
"NodeId2", buf);
5286 hostname1 && hostname1[0] &&
5287 hostname2 && hostname2[0] &&
5288 strcmp(hostname1,hostname2) == 0)
5291 DBUG_PRINT(
"info",(
"adding SHM connection %d %d",nodeId1,nodeId2));
5296 DBUG_PRINT(
"info",(
"adding TCP connection %d %d",nodeId1,nodeId2));
5300 s.m_sectionData->
put(
"TCP_RCV_BUF_SIZE", 4194304);
5301 s.m_sectionData->
put(
"TCP_SND_BUF_SIZE", 4194304);
5302 s.m_sectionData->
put(
"TCP_MAXSEG_SIZE", 61440);
5306 sections.push_back(s);
5313 const char * rule_data)
5315 DBUG_ENTER(
"add_node_connections");
5323 Uint32 nodeId1, nodeId2;
5325 if(!props->get(
"Connection", i, &tmp))
break;
5327 if(!tmp->get(
"NodeId1", &nodeId1))
continue;
5328 p_connections.
put(
"", nodeId1, nodeId1);
5329 if(!tmp->get(
"NodeId2", &nodeId2))
continue;
5330 p_connections.put(
"", nodeId2, nodeId2);
5332 p_connections2.put(
"", nodeId1 + (nodeId2<<16), nodeId1);
5333 p_connections2.put(
"", nodeId2 + (nodeId1<<16), nodeId2);
5337 ctx.m_userProperties.get(
"NoOfNodes", &nNodes);
5343 Uint32 i_db= 0, i_api= 0, i_mgm= 0,
n;
5344 for (i= 0,
n= 0;
n < nNodes; i++){
5346 if(!props->get(
"Node", i, &tmp))
continue;
5350 if(!tmp->get(
"Type", &type))
continue;
5352 if (strcmp(type,DB_TOKEN) == 0)
5353 p_db_nodes.put(
"", i_db++, i);
5354 else if (strcmp(type,API_TOKEN) == 0)
5355 p_api_nodes.put(
"", i_api++, i);
5356 else if (strcmp(type,MGM_TOKEN) == 0)
5357 p_mgm_nodes.put(
"", i_mgm++, i);
5360 Uint32 nodeId1, nodeId2, dummy;
5363 for (i= 0; p_db_nodes.get(
"", i, &nodeId1); i++){
5364 for (Uint32 j= i+1;; j++){
5365 if(!p_db_nodes.get(
"", j, &nodeId2))
break;
5366 if(!p_connections2.get(
"", nodeId1+(nodeId2<<16), &dummy))
5368 if (!add_a_connection(sections,ctx,nodeId1,nodeId2,
false))
5375 for (i= 0; p_api_nodes.get(
"", i, &nodeId1); i++){
5376 if(!p_connections.get(
"", nodeId1, &dummy)) {
5377 for (Uint32 j= 0;; j++){
5378 if(!p_db_nodes.get(
"", j, &nodeId2))
break;
5379 if (!add_a_connection(sections,ctx,nodeId1,nodeId2,
false))
5386 for (i= 0; p_mgm_nodes.get(
"", i, &nodeId1); i++){
5387 if(!p_connections.get(
"", nodeId1, &dummy)) {
5388 for (Uint32 j= 0;; j++){
5389 if(!p_db_nodes.get(
"", j, &nodeId2))
break;
5390 if (!add_a_connection(sections,ctx,nodeId1,nodeId2,0))
5397 for (i= 0; p_mgm_nodes.get(
"", i, &nodeId1); i++){
5398 for (Uint32 j= i+1;; j++){
5399 if(!p_mgm_nodes.get(
"", j, &nodeId2))
break;
5400 if(!p_connections2.get(
"", nodeId1+(nodeId2<<16), &dummy))
5402 if (!add_a_connection(sections,ctx,nodeId1,nodeId2,0))
5415 const char * rule_data)
5417 DBUG_ENTER(
"set_connection_priorities");
5424 const char * rule_data)
5429 Uint32 db_host_count= 0;
5430 bool with_arbitration_rank=
false;
5431 ctx.m_userProperties.get(
"NoOfNodes", &n_nodes);
5432 ctx.m_userProperties.get(
"NoOfReplicas", &replicas);
5437 Uint8 ng_cnt[MAX_NDB_NODES];
5438 Bitmask<(MAX_NDB_NODES+31)/32> nodes_wo_ng;
5439 bzero(ng_cnt,
sizeof(ng_cnt));
5441 for (i= 0, n= 0; n < n_nodes; i++)
5444 if(!ctx.m_config->get(
"Node", i, &tmp))
continue;
5448 if(!tmp->get(
"Type", &type))
continue;
5450 if (strcmp(type,DB_TOKEN) == 0)
5453 tmp->get(
"NodeId", &
id);
5456 if (tmp->get(
"Nodegroup", &ng))
5462 else if (ng >= MAX_NDB_NODES)
5464 ctx.reportError(
"Invalid nodegroup %u for node %u",
5481 for (;ng_cnt[next_ng] >= replicas; next_ng++);
5482 for (i = nodes_wo_ng.find(0); i!=BitmaskImpl::NotFound;
5483 i = nodes_wo_ng.find(i + 1))
5486 ctx.m_config->getCopy(
"Node", i, &tmp);
5488 tmp->
put(
"Nodegroup", next_ng,
true);
5489 ctx.m_config->
put(
"Node", i, tmp,
true);
5493 tmp->get(
"NodeId", &
id);
5495 for (;ng_cnt[next_ng] >= replicas; next_ng++);
5503 for (i = 0; i<MAX_NDB_NODES; i++)
5505 if (ng_cnt[i] != 0 && ng_cnt[i] != (Uint8)replicas)
5507 ctx.reportError(
"Nodegroup %u has %u members, NoOfReplicas=%u",
5508 i, ng_cnt[i], replicas);
5519 Uint32
group= 0, i_group= 0;
5520 BaseString node_group_warning, arbitration_warning;
5521 const char *arbit_warn_fmt=
5522 "\n arbitrator with id %d and db node with id %d on same host %s";
5523 const char *arbit_warn_fmt2=
5524 "\n arbitrator with id %d has no hostname specified";
5526 ctx.m_userProperties.get(
"NoOfNodes", &n_nodes);
5527 for (i= 0, n= 0; n < n_nodes; i++){
5529 if(!ctx.m_config->get(
"Node", i, &tmp))
continue;
5533 if(!tmp->get(
"Type", &type))
continue;
5535 const char* host= 0;
5536 tmp->get(
"HostName", &host);
5538 if (strcmp(type,DB_TOKEN) == 0)
5542 if (!p_db_hosts.get(host,&ii))
5544 p_db_hosts.put(host,i);
5545 if (p_arbitrators.get(host,&ii))
5547 arbitration_warning.
appfmt(arbit_warn_fmt, ii, i, host);
5548 p_arbitrators.remove(host);
5554 str.
assfmt(
"#group%d_",group);
5555 p_db_hosts.put(str.
c_str(),i_group,host);
5556 str2.
assfmt(
"##group%d_",group);
5557 p_db_hosts.put(str2.
c_str(),i_group,
i);
5558 for (j= 0; j < i_group; j++)
5560 const char *other_host;
5561 p_db_hosts.get(str.
c_str(),j,&other_host);
5562 if (strcmp(host,other_host) == 0) {
5563 unsigned int other_i, c= 0;
5564 p_db_hosts.get(str2.
c_str(),j,&other_i);
5565 p_db_hosts.get(str.
c_str(),&c);
5567 node_group_warning.
appfmt(
" Node group %d", group);
5569 p_db_hosts.put(str.
c_str(),c);
5570 node_group_warning.
appfmt(
",\n db node with id %d and id %d "
5571 "on same host %s", other_i, i, host);
5575 DBUG_ASSERT(i_group <= replicas);
5576 if (i_group == replicas)
5579 p_db_hosts.get(str.
c_str(),&c);
5580 if (c+1 == (1u << (replicas-1)))
5581 node_group_warning.
append(
".\n Host failure will "
5582 "cause complete cluster shutdown.");
5584 node_group_warning.
append(
".\n Host failure may "
5585 "cause complete cluster shutdown.");
5591 else if (strcmp(type,API_TOKEN) == 0 ||
5592 strcmp(type,MGM_TOKEN) == 0)
5595 if(tmp->get(
"ArbitrationRank", &rank) && rank > 0)
5597 with_arbitration_rank =
true;
5598 if(host && host[0] != 0)
5601 p_arbitrators.put(host,i);
5602 if (p_db_hosts.get(host,&ii))
5604 arbitration_warning.
appfmt(arbit_warn_fmt, i, ii, host);
5609 arbitration_warning.
appfmt(arbit_warn_fmt2, i);
5614 if (db_host_count > 1 && node_group_warning.
length() > 0)
5615 ctx.reportWarning(
"Cluster configuration warning:\n%s",node_group_warning.
c_str());
5616 if (!with_arbitration_rank)
5618 ctx.reportWarning(
"Cluster configuration warning:"
5619 "\n Neither %s nor %s nodes are configured with arbitrator,"
5620 "\n may cause complete cluster shutdown in case of host failure.",
5621 MGM_TOKEN, API_TOKEN);
5623 if (db_host_count > 1 && arbitration_warning.
length() > 0)
5624 ctx.reportWarning(
"Cluster configuration warning:%s%s",arbitration_warning.
c_str(),
5625 "\n Running arbitrator on the same host as a database node may"
5626 "\n cause complete cluster shutdown in case of host failure.");
5634 const char * rule_data)
5643 ctx.m_userProperties.get(
"NoOfNodes", &numNodes);
5645 for (n=0; n < numNodes; n++)
5648 if (!ctx.m_config->get(
"Node", n, &nodeProperties))
continue;
5652 const char* nodeType;
5653 if (unlikely(!nodeProperties->get(
"Type", &nodeType)))
5655 ctx.reportError(
"Missing nodeType for node %u", n);
5659 if (strcmp(nodeType,DB_TOKEN) == 0)
5664 Uint32 maxStartFailRetries;
5665 Uint32 startFailRetryDelay;
5667 if (unlikely(!nodeProperties->get(
"StopOnError", &stopOnError)))
5669 ctx.reportError(
"Missing StopOnError setting for node %u", n);
5673 if (unlikely(!nodeProperties->get(
"MaxStartFailRetries", &maxStartFailRetries)))
5675 ctx.reportError(
"Missing MaxStartFailRetries setting");
5679 if (unlikely(!nodeProperties->get(
"StartFailRetryDelay", &startFailRetryDelay)))
5681 ctx.reportError(
"Missing StartFailRetryDelay setting");
5685 if (unlikely(((stopOnError != 0) &&
5686 ((maxStartFailRetries != 3) ||
5687 (startFailRetryDelay != 0)))))
5689 ctx.reportError(
"Non default settings for MaxStartFailRetries "
5690 "or StartFailRetryDelay with StopOnError != 0");
5701 ConfigInfo::ParamInfoIter::ParamInfoIter(
const ConfigInfo& info,
5703 Uint32 section_type) :
5705 m_section_name(NULL),
5709 for (
int j=0; j<info.m_NoOfParams; j++) {
5711 if (param._type == ConfigInfo::CI_SECTION &&
5713 (section_type == ~(Uint32)0 ||
5725 ConfigInfo::ParamInfoIter::next(
void) {
5726 assert(m_curr_param < m_info.m_NoOfParams);
5730 if (strcmp(param->
_section, m_section_name) == 0 &&
5731 param->_type != ConfigInfo::CI_SECTION)
5734 while (m_curr_param<m_info.m_NoOfParams);
5743 for (Uint32 i = 0; i<list.size(); i++)
5745 if (strstr(name, list[i].c_str()))
5756 const char * rule_data)
5763 sections.split(list,
",");
5773 for (
const char * name = it.first(); name != 0; name = it.next())
5776 if (is_name_in_list(name, list) &&
5777 ctx.m_config->getTypeOf(name, &pt) &&
5778 pt == PropertiesType_Properties)
5781 require(ctx.m_config->get(name, &tmp) != 0);
5787 for (
const char * name2 = it2.first(); name2 != 0; name2 = it2.next())
5790 require(tmp->getTypeOf(name2, &pt) != 0);
5792 case PropertiesType_char:
5794 require(tmp->get(name2, &value) != 0);
5795 data_sz += 1 + ((strlen(value) + 3) / 4);
5798 case PropertiesType_Uint32:
5802 case PropertiesType_Uint64:
5806 case PropertiesType_Properties:
5815 assert(data_sz >> 32 == 0);
5816 ctx.m_configValues.expand(keys, Uint32(data_sz));
5819 for (
const char * name = it.first(); name != 0; name = it.next())
5822 if (is_name_in_list(name, list) &&
5823 ctx.m_config->getTypeOf(name, &pt) &&
5824 pt == PropertiesType_Properties)
5828 require(ctx.m_config->get(name, &tmp) != 0);
5829 require(tmp->get(
"Type", &type) != 0);
5830 require((ctx.m_currentInfo = ctx.m_info->getInfo(type)) != 0);
5831 ctx.m_currentSection =
const_cast<Properties*
>(tmp);
5833 saveInConfigValues(ctx, 0);