Below is the list of changes that have just been committed into a local
5.1 repository of zhl. When zhl does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-07-04 16:32:26+00:00, lzhou@dev3-63.(none) +1 -0
Merge dev3-63.(none):/home/zhl/mysql/mysql-5.0/bug25941
into dev3-63.(none):/home/zhl/mysql/mysql-5.1/bug25941
MERGE: 1.1810.2963.1
storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-07-04 16:32:18+00:00, lzhou@dev3-63.(none) +1 -1
Print warning message to stderr instead of stdout
MERGE: 1.60.35.2
storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-07-04 16:21:49+00:00, lzhou@dev3-63.(none) +0 -0
Merge rename: ndb/src/mgmsrv/ConfigInfo.cpp -> storage/ndb/src/mgmsrv/ConfigInfo.cpp
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: lzhou
# Host: dev3-63.(none)
# Root: /home/zhl/mysql/mysql-5.1/bug25941/RESYNC
--- 1.60.35.1/ndb/src/mgmsrv/ConfigInfo.cpp 2007-07-04 16:32:45 +00:00
+++ 1.112/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2007-07-04 16:32:45 +00:00
@@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#ifndef NDB_MGMAPI
#include <ndb_opt_defaults.h>
#include <NdbTCP.h>
@@ -26,6 +27,11 @@
extern my_bool opt_ndb_shm;
extern my_bool opt_core;
+#else
+#include "ConfigInfo.hpp"
+#include <mgmapi_config_parameters.h>
+#endif /* NDB_MGMAPI */
+
#define MAX_LINE_LENGTH 255
#define KEY_INTERNAL 0
#define MAX_INT_RNIL 0xfffffeff
@@ -46,6 +52,7 @@ extern my_bool opt_core;
#define MGM_TOKEN "MGM"
#define API_TOKEN "API"
+#ifndef NDB_MGMAPI
const ConfigInfo::AliasPair
ConfigInfo::m_sectionNameAliases[]={
{API_TOKEN, "MYSQLD"},
@@ -65,8 +72,7 @@ ConfigInfo::m_sectionNames[]={
"TCP",
"SCI",
- "SHM",
- "OSE"
+ "SHM"
};
const int ConfigInfo::m_noOfSectionNames =
sizeof(m_sectionNames)/sizeof(char*);
@@ -111,12 +117,10 @@ ConfigInfo::m_SectionRules[] = {
{ "TCP", checkConnectionSupport, 0 },
{ "SHM", checkConnectionSupport, 0 },
{ "SCI", checkConnectionSupport, 0 },
- { "OSE", checkConnectionSupport, 0 },
{ "TCP", transformConnection, 0 },
{ "SHM", transformConnection, 0 },
{ "SCI", transformConnection, 0 },
- { "OSE", transformConnection, 0 },
{ DB_TOKEN, fixNodeHostname, 0 },
{ API_TOKEN, fixNodeHostname, 0 },
@@ -128,9 +132,7 @@ ConfigInfo::m_SectionRules[] = {
{ "SHM", fixNodeId, "NodeId2" },
{ "SCI", fixNodeId, "NodeId1" },
{ "SCI", fixNodeId, "NodeId2" },
- { "OSE", fixNodeId, "NodeId1" },
- { "OSE", fixNodeId, "NodeId2" },
-
+
{ "TCP", fixHostname, "HostName1" },
{ "TCP", fixHostname, "HostName2" },
{ "SHM", fixHostname, "HostName1" },
@@ -139,8 +141,6 @@ ConfigInfo::m_SectionRules[] = {
{ "SCI", fixHostname, "HostName2" },
{ "SHM", fixHostname, "HostName1" },
{ "SHM", fixHostname, "HostName2" },
- { "OSE", fixHostname, "HostName1" },
- { "OSE", fixHostname, "HostName2" },
{ "TCP", fixPortNumber, 0 }, // has to come after fixHostName
{ "SHM", fixPortNumber, 0 }, // has to come after fixHostName
@@ -164,7 +164,6 @@ ConfigInfo::m_SectionRules[] = {
{ "TCP", checkConnectionConstraints, 0 },
{ "SHM", checkConnectionConstraints, 0 },
{ "SCI", checkConnectionConstraints, 0 },
- { "OSE", checkConnectionConstraints, 0 },
{ "TCP", checkTCPConstraints, "HostName1" },
{ "TCP", checkTCPConstraints, "HostName2" },
@@ -181,8 +180,7 @@ ConfigInfo::m_SectionRules[] = {
{ "TCP", saveInConfigValues, 0 },
{ "SHM", saveInConfigValues, 0 },
- { "SCI", saveInConfigValues, 0 },
- { "OSE", saveInConfigValues, 0 }
+ { "SCI", saveInConfigValues, 0 }
};
const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule);
@@ -227,6 +225,7 @@ const DepricationTransform f_deprication
{ MGM_TOKEN, "Id", "NodeId", 0, 1 },
{ 0, 0, 0, 0, 0}
};
+#endif /* NDB_MGMAPI */
/**
* The default constructors create objects with suitable values for the
@@ -581,6 +580,18 @@ const ConfigInfo::ParamInfo ConfigInfo::
STR_VALUE(MAX_INT_RNIL) },
{
+ CFG_DB_WATCHDOG_INTERVAL_INITIAL,
+ "TimeBetweenWatchDogCheckInitial",
+ DB_TOKEN,
+ "Time between execution checks inside a database node in the early start phases when memory is allocated",
+ ConfigInfo::CI_USED,
+ true,
+ ConfigInfo::CI_INT,
+ "6000",
+ "70",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
CFG_DB_STOP_ON_ERROR,
"StopOnError",
DB_TOKEN,
@@ -761,6 +772,30 @@ const ConfigInfo::ParamInfo ConfigInfo::
STR_VALUE(MAX_INT_RNIL)},
{
+ CFG_DB_DISK_PAGE_BUFFER_MEMORY,
+ "DiskPageBufferMemory",
+ DB_TOKEN,
+ "Number bytes on each "DB_TOKEN_PRINT" node allocated for disk page buffer cache",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT64,
+ "64M",
+ "4M",
+ "1024G" },
+
+ {
+ CFG_DB_SGA,
+ "SharedGlobalMemory",
+ DB_TOKEN,
+ "Total number bytes on each "DB_TOKEN_PRINT" node allocated for any use",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT64,
+ "20M",
+ "0",
+ "65536G" }, // 32k pages * 32-bit i value
+
+ {
CFG_DB_START_PARTIAL_TIMEOUT,
"StartPartialTimeout",
DB_TOKEN,
@@ -852,11 +887,23 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
- "8",
+ "16",
"3",
STR_VALUE(MAX_INT_RNIL) },
{
+ CFG_DB_REDOLOG_FILE_SIZE,
+ "FragmentLogFileSize",
+ DB_TOKEN,
+ "Size of each Redo log file",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "16M",
+ "4M",
+ "1G" },
+
+ {
CFG_DB_MAX_OPEN_FILES,
"MaxNoOfOpenFiles",
DB_TOKEN,
@@ -864,7 +911,19 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
- "40",
+ "0",
+ "20",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
+ CFG_DB_INITIAL_OPEN_FILES,
+ "InitialNoOfOpenFiles",
+ DB_TOKEN,
+ "Initial number of files open per "DB_TOKEN_PRINT" node.(One thread is created per file)",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "27",
"20",
STR_VALUE(MAX_INT_RNIL) },
@@ -915,8 +974,8 @@ const ConfigInfo::ParamInfo ConfigInfo::
CFG_DB_LCP_DISC_PAGES_TUP_SR,
"NoOfDiskPagesToDiskDuringRestartTUP",
DB_TOKEN,
- "?",
- ConfigInfo::CI_USED,
+ "DiskCheckpointSpeedSr",
+ ConfigInfo::CI_DEPRICATED,
true,
ConfigInfo::CI_INT,
"40",
@@ -927,8 +986,8 @@ const ConfigInfo::ParamInfo ConfigInfo::
CFG_DB_LCP_DISC_PAGES_TUP,
"NoOfDiskPagesToDiskAfterRestartTUP",
DB_TOKEN,
- "?",
- ConfigInfo::CI_USED,
+ "DiskCheckpointSpeed",
+ ConfigInfo::CI_DEPRICATED,
true,
ConfigInfo::CI_INT,
"40",
@@ -939,8 +998,8 @@ const ConfigInfo::ParamInfo ConfigInfo::
CFG_DB_LCP_DISC_PAGES_ACC_SR,
"NoOfDiskPagesToDiskDuringRestartACC",
DB_TOKEN,
- "?",
- ConfigInfo::CI_USED,
+ "DiskCheckpointSpeedSr",
+ ConfigInfo::CI_DEPRICATED,
true,
ConfigInfo::CI_INT,
"20",
@@ -951,8 +1010,8 @@ const ConfigInfo::ParamInfo ConfigInfo::
CFG_DB_LCP_DISC_PAGES_ACC,
"NoOfDiskPagesToDiskAfterRestartACC",
DB_TOKEN,
- "?",
- ConfigInfo::CI_USED,
+ "DiskCheckpointSpeed",
+ ConfigInfo::CI_DEPRICATED,
true,
ConfigInfo::CI_INT,
"20",
@@ -1155,6 +1214,42 @@ const ConfigInfo::ParamInfo ConfigInfo::
0, 0 },
{
+ CFG_DB_DISK_SYNCH_SIZE,
+ "DiskSyncSize",
+ DB_TOKEN,
+ "Data written to a file before a synch is forced",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "4M",
+ "32k",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
+ CFG_DB_CHECKPOINT_SPEED,
+ "DiskCheckpointSpeed",
+ DB_TOKEN,
+ "Bytes per second allowed to be written by checkpoint",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "10M",
+ "1M",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
+ CFG_DB_CHECKPOINT_SPEED_SR,
+ "DiskCheckpointSpeedInRestart",
+ DB_TOKEN,
+ "Bytes per second allowed to be written by checkpoint during restart",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "100M",
+ "1M",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
CFG_DB_BACKUP_MEM,
"BackupMemory",
DB_TOKEN,
@@ -1214,6 +1309,54 @@ const ConfigInfo::ParamInfo ConfigInfo::
"2K",
STR_VALUE(MAX_INT_RNIL) },
+ {
+ CFG_DB_STRING_MEMORY,
+ "StringMemory",
+ DB_TOKEN,
+ "Default size of string memory (0 -> 5% of max 1-100 -> %of max, >100 -> actual bytes)",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "0",
+ "0",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
+ CFG_DB_MAX_ALLOCATE,
+ "MaxAllocate",
+ DB_TOKEN,
+ "Maximum size of allocation to use when allocating memory for tables",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "32M",
+ "1M",
+ "1G" },
+
+ {
+ CFG_DB_MEMREPORT_FREQUENCY,
+ "MemReportFrequency",
+ DB_TOKEN,
+ "Frequency of mem reports in seconds, 0 = only when passing %-limits",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "0",
+ "0",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
+ CFG_DB_O_DIRECT,
+ "ODirect",
+ DB_TOKEN,
+ "Use O_DIRECT file write/read when possible",
+ ConfigInfo::CI_USED,
+ true,
+ ConfigInfo::CI_BOOL,
+ "false",
+ "false",
+ "true"},
+
/***************************************************************************
* API
***************************************************************************/
@@ -2062,155 +2205,12 @@ const ConfigInfo::ParamInfo ConfigInfo::
false,
ConfigInfo::CI_STRING,
UNDEFINED,
- 0, 0 },
-
- /****************************************************************************
- * OSE
- ***************************************************************************/
- {
- CFG_SECTION_CONNECTION,
- "OSE",
- "OSE",
- "Connection section",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_SECTION,
- (const char *)CONNECTION_TYPE_OSE,
- 0, 0
- },
-
- {
- CFG_CONNECTION_HOSTNAME_1,
- "HostName1",
- "OSE",
- "Name of computer on one side of the connection",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_STRING,
- UNDEFINED,
- 0, 0 },
-
- {
- CFG_CONNECTION_HOSTNAME_2,
- "HostName2",
- "OSE",
- "Name of computer on one side of the connection",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_STRING,
- UNDEFINED,
- 0, 0 },
-
- {
- CFG_CONNECTION_NODE_1,
- "NodeId1",
- "OSE",
- "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_INT,
- MANDATORY,
- "0",
- STR_VALUE(MAX_INT_RNIL) },
-
- {
- CFG_CONNECTION_NODE_2,
- "NodeId2",
- "OSE",
- "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_INT,
- UNDEFINED,
- "0",
- STR_VALUE(MAX_INT_RNIL) },
-
- {
- CFG_CONNECTION_SEND_SIGNAL_ID,
- "SendSignalId",
- "OSE",
- "Sends id in each signal. Used in trace files.",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_BOOL,
- "true",
- "false",
- "true" },
-
- {
- CFG_CONNECTION_CHECKSUM,
- "Checksum",
- "OSE",
- "If checksum is enabled, all signals between nodes are checked for errors",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_BOOL,
- "false",
- "false",
- "true" },
-
- {
- CFG_OSE_PRIO_A_SIZE,
- "PrioASignalSize",
- "OSE",
- "Size of priority A signals (in bytes)",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_INT,
- "1000",
- "0",
- STR_VALUE(MAX_INT_RNIL) },
-
- {
- CFG_OSE_PRIO_B_SIZE,
- "PrioBSignalSize",
- "OSE",
- "Size of priority B signals (in bytes)",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_INT,
- "1000",
- "0",
- STR_VALUE(MAX_INT_RNIL) },
-
- {
- CFG_OSE_RECEIVE_ARRAY_SIZE,
- "ReceiveArraySize",
- "OSE",
- "Number of OSE signals checked for correct ordering (in no of OSE signals)",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_INT,
- "10",
- "0",
- STR_VALUE(MAX_INT_RNIL) },
-
- {
- CFG_CONNECTION_NODE_1_SYSTEM,
- "NodeId1_System",
- "OSE",
- "System for node 1 in connection",
- ConfigInfo::CI_INTERNAL,
- false,
- ConfigInfo::CI_STRING,
- UNDEFINED,
- 0, 0 },
-
- {
- CFG_CONNECTION_NODE_2_SYSTEM,
- "NodeId2_System",
- "OSE",
- "System for node 2 in connection",
- ConfigInfo::CI_INTERNAL,
- false,
- ConfigInfo::CI_STRING,
- UNDEFINED,
- 0, 0 },
+ 0, 0 }
};
const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo);
-
+#ifndef NDB_MGMAPI
/****************************************************************************
* Ctor
****************************************************************************/
@@ -2748,12 +2748,7 @@ checkConnectionSupport(InitConfigFilePar
error= 1;
#endif
}
- else if (strcasecmp("OSE",ctx.fname) == 0)
- {
-#ifndef NDB_OSE_TRANSPORTER
- error= 1;
-#endif
- }
+
if (error)
{
ctx.reportError("Binary not compiled with this connection support, "
@@ -2950,25 +2945,50 @@ static bool fixNodeId(InitConfigFilePars
char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")];
char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")];
const char* nodeId;
- require(ctx.m_currentSection->get(buf, &nodeId));
+ if(!ctx.m_currentSection->get(buf, &nodeId))
+ {
+ ctx.reportError("Mandatory parameter %s missing from section"
+ "[%s] starting at line: %d",
+ buf, ctx.fname, ctx.m_sectionLineno);
+ return false;
+ }
char tmpLine[MAX_LINE_LENGTH];
strncpy(tmpLine, nodeId, MAX_LINE_LENGTH);
char* token1 = strtok(tmpLine, ".");
char* token2 = strtok(NULL, ".");
Uint32 id;
-
+
+ if(!token1)
+ {
+ ctx.reportError("Value for mandatory parameter %s missing from section "
+ "[%s] starting at line: %d",
+ buf, ctx.fname, ctx.m_sectionLineno);
+ return false;
+ }
if (token2 == NULL) { // Only a number given
errno = 0;
char* p;
id = strtol(token1, &p, 10);
- if (errno != 0) warning("STRTOK1", nodeId);
+ if (errno != 0 || id <= 0x0 || id > MAX_NODES)
+ {
+ ctx.reportError("Illegal value for mandatory parameter %s from section "
+ "[%s] starting at line: %d",
+ buf, ctx.fname, ctx.m_sectionLineno);
+ return false;
+ }
require(ctx.m_currentSection->put(buf, id, true));
} else { // A pair given (e.g. "uppsala.32")
errno = 0;
char* p;
id = strtol(token2, &p, 10);
- if (errno != 0) warning("STRTOK2", nodeId);
+ if (errno != 0 || id <= 0x0 || id > MAX_NODES)
+ {
+ ctx.reportError("Illegal value for mandatory parameter %s from section "
+ "[%s] starting at line: %d",
+ buf, ctx.fname, ctx.m_sectionLineno);
+ return false;
+ }
require(ctx.m_currentSection->put(buf, id, true));
require(ctx.m_currentSection->put(sysbuf, token1));
}
@@ -3220,7 +3240,31 @@ checkDbConstraints(InitConfigFileParser:
} else {
ctx.m_userProperties.put("NoOfReplicas", replicas);
}
-
+
+ /**
+ * In kernel, will calculate the MaxNoOfMeataTables use the following sum:
+ * Uint32 noOfMetaTables = noOfTables + noOfOrderedIndexes +
+ * noOfUniqueHashIndexes + 2
+ * 2 is the number of the SysTables.
+ * So must check that the sum does't exceed the max value of Uint32.
+ */
+ Uint32 noOfTables = 0,
+ noOfOrderedIndexes = 0,
+ noOfUniqueHashIndexes = 0;
+ ctx.m_currentSection->get("MaxNoOfTables", &noOfTables);
+ ctx.m_currentSection->get("MaxNoOfOrderedIndexes", &noOfOrderedIndexes);
+ ctx.m_currentSection->get("MaxNoOfUniqueHashIndexes", &noOfUniqueHashIndexes);
+
+ Uint64 sum= (Uint64)noOfTables + noOfOrderedIndexes + noOfUniqueHashIndexes;
+
+ if (sum > ((Uint32)~0 - 2)) {
+ ctx.reportError("The sum of MaxNoOfTables, MaxNoOfOrderedIndexes and"
+ " MaxNoOfUniqueHashIndexes must not exceed %u - [%s]"
+ " starting at line: %d",
+ ((Uint32)~0 - 2), ctx.fname, ctx.m_sectionLineno);
+ return false;
+ }
+
return true;
}
@@ -3650,6 +3694,7 @@ check_node_vs_replicas(Vector<ConfigInfo
Uint32 db_nodes= 0;
Uint32 replicas= 0;
Uint32 db_host_count= 0;
+ bool with_arbitration_rank= false;
ctx.m_userProperties.get(DB_TOKEN, &db_nodes);
ctx.m_userProperties.get("NoOfReplicas", &replicas);
if((db_nodes % replicas) != 0){
@@ -3685,83 +3730,90 @@ check_node_vs_replicas(Vector<ConfigInfo
tmp->get("HostName", &host);
if (strcmp(type,DB_TOKEN) == 0)
- {
- {
- Uint32 ii;
- if (!p_db_hosts.get(host,&ii))
- db_host_count++;
- p_db_hosts.put(host,i);
- if (p_arbitrators.get(host,&ii))
- {
- arbitration_warning.appfmt(arbit_warn_fmt, ii, i, host);
- p_arbitrators.remove(host); // only one warning per db node
- }
- }
- {
- unsigned j;
- BaseString str, str2;
- str.assfmt("#group%d_",group);
- p_db_hosts.put(str.c_str(),i_group,host);
- str2.assfmt("##group%d_",group);
- p_db_hosts.put(str2.c_str(),i_group,i);
- for (j= 0; j < i_group; j++)
- {
- const char *other_host;
- p_db_hosts.get(str.c_str(),j,&other_host);
- if (strcmp(host,other_host) == 0) {
- unsigned int other_i, c= 0;
- p_db_hosts.get(str2.c_str(),j,&other_i);
- p_db_hosts.get(str.c_str(),&c);
- if (c == 0) // first warning in this node group
- node_group_warning.appfmt(" Node group %d", group);
- c|= 1 << j;
- p_db_hosts.put(str.c_str(),c);
-
- node_group_warning.appfmt(",\n db node with id %d and id %d "
- "on same host %s", other_i, i, host);
- }
- }
- i_group++;
- DBUG_ASSERT(i_group <= replicas);
- if (i_group == replicas)
- {
- unsigned c= 0;
- p_db_hosts.get(str.c_str(),&c);
- if (c+1 == (1u << (replicas-1))) // all nodes on same machine
- node_group_warning.append(".\n Host failure will "
- "cause complete cluster shutdown.");
- else if (c > 0)
- node_group_warning.append(".\n Host failure may "
- "cause complete cluster shutdown.");
- group++;
- i_group= 0;
- }
- }
+ {
+ {
+ Uint32 ii;
+ if (!p_db_hosts.get(host,&ii))
+ db_host_count++;
+ p_db_hosts.put(host,i);
+ if (p_arbitrators.get(host,&ii))
+ {
+ arbitration_warning.appfmt(arbit_warn_fmt, ii, i, host);
+ p_arbitrators.remove(host); // only one warning per db node
+ }
+ }
+ {
+ unsigned j;
+ BaseString str, str2;
+ str.assfmt("#group%d_",group);
+ p_db_hosts.put(str.c_str(),i_group,host);
+ str2.assfmt("##group%d_",group);
+ p_db_hosts.put(str2.c_str(),i_group,i);
+ for (j= 0; j < i_group; j++)
+ {
+ const char *other_host;
+ p_db_hosts.get(str.c_str(),j,&other_host);
+ if (strcmp(host,other_host) == 0) {
+ unsigned int other_i, c= 0;
+ p_db_hosts.get(str2.c_str(),j,&other_i);
+ p_db_hosts.get(str.c_str(),&c);
+ if (c == 0) // first warning in this node group
+ node_group_warning.appfmt(" Node group %d", group);
+ c|= 1 << j;
+ p_db_hosts.put(str.c_str(),c);
+ node_group_warning.appfmt(",\n db node with id %d and id %d "
+ "on same host %s", other_i, i, host);
+ }
+ }
+ i_group++;
+ DBUG_ASSERT(i_group <= replicas);
+ if (i_group == replicas)
+ {
+ unsigned c= 0;
+ p_db_hosts.get(str.c_str(),&c);
+ if (c+1 == (1u << (replicas-1))) // all nodes on same machine
+ node_group_warning.append(".\n Host failure will "
+ "cause complete cluster shutdown.");
+ else if (c > 0)
+ node_group_warning.append(".\n Host failure may "
+ "cause complete cluster shutdown.");
+ group++;
+ i_group= 0;
+ }
+ }
}
else if (strcmp(type,API_TOKEN) == 0 ||
strcmp(type,MGM_TOKEN) == 0)
- {
- Uint32 rank;
- if(tmp->get("ArbitrationRank", &rank) && rank > 0)
- {
- if(host && host[0] != 0)
- {
- Uint32 ii;
- p_arbitrators.put(host,i);
- if (p_db_hosts.get(host,&ii))
- {
- arbitration_warning.appfmt(arbit_warn_fmt, i, ii, host);
- }
- }
- else
- {
- arbitration_warning.appfmt(arbit_warn_fmt2, i);
- }
- }
+ {
+ Uint32 rank;
+ if(tmp->get("ArbitrationRank", &rank) && rank > 0)
+ {
+ with_arbitration_rank = true; //check whether MGM or API node configured with rank >0
+ if(host && host[0] != 0)
+ {
+ Uint32 ii;
+ p_arbitrators.put(host,i);
+ if (p_db_hosts.get(host,&ii))
+ {
+ arbitration_warning.appfmt(arbit_warn_fmt, i, ii, host);
+ }
+ }
+ else
+ {
+ arbitration_warning.appfmt(arbit_warn_fmt2, i);
+ }
+ }
}
}
if (db_host_count > 1 && node_group_warning.length() > 0)
ctx.reportWarning("Cluster configuration warning:\n%s",node_group_warning.c_str());
+ if (!with_arbitration_rank)
+ {
+ ctx.reportWarning("Cluster configuration warning:"
+ "\n Neither %s nor %s nodes are configured with arbitrator,"
+ "\n may cause complete cluster shutdown in case of host failure.",
+ MGM_TOKEN, API_TOKEN);
+ }
if (db_host_count > 1 && arbitration_warning.length() > 0)
ctx.reportWarning("Cluster configuration warning:%s%s",arbitration_warning.c_str(),
"\n Running arbitrator on the same host as a database node may"
@@ -3771,3 +3823,4 @@ check_node_vs_replicas(Vector<ConfigInfo
}
template class Vector<ConfigInfo::ConfigRuleSection>;
+#endif /* NDB_MGMAPI */
| Thread |
|---|
| • bk commit into 5.1 tree (lzhou:1.2521) | lzhou | 4 Jul |