Commit 092db9f2 authored by unknown's avatar unknown

Merge dev3-63.(none):/home/zhl/mysql/tree-merge/5.1/mysql-5.1-new-ndb-bj

into  dev3-63.(none):/home/zhl/mysql/tree-merge/5.1/mysql-5.1-new-ndb


sql/log_event.cc:
  Auto merged
sql/protocol.h:
  Auto merged
sql/slave.cc:
  Auto merged
storage/ndb/src/common/debugger/EventLogger.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/backup/Backup.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Auto merged
storage/ndb/src/mgmclient/CommandInterpreter.cpp:
  Auto merged
storage/ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
storage/ndb/src/mgmsrv/main.cpp:
  Auto merged
storage/ndb/src/ndbapi/ClusterMgr.cpp:
  Auto merged
parents 33709816 4d050840
......@@ -5717,9 +5717,26 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
{
if (!need_reopen)
{
slave_print_msg(ERROR_LEVEL, rli, error,
"Error in %s event: when locking tables",
get_type_str());
if (thd->query_error || thd->is_fatal_error)
{
/*
Error reporting borrowed from Query_log_event with many excessive
simplifications (we don't honour --slave-skip-errors)
*/
uint actual_error= thd->net.last_errno;
slave_print_msg(ERROR_LEVEL, rli, actual_error,
"Error '%s' in %s event: when locking tables",
(actual_error ? thd->net.last_error :
"unexpected success or fatal error"),
get_type_str());
thd->is_fatal_error= 1;
}
else
{
slave_print_msg(ERROR_LEVEL, rli, error,
"Error in %s event: when locking tables",
get_type_str());
}
rli->clear_tables_to_lock();
DBUG_RETURN(error);
}
......
......@@ -58,6 +58,8 @@ class Protocol
String *storage_packet() { return packet; }
inline void free() { packet->free(); }
virtual bool write();
inline bool store(int from)
{ return store_long((longlong) from); }
inline bool store(uint32 from)
{ return store_long((longlong) from); }
inline bool store(longlong from)
......
......@@ -1295,7 +1295,7 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
rpl_filter->get_wild_ignore_table(&tmp);
protocol->store(&tmp);
protocol->store((uint32) mi->rli.last_slave_errno);
protocol->store(mi->rli.last_slave_errno);
protocol->store(mi->rli.last_slave_error, &my_charset_bin);
protocol->store((uint32) mi->rli.slave_skip_counter);
protocol->store((ulonglong) mi->rli.group_master_log_pos);
......
......@@ -16,6 +16,7 @@
#include <ndb_global.h>
#include <EventLogger.hpp>
#include <TransporterCallback.hpp>
#include <NdbConfig.h>
#include <kernel/BlockNumbers.h>
......@@ -526,11 +527,100 @@ void getTextUndoLogBlocked(QQQQ) {
theData[1],
theData[2]);
}
void getTextTransporterError(QQQQ) {
BaseString::snprintf(m_text, m_text_len,
"Transporter to node %d reported error 0x%x",
theData[1],
theData[2]);
struct myTransporterError{
int errorNum;
char errorString[256];
};
int i = 0;
int lenth = 0;
static const struct myTransporterError TransporterErrorString[]=
{
//TE_NO_ERROR = 0
{TE_NO_ERROR,"No error"},
//TE_ERROR_CLOSING_SOCKET = 0x1
{TE_ERROR_CLOSING_SOCKET,"Error found during closing of socket"},
//TE_ERROR_IN_SELECT_BEFORE_ACCEPT = 0x2
{TE_ERROR_IN_SELECT_BEFORE_ACCEPT,"Error found before accept. The transporter will retry"},
//TE_INVALID_MESSAGE_LENGTH = 0x3 | TE_DO_DISCONNECT
{TE_INVALID_MESSAGE_LENGTH,"Error found in message (invalid message length)"},
//TE_INVALID_CHECKSUM = 0x4 | TE_DO_DISCONNECT
{TE_INVALID_CHECKSUM,"Error found in message (checksum)"},
//TE_COULD_NOT_CREATE_SOCKET = 0x5
{TE_COULD_NOT_CREATE_SOCKET,"Error found while creating socket(can't create socket)"},
//TE_COULD_NOT_BIND_SOCKET = 0x6
{TE_COULD_NOT_BIND_SOCKET,"Error found while binding server socket"},
//TE_LISTEN_FAILED = 0x7
{TE_LISTEN_FAILED,"Error found while listening to server socket"},
//TE_ACCEPT_RETURN_ERROR = 0x8
{TE_ACCEPT_RETURN_ERROR,"Error found during accept(accept return error)"},
//TE_SHM_DISCONNECT = 0xb | TE_DO_DISCONNECT
{TE_SHM_DISCONNECT,"The remote node has disconnected"},
//TE_SHM_IPC_STAT = 0xc | TE_DO_DISCONNECT
{TE_SHM_IPC_STAT,"Unable to check shm segment"},
//TE_SHM_UNABLE_TO_CREATE_SEGMENT = 0xd
{TE_SHM_UNABLE_TO_CREATE_SEGMENT,"Unable to create shm segment"},
//TE_SHM_UNABLE_TO_ATTACH_SEGMENT = 0xe
{TE_SHM_UNABLE_TO_ATTACH_SEGMENT,"Unable to attach shm segment"},
//TE_SHM_UNABLE_TO_REMOVE_SEGMENT = 0xf
{TE_SHM_UNABLE_TO_REMOVE_SEGMENT,"Unable to remove shm segment"},
//TE_TOO_SMALL_SIGID = 0x10
{TE_TOO_SMALL_SIGID,"Sig ID too small"},
//TE_TOO_LARGE_SIGID = 0x11
{TE_TOO_LARGE_SIGID,"Sig ID too large"},
//TE_WAIT_STACK_FULL = 0x12 | TE_DO_DISCONNECT
{TE_WAIT_STACK_FULL,"Wait stack was full"},
//TE_RECEIVE_BUFFER_FULL = 0x13 | TE_DO_DISCONNECT
{TE_RECEIVE_BUFFER_FULL,"Receive buffer was full"},
//TE_SIGNAL_LOST_SEND_BUFFER_FULL = 0x14 | TE_DO_DISCONNECT
{TE_SIGNAL_LOST_SEND_BUFFER_FULL,"Send buffer was full,and trying to force send fails"},
//TE_SIGNAL_LOST = 0x15
{TE_SIGNAL_LOST,"Send failed for unknown reason(signal lost)"},
//TE_SEND_BUFFER_FULL = 0x16
{TE_SEND_BUFFER_FULL,"The send buffer was full, but sleeping for a while solved"},
//TE_SCI_LINK_ERROR = 0x0017
{TE_SCI_LINK_ERROR,"There is no link from this node to the switch"},
//TE_SCI_UNABLE_TO_START_SEQUENCE = 0x18 | TE_DO_DISCONNECT
{TE_SCI_UNABLE_TO_START_SEQUENCE,"Could not start a sequence, because system resources are exumed or no sequence has been created"},
//TE_SCI_UNABLE_TO_REMOVE_SEQUENCE = 0x19 | TE_DO_DISCONNECT
{TE_SCI_UNABLE_TO_REMOVE_SEQUENCE,"Could not remove a sequence"},
//TE_SCI_UNABLE_TO_CREATE_SEQUENCE = 0x1a | TE_DO_DISCONNECT
{TE_SCI_UNABLE_TO_CREATE_SEQUENCE,"Could not create a sequence, because system resources are exempted. Must reboot"},
//TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR = 0x1b | TE_DO_DISCONNECT
{TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR,"Tried to send data on redundant link but failed"},
//TE_SCI_CANNOT_INIT_LOCALSEGMENT = 0x1c | TE_DO_DISCONNECT
{TE_SCI_CANNOT_INIT_LOCALSEGMENT,"Cannot initialize local segment"},
//TE_SCI_CANNOT_MAP_REMOTESEGMENT = 0x1d | TE_DO_DISCONNEC
{TE_SCI_CANNOT_MAP_REMOTESEGMENT,"Cannot map remote segment"},
//TE_SCI_UNABLE_TO_UNMAP_SEGMENT = 0x1e | TE_DO_DISCONNECT
{TE_SCI_UNABLE_TO_UNMAP_SEGMENT,"Cannot free the resources used by this segment (step 1)"},
//TE_SCI_UNABLE_TO_REMOVE_SEGMENT = 0x1f | TE_DO_DISCONNEC
{TE_SCI_UNABLE_TO_REMOVE_SEGMENT,"Cannot free the resources used by this segment (step 2)"},
//TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT = 0x20 | TE_DO_DISCONNECT
{TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT,"Cannot disconnect from a remote segment"},
//TE_SHM_IPC_PERMANENT = 0x21
{TE_SHM_IPC_PERMANENT,"Shm ipc Permanent error"},
//TE_SCI_UNABLE_TO_CLOSE_CHANNEL = 0x22
{TE_SCI_UNABLE_TO_CLOSE_CHANNEL,"Unable to close the sci channel and the resources allocated"}
};
lenth = sizeof(TransporterErrorString)/sizeof(struct myTransporterError);
for(i=0; i<lenth; i++)
{
if(theData[2] == TransporterErrorString[i].errorNum)
{
BaseString::snprintf(m_text, m_text_len,
"Transporter to node %d reported error: %s",
theData[1],
TransporterErrorString[i].errorString);
break;
}
}
if(i == lenth)
BaseString::snprintf(m_text, m_text_len,
"Transporter to node %d reported error: no such error",
theData[1]);
}
void getTextTransporterWarning(QQQQ) {
getTextTransporterError(m_text, m_text_len, theData);
......
......@@ -2405,6 +2405,18 @@ Backup::defineBackupRef(Signal* signal, BackupRecordPtr ptr, Uint32 errCode)
if(ptr.p->is_lcp())
{
jam();
if (ptr.p->ctlFilePtr == RNIL) {
ptr.p->m_gsn = GSN_DEFINE_BACKUP_REF;
ndbrequire(ptr.p->errorCode != 0);
DefineBackupRef* ref = (DefineBackupRef*)signal->getDataPtrSend();
ref->backupId = ptr.p->backupId;
ref->backupPtr = ptr.i;
ref->errorCode = ptr.p->errorCode;
ref->nodeId = getOwnNodeId();
sendSignal(ptr.p->masterRef, GSN_DEFINE_BACKUP_REF, signal,
DefineBackupRef::SignalLength, JBB);
return;
}
BackupFilePtr filePtr LINT_SET_PTR;
ptr.p->files.getPtr(filePtr, ptr.p->ctlFilePtr);
......
......@@ -582,6 +582,26 @@ Dblqh::execDEFINE_BACKUP_REF(Signal* signal)
{
jamEntry();
m_backup_ptr = RNIL;
DefineBackupRef* ref = (DefineBackupRef*)signal->getDataPtrSend();
int err_code = 0;
char * extra_msg = NULL;
switch(ref->errorCode){
case DefineBackupRef::Undefined:
case DefineBackupRef::FailedToSetupFsBuffers:
case DefineBackupRef::FailedToAllocateBuffers:
case DefineBackupRef::FailedToAllocateTables:
case DefineBackupRef::FailedAllocateTableMem:
case DefineBackupRef::FailedToAllocateFileRecord:
case DefineBackupRef::FailedToAllocateAttributeRecord:
case DefineBackupRef::FailedInsertFileHeader:
case DefineBackupRef::FailedInsertTableList:
jam();
err_code = NDBD_EXIT_INVALID_CONFIG;
extra_msg = "Probably Backup parameters configuration error, Please consult the manual";
progError(__LINE__, err_code, extra_msg);
}
sendsttorryLab(signal);
}
......
......@@ -2057,6 +2057,18 @@ CommandInterpreter::executeStatus(int processId,
ndbout << processId << ": Node not found" << endl;
return -1;
}
if (cl->node_states[i].node_type != NDB_MGM_NODE_TYPE_NDB){
if (cl->node_states[i].version != 0){
ndbout << "Node "<< cl->node_states[i].node_id <<": connected" ;
ndbout_c(" (Version %d.%d.%d)",
getMajor(version) ,
getMinor(version),
getBuild(version));
}else
ndbout << "Node "<< cl->node_states[i].node_id <<": not connected" << endl;
return 0;
}
status = cl->node_states[i].node_status;
startPhase = cl->node_states[i].start_phase;
version = cl->node_states[i].version;
......
......@@ -3615,6 +3615,7 @@ check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>&sections,
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){
......@@ -3650,83 +3651,90 @@ check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>&sections,
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"
......
......@@ -131,8 +131,6 @@ bool g_StopServer;
bool g_RestartServer;
extern EventLogger g_eventLogger;
extern int global_mgmt_server_check;
enum ndb_mgmd_options {
OPT_INTERACTIVE = NDB_STD_OPTIONS_LAST,
OPT_NO_NODEID_CHECKS,
......@@ -207,8 +205,6 @@ int main(int argc, char** argv)
start:
glob= new MgmGlobals;
global_mgmt_server_check = 1;
if (opt_interactive ||
opt_non_interactive ||
g_print_full_config) {
......
......@@ -360,8 +360,6 @@ ClusterMgr::execAPI_REGREQ(const Uint32 * theData){
theFacade.sendSignalUnCond(&signal, nodeId);
}
int global_mgmt_server_check = 0; // set to one in mgmtsrvr main;
void
ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
const ApiRegConf * const apiRegConf = (ApiRegConf *)&theData[0];
......@@ -379,7 +377,7 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
if(node.m_info.m_version != apiRegConf->version){
node.m_info.m_version = apiRegConf->version;
if (global_mgmt_server_check == 1)
if(theNodes[theFacade.ownId()].m_info.m_type == NodeInfo::MGM)
node.compatible = ndbCompatible_mgmt_ndb(NDB_VERSION,
node.m_info.m_version);
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment