Below is the list of changes that have just been committed into a local
5.1 repository of justin.he. When justin.he 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-03-28 11:11:11+08:00, Justin.He@stripped +3 -0
Merge dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.0/bug24568-5.0-ndb-bj
into dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.1/bug24568-5.1-new-ndb-bj
MERGE: 1.1810.2373.152
storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2007-03-28 11:11:06+08:00, Justin.He@stripped +0 -0
Auto merged
MERGE: 1.49.35.2
storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2007-03-28 11:11:06+08:00, Justin.He@stripped +0 -0
Merge rename: ndb/src/mgmclient/CommandInterpreter.cpp -> storage/ndb/src/mgmclient/CommandInterpreter.cpp
storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-03-28 11:11:06+08:00, Justin.He@stripped +0 -0
Auto merged
MERGE: 1.60.30.2
storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-03-28 11:11:06+08:00, Justin.He@stripped +0 -0
Merge rename: ndb/src/mgmsrv/ConfigInfo.cpp -> storage/ndb/src/mgmsrv/ConfigInfo.cpp
storage/ndb/src/ndbapi/NdbScanFilter.cpp@stripped, 2007-03-28 11:11:06+08:00, Justin.He@stripped +0 -0
Auto merged
MERGE: 1.8.5.3
storage/ndb/src/ndbapi/NdbScanFilter.cpp@stripped, 2007-03-28 11:11:06+08:00, Justin.He@stripped +0 -0
Merge rename: ndb/src/ndbapi/NdbScanFilter.cpp -> storage/ndb/src/ndbapi/NdbScanFilter.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: Justin.He
# Host: dev3-240.dev.cn.tlan
# Root: /home/justin.he/mysql/mysql-5.1/bug24568-5.1-new-ndb-bj/RESYNC
--- 1.60.30.1/ndb/src/mgmsrv/ConfigInfo.cpp 2007-03-28 11:11:18 +08:00
+++ 1.102/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2007-03-28 11:11:18 +08:00
@@ -65,8 +65,7 @@
"TCP",
"SCI",
- "SHM",
- "OSE"
+ "SHM"
};
const int ConfigInfo::m_noOfSectionNames =
sizeof(m_sectionNames)/sizeof(char*);
@@ -111,12 +110,10 @@
{ "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 +125,7 @@
{ "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 +134,6 @@
{ "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 +157,6 @@
{ "TCP", checkConnectionConstraints, 0 },
{ "SHM", checkConnectionConstraints, 0 },
{ "SCI", checkConnectionConstraints, 0 },
- { "OSE", checkConnectionConstraints, 0 },
{ "TCP", checkTCPConstraints, "HostName1" },
{ "TCP", checkTCPConstraints, "HostName2" },
@@ -181,8 +173,7 @@
{ "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);
@@ -761,6 +752,30 @@
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,7 +867,7 @@
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
- "8",
+ "16",
"3",
STR_VALUE(MAX_INT_RNIL) },
@@ -869,6 +884,18 @@
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) },
+
+ {
CFG_DB_TRANSACTION_CHECK_INTERVAL,
"TimeBetweenInactiveTransactionAbortCheck",
DB_TOKEN,
@@ -915,8 +942,8 @@
CFG_DB_LCP_DISC_PAGES_TUP_SR,
"NoOfDiskPagesToDiskDuringRestartTUP",
DB_TOKEN,
- "?",
- ConfigInfo::CI_USED,
+ "DiskCheckpointSpeedSr",
+ ConfigInfo::CI_DEPRICATED,
true,
ConfigInfo::CI_INT,
"40",
@@ -927,8 +954,8 @@
CFG_DB_LCP_DISC_PAGES_TUP,
"NoOfDiskPagesToDiskAfterRestartTUP",
DB_TOKEN,
- "?",
- ConfigInfo::CI_USED,
+ "DiskCheckpointSpeed",
+ ConfigInfo::CI_DEPRICATED,
true,
ConfigInfo::CI_INT,
"40",
@@ -939,8 +966,8 @@
CFG_DB_LCP_DISC_PAGES_ACC_SR,
"NoOfDiskPagesToDiskDuringRestartACC",
DB_TOKEN,
- "?",
- ConfigInfo::CI_USED,
+ "DiskCheckpointSpeedSr",
+ ConfigInfo::CI_DEPRICATED,
true,
ConfigInfo::CI_INT,
"20",
@@ -951,8 +978,8 @@
CFG_DB_LCP_DISC_PAGES_ACC,
"NoOfDiskPagesToDiskAfterRestartACC",
DB_TOKEN,
- "?",
- ConfigInfo::CI_USED,
+ "DiskCheckpointSpeed",
+ ConfigInfo::CI_DEPRICATED,
true,
ConfigInfo::CI_INT,
"20",
@@ -1155,6 +1182,42 @@
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 +1277,30 @@
"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_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) },
+
/***************************************************************************
* API
***************************************************************************/
@@ -2062,150 +2149,7 @@
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);
@@ -2748,12 +2692,7 @@
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, "
@@ -3220,7 +3159,31 @@
} 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 +3613,7 @@
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 +3649,90 @@
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)
ndbout_c("Cluster configuration warning:\n%s",node_group_warning.c_str());
+ if (!with_arbitration_rank)
+ {
+ ndbout_c("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)
ndbout_c("Cluster configuration warning:%s%s",arbitration_warning.c_str(),
"\n Running arbitrator on the same host as a database node may"
--- 1.49.35.1/ndb/src/mgmclient/CommandInterpreter.cpp 2007-03-28 11:11:18 +08:00
+++ 1.87/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2007-03-28 11:11:18 +08:00
@@ -15,14 +15,7 @@
#include <ndb_global.h>
#include <my_sys.h>
-
-//#define HAVE_GLOBAL_REPLICATION
-
#include <Vector.hpp>
-#ifdef HAVE_GLOBAL_REPLICATION
-#include "../rep/repapi/repapi.h"
-#endif
-
#include <mgmapi.h>
#include <util/BaseString.hpp>
@@ -125,7 +118,7 @@
int executeStatus(int processId, const char* parameters, bool all);
int executeEventReporting(int processId, const char* parameters, bool all);
int executeDumpState(int processId, const char* parameters, bool all);
- int executeStartBackup(char * parameters);
+ int executeStartBackup(char * parameters, bool interactive);
int executeAbortBackup(char * parameters);
int executeStop(Vector<BaseString> &command_list, unsigned command_pos,
int *node_ids, int no_of_nodes);
@@ -167,11 +160,6 @@
int m_verbose;
int try_reconnect;
int m_error;
-#ifdef HAVE_GLOBAL_REPLICATION
- NdbRepHandle m_repserver;
- const char *rep_host;
- bool rep_connected;
-#endif
struct NdbThread* m_event_thread;
NdbMutex *m_print_mutex;
};
@@ -236,10 +224,6 @@
#include <NdbMem.h>
#include <EventLogger.hpp>
#include <signaldata/SetLogLevelOrd.hpp>
-#include <signaldata/GrepImpl.hpp>
-#ifdef HAVE_GLOBAL_REPLICATION
-
-#endif // HAVE_GLOBAL_REPLICATION
#include "MgmtErrorReporter.hpp"
#include <Parser.hpp>
#include <SocketServer.hpp>
@@ -267,9 +251,6 @@
"---------------------------------------------------------------------------\n"
"HELP Print help text\n"
"HELP COMMAND Print detailed help for COMMAND(e.g. SHOW)\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"HELP REPLICATION Help for global replication\n"
-#endif // HAVE_GLOBAL_REPLICATION
#ifdef VM_TRACE // DEBUG ONLY
"HELP DEBUG Help for debug compiled version\n"
#endif
@@ -293,9 +274,6 @@
"EXIT SINGLE USER MODE Exit single user mode\n"
"<id> STATUS Print status\n"
"<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"REP CONNECT <host:port> Connect to REP server on host:port\n"
-#endif
"PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server\n"
"CONNECT [<connectstring>] Connect to management server (reconnect if already connected)\n"
"QUIT Quit management client\n"
@@ -595,39 +573,6 @@
;
-#ifdef HAVE_GLOBAL_REPLICATION
-static const char* helpTextRep =
-"---------------------------------------------------------------------------\n"
-" NDB Cluster -- Management Client -- Help for Global Replication\n"
-"---------------------------------------------------------------------------\n"
-"Commands should be executed on the standby NDB Cluster\n"
-"These features are in an experimental release state.\n"
-"\n"
-"Simple Commands:\n"
-"REP START Start Global Replication\n"
-"REP START REQUESTOR Start Global Replication Requestor\n"
-"REP STATUS Show Global Replication status\n"
-"REP STOP Stop Global Replication\n"
-"REP STOP REQUESTOR Stop Global Replication Requestor\n"
-"\n"
-"Advanced Commands:\n"
-"REP START <protocol> Starts protocol\n"
-"REP STOP <protocol> Stops protocol\n"
-"<protocol> = TRANSFER | APPLY | DELETE\n"
-"\n"
-#ifdef VM_TRACE // DEBUG ONLY
-"Debugging commands:\n"
-"REP DELETE Removes epochs stored in primary and standy systems\n"
-"REP DROP <tableid> Drop a table in SS identified by table id\n"
-"REP SLOWSTOP Stop Replication (Tries to synchonize with primary)\n"
-"REP FASTSTOP Stop Replication (Stops in consistent state)\n"
-"<component> = SUBSCRIPTION\n"
-" METALOG | METASCAN | DATALOG | DATASCAN\n"
-" REQUESTOR | TRANSFER | APPLY | DELETE\n"
-#endif
-;
-#endif // HAVE_GLOBAL_REPLICATION
-
#ifdef VM_TRACE // DEBUG ONLY
static const char* helpTextDebug =
"---------------------------------------------------------------------------\n"
@@ -680,10 +625,6 @@
{"PURGE STALE SESSIONS", helpTextPurgeStaleSessions},
{"CONNECT", helpTextConnect},
{"QUIT", helpTextQuit},
-#ifdef HAVE_GLOBAL_REPLICATION
- {"REPLICATION", helpTextRep},
- {"REP", helpTextRep},
-#endif // HAVE_GLOBAL_REPLICATION
#ifdef VM_TRACE // DEBUG ONLY
{"DEBUG", helpTextDebug},
#endif //VM_TRACE
@@ -723,11 +664,6 @@
m_event_thread= NULL;
try_reconnect = 0;
m_print_mutex= NdbMutex_Create();
-#ifdef HAVE_GLOBAL_REPLICATION
- rep_host = NULL;
- m_repserver = NULL;
- rep_connected = false;
-#endif
}
/*
@@ -1054,7 +990,7 @@
else if(strcasecmp(firstToken, "START") == 0 &&
allAfterFirstToken != NULL &&
strncasecmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
- m_error= executeStartBackup(allAfterFirstToken);
+ m_error= executeStartBackup(allAfterFirstToken, interactive);
DBUG_RETURN(true);
}
else if(strcasecmp(firstToken, "ABORT") == 0 &&
@@ -1066,14 +1002,7 @@
else if (strcasecmp(firstToken, "PURGE") == 0) {
m_error = executePurge(allAfterFirstToken);
DBUG_RETURN(true);
- }
-#ifdef HAVE_GLOBAL_REPLICATION
- else if(strcasecmp(firstToken, "REPLICATION") == 0 ||
- strcasecmp(firstToken, "REP") == 0) {
- m_error = executeRep(allAfterFirstToken);
- DBUG_RETURN(true);
- }
-#endif // HAVE_GLOBAL_REPLICATION
+ }
else if(strcasecmp(firstToken, "ENTER") == 0 &&
allAfterFirstToken != NULL &&
strncasecmp(allAfterFirstToken, "SINGLE USER MODE ",
@@ -1627,8 +1556,8 @@
case NDB_MGM_NODE_TYPE_UNKNOWN:
ndbout << "Error: Unknown Node Type" << endl;
return -1;
- case NDB_MGM_NODE_TYPE_REP:
- abort();
+ case NDB_MGM_NODE_TYPE_MAX:
+ break; /* purify: deadcode */
}
}
@@ -1702,7 +1631,15 @@
char * item = strtok_r(tmpString, " ", &tmpPtr);
int enable;
- const unsigned int *enabled= ndb_mgm_get_logfilter(m_mgmsrv);
+ ndb_mgm_severity enabled[NDB_MGM_EVENT_SEVERITY_ALL] =
+ {{NDB_MGM_EVENT_SEVERITY_ON,0},
+ {NDB_MGM_EVENT_SEVERITY_DEBUG,0},
+ {NDB_MGM_EVENT_SEVERITY_INFO,0},
+ {NDB_MGM_EVENT_SEVERITY_WARNING,0},
+ {NDB_MGM_EVENT_SEVERITY_ERROR,0},
+ {NDB_MGM_EVENT_SEVERITY_CRITICAL,0},
+ {NDB_MGM_EVENT_SEVERITY_ALERT,0}};
+ ndb_mgm_get_clusterlog_severity_filter(m_mgmsrv, &enabled[0], NDB_MGM_EVENT_SEVERITY_ALL);
if(enabled == NULL) {
ndbout << "Couldn't get status" << endl;
printError();
@@ -1715,25 +1652,25 @@
********************/
if (strcasecmp(item, "INFO") == 0) {
DBUG_PRINT("info",("INFO"));
- if(enabled[0] == 0)
+ if(enabled[0].value == 0)
{
ndbout << "Cluster logging is disabled." << endl;
m_error = 0;
DBUG_VOID_RETURN;
}
#if 0
- for(i = 0; i<7;i++)
- printf("enabled[%d] = %d\n", i, enabled[i]);
+ for(i = 0; i<DB_MGM_EVENT_SEVERITY_ALL;i++)
+ printf("enabled[%d] = %d\n", i, enabled[i].value);
#endif
ndbout << "Severities enabled: ";
for(i = 1; i < (int)NDB_MGM_EVENT_SEVERITY_ALL; i++) {
- const char *str= ndb_mgm_get_event_severity_string((ndb_mgm_event_severity)i);
+ const char *str= ndb_mgm_get_event_severity_string(enabled[i].category);
if (str == 0)
{
DBUG_ASSERT(false);
continue;
}
- if(enabled[i])
+ if(enabled[i].value)
ndbout << BaseString(str).ndb_toupper() << " ";
}
ndbout << endl;
@@ -2524,24 +2461,17 @@
return retval;
}
+
/*****************************************************************************
* Backup
*****************************************************************************/
int
-CommandInterpreter::executeStartBackup(char* parameters)
+CommandInterpreter::executeStartBackup(char* parameters, bool interactive)
{
struct ndb_mgm_reply reply;
unsigned int backupId;
-#if 0
- int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
- int fd = ndb_mgm_listen_event(m_mgmsrv, filter);
- if (fd < 0)
- {
- ndbout << "Initializing start of backup failed" << endl;
- printError();
- return fd;
- }
-#endif
+ int fd = -1;
+
Vector<BaseString> args;
{
BaseString(parameters).split(args);
@@ -2554,25 +2484,21 @@
int sz= args.size();
int result;
- if (sz == 2 &&
- args[1] == "NOWAIT")
+ int flags = 2;
+ if (sz == 2 && args[1] == "NOWAIT")
{
+ flags = 0;
result = ndb_mgm_start_backup(m_mgmsrv, 0, &backupId, &reply);
}
- else if (sz == 1 ||
- (sz == 3 &&
- args[1] == "WAIT" &&
- args[2] == "COMPLETED"))
+ else if (sz == 1 || (sz == 3 && args[1] == "WAIT" && args[2] == "COMPLETED"))
{
+ flags = 2;
ndbout_c("Waiting for completed, this may take several minutes");
- result = ndb_mgm_start_backup(m_mgmsrv, 2, &backupId, &reply);
}
- else if (sz == 3 &&
- args[1] == "WAIT" &&
- args[2] == "STARTED")
+ else if (sz == 3 && args[1] == "WAIT" && args[2] == "STARTED")
{
ndbout_c("Waiting for started, this may take several minutes");
- result = ndb_mgm_start_backup(m_mgmsrv, 1, &backupId, &reply);
+ flags = 1;
}
else
{
@@ -2580,45 +2506,63 @@
return -1;
}
+ /**
+ * If interactive...event listner is already running
+ */
+ if (flags == 2 && !interactive)
+ {
+ int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0, 0 };
+ fd = ndb_mgm_listen_event(m_mgmsrv, filter);
+ if (fd < 0)
+ {
+ ndbout << "Initializing start of backup failed" << endl;
+ printError();
+ return fd;
+ }
+ }
+ result = ndb_mgm_start_backup(m_mgmsrv, flags, &backupId, &reply);
+
if (result != 0) {
ndbout << "Backup failed" << endl;
printError();
-#if 0
- close(fd);
-#endif
+
+ if (fd >= 0)
+ close(fd);
return result;
}
-#if 0
- ndbout_c("Waiting for completed, this may take several minutes");
- char *tmp;
- char buf[1024];
+
+ if (fd >= 0)
{
- SocketInputStream in(fd);
- int count = 0;
+ char *tmp;
+ char buf[1024];
+ {
+ SocketInputStream in(fd);
+ int count = 0;
+ do {
+ tmp = in.gets(buf, 1024);
+ if(tmp)
+ {
+ ndbout << tmp;
+ unsigned int id;
+ if(sscanf(tmp, "%*[^:]: Backup %d ", &id) == 1 && id == backupId){
+ count++;
+ }
+ }
+ } while(count < 2);
+ }
+
+ SocketInputStream in(fd, 10);
do {
tmp = in.gets(buf, 1024);
- if(tmp)
+ if(tmp && tmp[0] != 0)
{
ndbout << tmp;
- unsigned int id;
- if(sscanf(tmp, "%*[^:]: Backup %d ", &id) == 1 && id == backupId){
- count++;
- }
}
- } while(count < 2);
+ } while(tmp && tmp[0] != 0);
+
+ close(fd);
}
- SocketInputStream in(fd, 10);
- do {
- tmp = in.gets(buf, 1024);
- if(tmp && tmp[0] != 0)
- {
- ndbout << tmp;
- }
- } while(tmp && tmp[0] != 0);
-
- close(fd);
-#endif
return 0;
}
@@ -2651,234 +2595,5 @@
ndbout << "Invalid arguments: expected <BackupId>" << endl;
return -1;
}
-
-#ifdef HAVE_GLOBAL_REPLICATION
-/*****************************************************************************
- * Global Replication
- *
- * For information about the different commands, see
- * GrepReq::Request in file signaldata/grepImpl.cpp.
- *
- * Below are commands as of 2003-07-05 (may change!):
- * START = 0, ///< Start Global Replication (all phases)
- * START_METALOG = 1, ///< Start Global Replication (all phases)
- * START_METASCAN = 2, ///< Start Global Replication (all phases)
- * START_DATALOG = 3, ///< Start Global Replication (all phases)
- * START_DATASCAN = 4, ///< Start Global Replication (all phases)
- * START_REQUESTOR = 5, ///< Start Global Replication (all phases)
- * ABORT = 6, ///< Immediate stop (removes subscription)
- * SLOW_STOP = 7, ///< Stop after finishing applying current GCI epoch
- * FAST_STOP = 8, ///< Stop after finishing applying all PS GCI epochs
- * START_TRANSFER = 9, ///< Start SS-PS transfer
- * STOP_TRANSFER = 10, ///< Stop SS-PS transfer
- * START_APPLY = 11, ///< Start applying GCI epochs in SS
- * STOP_APPLY = 12, ///< Stop applying GCI epochs in SS
- * STATUS = 13, ///< Status
- * START_SUBSCR = 14,
- * REMOVE_BUFFERS = 15,
- * DROP_TABLE = 16
-
- *****************************************************************************/
-
-int
-CommandInterpreter::executeRep(char* parameters)
-{
- if (emptyString(parameters)) {
- ndbout << helpTextRep;
- return 0;
- }
-
- char * line = my_strdup(parameters,MYF(MY_WME));
- My_auto_ptr<char> ap1((char*)line);
- char * firstToken = strtok(line, " ");
-
- struct ndb_rep_reply reply;
- unsigned int repId;
-
-
- if (!strcasecmp(firstToken, "CONNECT")) {
- char * host = strtok(NULL, "\0");
- for (unsigned int i = 0; i < strlen(host); ++i) {
- host[i] = tolower(host[i]);
- }
-
- if(host == NULL)
- {
- ndbout_c("host:port must be specified.");
- return -1;
- }
-
- if(rep_connected) {
- if(m_repserver != NULL) {
- ndb_rep_disconnect(m_repserver);
- rep_connected = false;
- }
- }
-
- if(m_repserver == NULL)
- m_repserver = ndb_rep_create_handle();
- if(ndb_rep_connect(m_repserver, host) < 0){
- ndbout_c("Failed to connect to %s", host);
- return -1;
- }
- else
- rep_connected=true;
- return 0;
-
- if(!rep_connected) {
- ndbout_c("Not connected to REP server");
- return -1;
- }
- }
-
- /********
- * START
- ********/
- if (!strcasecmp(firstToken, "START")) {
-
- unsigned int req;
- char *startType = strtok(NULL, "\0");
-
- if (startType == NULL) {
- req = GrepReq::START;
- } else if (!strcasecmp(startType, "SUBSCRIPTION")) {
- req = GrepReq::START_SUBSCR;
- } else if (!strcasecmp(startType, "METALOG")) {
- req = GrepReq::START_METALOG;
- } else if (!strcasecmp(startType, "METASCAN")) {
- req = GrepReq::START_METASCAN;
- } else if (!strcasecmp(startType, "DATALOG")) {
- req = GrepReq::START_DATALOG;
- } else if (!strcasecmp(startType, "DATASCAN")) {
- req = GrepReq::START_DATASCAN;
- } else if (!strcasecmp(startType, "REQUESTOR")) {
- req = GrepReq::START_REQUESTOR;
- } else if (!strcasecmp(startType, "TRANSFER")) {
- req = GrepReq::START_TRANSFER;
- } else if (!strcasecmp(startType, "APPLY")) {
- req = GrepReq::START_APPLY;
- } else if (!strcasecmp(startType, "DELETE")) {
- req = GrepReq::START_DELETE;
- } else {
- ndbout_c("Illegal argument to command 'REPLICATION START'");
- return -1;
- }
-
- int result = ndb_rep_command(m_repserver, req, &repId, &reply);
-
- if (result != 0) {
- ndbout << "Start of Global Replication failed" << endl;
- return -1;
- } else {
- ndbout << "Start of Global Replication ordered" << endl;
- }
- return 0;
- }
-
- /********
- * STOP
- ********/
- if (!strcasecmp(firstToken, "STOP")) {
- unsigned int req;
- char *startType = strtok(NULL, " ");
- unsigned int epoch = 0;
-
- if (startType == NULL) {
- /**
- * Stop immediately
- */
- req = GrepReq::STOP;
- } else if (!strcasecmp(startType, "EPOCH")) {
- char *strEpoch = strtok(NULL, "\0");
- if(strEpoch == NULL) {
- ndbout_c("Epoch expected!");
- return -1;
- }
- req = GrepReq::STOP;
- epoch=atoi(strEpoch);
- } else if (!strcasecmp(startType, "SUBSCRIPTION")) {
- req = GrepReq::STOP_SUBSCR;
- } else if (!strcasecmp(startType, "METALOG")) {
- req = GrepReq::STOP_METALOG;
- } else if (!strcasecmp(startType, "METASCAN")) {
- req = GrepReq::STOP_METASCAN;
- } else if (!strcasecmp(startType, "DATALOG")) {
- req = GrepReq::STOP_DATALOG;
- } else if (!strcasecmp(startType, "DATASCAN")) {
- req = GrepReq::STOP_DATASCAN;
- } else if (!strcasecmp(startType, "REQUESTOR")) {
- req = GrepReq::STOP_REQUESTOR;
- } else if (!strcasecmp(startType, "TRANSFER")) {
- req = GrepReq::STOP_TRANSFER;
- } else if (!strcasecmp(startType, "APPLY")) {
- req = GrepReq::STOP_APPLY;
- } else if (!strcasecmp(startType, "DELETE")) {
- req = GrepReq::STOP_DELETE;
- } else {
- ndbout_c("Illegal argument to command 'REPLICATION STOP'");
- return -1;
- }
- int result = ndb_rep_command(m_repserver, req, &repId, &reply, epoch);
-
- if (result != 0) {
- ndbout << "Stop command failed" << endl;
- return -1;
- } else {
- ndbout << "Stop ordered" << endl;
- }
- return 0;
- }
-
- /*********
- * STATUS
- *********/
- if (!strcasecmp(firstToken, "STATUS")) {
- struct rep_state repstate;
- int result =
- ndb_rep_get_status(m_repserver, &repId, &reply, &repstate);
-
- if (result != 0) {
- ndbout << "Status request of Global Replication failed" << endl;
- return -1;
- } else {
- ndbout << "Status request of Global Replication ordered" << endl;
- ndbout << "See printout at one of the DB nodes" << endl;
- ndbout << "(Better status report is under development.)" << endl;
- ndbout << " SubscriptionId " << repstate.subid
- << " SubscriptionKey " << repstate.subkey << endl;
- }
- return 0;
- }
-
- /*********
- * QUERY (see repapi.h for querable counters)
- *********/
- if (!strcasecmp(firstToken, "QUERY")) {
- char *query = strtok(NULL, "\0");
- int queryCounter=-1;
- if(query != NULL) {
- queryCounter = atoi(query);
- }
- struct rep_state repstate;
- unsigned repId = 0;
- int result = ndb_rep_query(m_repserver, (QueryCounter)queryCounter,
- &repId, &reply, &repstate);
-
- if (result != 0) {
- ndbout << "Query repserver failed" << endl;
- return -1;
- } else {
- ndbout << "Query repserver sucessful" << endl;
- ndbout_c("repstate : QueryCounter %d, f=%d l=%d"
- " nodegroups %d" ,
- repstate.queryCounter,
- repstate.first[0], repstate.last[0],
- repstate.no_of_nodegroups );
- }
- return 0;
- }
- return 0;
-}
-#endif // HAVE_GLOBAL_REPLICATION
template class Vector<char const*>;
| Thread |
|---|
| • bk commit into 5.1 tree (Justin.He:1.2487) | justin.he | 28 Mar |