Below is the list of changes that have just been committed into a local
5.0 repository of stewart. When stewart 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
1.2190 06/06/20 18:27:54 stewart@stripped +3 -0
Merge mysql.com:/home/stewart/Documents/MySQL/5.0/main
into mysql.com:/home/stewart/Documents/MySQL/5.0/bugsmerge
ndb/src/mgmsrv/MgmtSrvr.cpp
1.101 06/06/20 18:27:46 stewart@stripped +0 -0
Auto merged
ndb/src/mgmsrv/ConfigInfo.cpp
1.75 06/06/20 18:27:46 stewart@stripped +0 -0
Auto merged
ndb/src/mgmapi/mgmapi.cpp
1.60 06/06/20 18:27:46 stewart@stripped +0 -0
Auto merged
# 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: stewart
# Host: willster.(none)
# Root: /home/stewart/Documents/MySQL/5.0/bugsmerge/RESYNC
--- 1.74/ndb/src/mgmsrv/ConfigInfo.cpp 2006-06-08 02:31:53 +10:00
+++ 1.75/ndb/src/mgmsrv/ConfigInfo.cpp 2006-06-20 18:27:46 +10:00
@@ -1199,7 +1199,19 @@
false,
ConfigInfo::CI_INT,
"32K",
- "0",
+ "2K",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
+ CFG_DB_BACKUP_MAX_WRITE_SIZE,
+ "BackupMaxWriteSize",
+ DB_TOKEN,
+ "Max size of filesystem writes made by backup (in bytes)",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "256K",
+ "2K",
STR_VALUE(MAX_INT_RNIL) },
/***************************************************************************
--- 1.59/ndb/src/mgmapi/mgmapi.cpp 2006-04-25 08:59:30 +10:00
+++ 1.60/ndb/src/mgmapi/mgmapi.cpp 2006-06-20 18:27:46 +10:00
@@ -27,6 +27,7 @@
#include <mgmapi_debug.h>
#include "mgmapi_configuration.hpp"
#include <socket_io.h>
+#include <version.h>
#include <NdbOut.hpp>
#include <SocketServer.hpp>
@@ -103,6 +104,9 @@
#endif
FILE *errstream;
char *m_name;
+ int mgmd_version_major;
+ int mgmd_version_minor;
+ int mgmd_version_build;
};
#define SET_ERROR(h, e, s) setError(h, e, __LINE__, s)
@@ -168,6 +172,10 @@
h->logfile = 0;
#endif
+ h->mgmd_version_major= -1;
+ h->mgmd_version_minor= -1;
+ h->mgmd_version_build= -1;
+
DBUG_PRINT("info", ("handle=0x%x", (UintPtr)h));
DBUG_RETURN(h);
}
@@ -361,8 +369,9 @@
* Print some info about why the parser returns NULL
*/
fprintf(handle->errstream,
- "Error in mgm protocol parser. cmd: >%s< status: %d curr: %d\n",
- cmd, (Uint32)ctx.m_status, ctx.m_currentToken);
+ "Error in mgm protocol parser. cmd: >%s< status: %d curr: %s\n",
+ cmd, (Uint32)ctx.m_status,
+ (ctx.m_currentToken)?ctx.m_currentToken:"NULL");
DBUG_PRINT("info",("ctx.status: %d, ctx.m_currentToken: %s",
ctx.m_status, ctx.m_currentToken));
}
@@ -678,7 +687,11 @@
out.println("");
char buf[1024];
- in.gets(buf, sizeof(buf));
+ if(!in.gets(buf, sizeof(buf)))
+ {
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected");
+ return NULL;
+ }
if(buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = '\0';
@@ -687,7 +700,11 @@
return NULL;
}
- in.gets(buf, sizeof(buf));
+ if(!in.gets(buf, sizeof(buf)))
+ {
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected");
+ return NULL;
+ }
if(buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = '\0';
@@ -695,10 +712,12 @@
Vector<BaseString> split;
tmp.split(split, ":");
if(split.size() != 2){
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf);
return NULL;
}
if(!(split[0].trim() == "nodes")){
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf);
return NULL;
}
@@ -708,6 +727,13 @@
malloc(sizeof(ndb_mgm_cluster_state)+
noOfNodes*(sizeof(ndb_mgm_node_state)+sizeof("000.000.000.000#")));
+ if(!state)
+ {
+ SET_ERROR(handle, NDB_MGM_OUT_OF_MEMORY,
+ "Allocating ndb_mgm_cluster_state");
+ return NULL;
+ }
+
state->no_of_nodes= noOfNodes;
ndb_mgm_node_state * ptr = &state->node_states[0];
int nodeId = 0;
@@ -717,7 +743,13 @@
}
i = -1; ptr--;
for(; i<noOfNodes; ){
- in.gets(buf, sizeof(buf));
+ if(!in.gets(buf, sizeof(buf)))
+ {
+ free(state);
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY,
+ "Probably disconnected");
+ return NULL;
+ }
tmp.assign(buf);
if(tmp.trim() == ""){
@@ -746,6 +778,7 @@
if(i+1 != noOfNodes){
free(state);
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, "Node count mismatch");
return NULL;
}
@@ -826,37 +859,81 @@
return ndb_mgm_stop2(handle, no_of_nodes, node_list, 0);
}
-
extern "C"
-int
+int
ndb_mgm_stop2(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
int abort)
{
- SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop2");
- const ParserRow<ParserDummy> stop_reply[] = {
+ int disconnect;
+ return ndb_mgm_stop3(handle, no_of_nodes, node_list, abort, &disconnect);
+}
+
+
+extern "C"
+int
+ndb_mgm_stop3(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
+ int abort, int *disconnect)
+{
+ SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop3");
+ const ParserRow<ParserDummy> stop_reply_v1[] = {
+ MGM_CMD("stop reply", NULL, ""),
+ MGM_ARG("stopped", Int, Optional, "No of stopped nodes"),
+ MGM_ARG("result", String, Mandatory, "Error message"),
+ MGM_END()
+ };
+ const ParserRow<ParserDummy> stop_reply_v2[] = {
MGM_CMD("stop reply", NULL, ""),
MGM_ARG("stopped", Int, Optional, "No of stopped nodes"),
MGM_ARG("result", String, Mandatory, "Error message"),
+ MGM_ARG("disconnect", Int, Mandatory, "Need to disconnect"),
MGM_END()
};
+
CHECK_HANDLE(handle, -1);
CHECK_CONNECTED(handle, -1);
- if(no_of_nodes < 0){
+ if(handle->mgmd_version_build==-1)
+ {
+ char verstr[50];
+ if(!ndb_mgm_get_version(handle,
+ &(handle->mgmd_version_major),
+ &(handle->mgmd_version_minor),
+ &(handle->mgmd_version_build),
+ sizeof(verstr),
+ verstr))
+ {
+ return -1;
+ }
+ }
+ int use_v2= ((handle->mgmd_version_major==5)
+ && (
+ (handle->mgmd_version_minor==0 && handle->mgmd_version_build>=21)
+ ||(handle->mgmd_version_minor==1 && handle->mgmd_version_build>=12)
+ ||(handle->mgmd_version_minor>1)
+ )
+ )
+ || (handle->mgmd_version_major>5);
+
+ if(no_of_nodes < -1){
SET_ERROR(handle, NDB_MGM_ILLEGAL_NUMBER_OF_NODES,
"Negative number of nodes requested to stop");
return -1;
}
Uint32 stoppedNoOfNodes = 0;
- if(no_of_nodes == 0){
+ if(no_of_nodes <= 0){
/**
- * All database nodes should be stopped
+ * All nodes should be stopped (all or just db)
*/
Properties args;
args.put("abort", abort);
+ if(use_v2)
+ args.put("stop", (no_of_nodes==-1)?"mgm,db":"db");
const Properties *reply;
- reply = ndb_mgm_call(handle, stop_reply, "stop all", &args);
+ if(use_v2)
+ reply = ndb_mgm_call(handle, stop_reply_v2, "stop all", &args);
+ else
+ reply = ndb_mgm_call(handle, stop_reply_v1, "stop all", &args);
CHECK_REPLY(reply, -1);
if(!reply->get("stopped", &stoppedNoOfNodes)){
@@ -865,6 +942,10 @@
delete reply;
return -1;
}
+ if(use_v2)
+ reply->get("disconnect", (Uint32*)disconnect);
+ else
+ *disconnect= 0;
BaseString result;
reply->get("result", result);
if(strcmp(result.c_str(), "Ok") != 0) {
@@ -890,7 +971,11 @@
args.put("abort", abort);
const Properties *reply;
- reply = ndb_mgm_call(handle, stop_reply, "stop", &args);
+ if(use_v2)
+ reply = ndb_mgm_call(handle, stop_reply_v2, "stop v2", &args);
+ else
+ reply = ndb_mgm_call(handle, stop_reply_v1, "stop", &args);
+
CHECK_REPLY(reply, stoppedNoOfNodes);
if(!reply->get("stopped", &stoppedNoOfNodes)){
SET_ERROR(handle, NDB_MGM_STOP_FAILED,
@@ -898,6 +983,10 @@
delete reply;
return -1;
}
+ if(use_v2)
+ reply->get("disconnect", (Uint32*)disconnect);
+ else
+ *disconnect= 0;
BaseString result;
reply->get("result", result);
if(strcmp(result.c_str(), "Ok") != 0) {
@@ -911,20 +1000,69 @@
extern "C"
int
+ndb_mgm_restart(NdbMgmHandle handle, int no_of_nodes, const int *node_list)
+{
+ SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart");
+ return ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0);
+}
+
+extern "C"
+int
ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
int initial, int nostart, int abort)
{
- SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart2");
+ int disconnect;
+
+ return ndb_mgm_restart3(handle, no_of_nodes, node_list, initial, nostart,
+ abort, &disconnect);
+}
+
+extern "C"
+int
+ndb_mgm_restart3(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
+ int initial, int nostart, int abort, int *disconnect)
+{
+ SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart3");
Uint32 restarted = 0;
- const ParserRow<ParserDummy> restart_reply[] = {
+ const ParserRow<ParserDummy> restart_reply_v1[] = {
MGM_CMD("restart reply", NULL, ""),
MGM_ARG("result", String, Mandatory, "Error message"),
MGM_ARG("restarted", Int, Optional, "No of restarted nodes"),
MGM_END()
};
+ const ParserRow<ParserDummy> restart_reply_v2[] = {
+ MGM_CMD("restart reply", NULL, ""),
+ MGM_ARG("result", String, Mandatory, "Error message"),
+ MGM_ARG("restarted", Int, Optional, "No of restarted nodes"),
+ MGM_ARG("disconnect", Int, Optional, "Disconnect to apply"),
+ MGM_END()
+ };
+
CHECK_HANDLE(handle, -1);
CHECK_CONNECTED(handle, -1);
-
+
+ if(handle->mgmd_version_build==-1)
+ {
+ char verstr[50];
+ if(!ndb_mgm_get_version(handle,
+ &(handle->mgmd_version_major),
+ &(handle->mgmd_version_minor),
+ &(handle->mgmd_version_build),
+ sizeof(verstr),
+ verstr))
+ {
+ return -1;
+ }
+ }
+ int use_v2= ((handle->mgmd_version_major==5)
+ && (
+ (handle->mgmd_version_minor==0 && handle->mgmd_version_build>=21)
+ ||(handle->mgmd_version_minor==1 && handle->mgmd_version_build>=12)
+ ||(handle->mgmd_version_minor>1)
+ )
+ )
+ || (handle->mgmd_version_major>5);
+
if(no_of_nodes < 0){
SET_ERROR(handle, NDB_MGM_RESTART_FAILED,
"Restart requested of negative number of nodes");
@@ -939,7 +1077,7 @@
const Properties *reply;
const int timeout = handle->read_timeout;
handle->read_timeout= 5*60*1000; // 5 minutes
- reply = ndb_mgm_call(handle, restart_reply, "restart all", &args);
+ reply = ndb_mgm_call(handle, restart_reply_v1, "restart all", &args);
handle->read_timeout= timeout;
CHECK_REPLY(reply, -1);
@@ -975,7 +1113,10 @@
const Properties *reply;
const int timeout = handle->read_timeout;
handle->read_timeout= 5*60*1000; // 5 minutes
- reply = ndb_mgm_call(handle, restart_reply, "restart node", &args);
+ if(use_v2)
+ reply = ndb_mgm_call(handle, restart_reply_v2, "restart node v2", &args);
+ else
+ reply = ndb_mgm_call(handle, restart_reply_v1, "restart node", &args);
handle->read_timeout= timeout;
if(reply != NULL) {
BaseString result;
@@ -986,20 +1127,16 @@
return -1;
}
reply->get("restarted", &restarted);
+ if(use_v2)
+ reply->get("disconnect", (Uint32*)disconnect);
+ else
+ *disconnect= 0;
delete reply;
}
return restarted;
}
-extern "C"
-int
-ndb_mgm_restart(NdbMgmHandle handle, int no_of_nodes, const int *node_list)
-{
- SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart");
- return ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0);
-}
-
static const char *clusterlog_severity_names[]=
{ "enabled", "debug", "info", "warning", "error", "critical", "alert" };
@@ -1868,7 +2005,8 @@
extern "C"
int
-ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype)
+ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype,
+ int log_event)
{
CHECK_HANDLE(handle, 0);
CHECK_CONNECTED(handle, 0);
@@ -1888,9 +2026,11 @@
args.put("endian", (endian_check.c[sizeof(long)-1])?"big":"little");
if (handle->m_name)
args.put("name", handle->m_name);
+ args.put("log_event", log_event);
const ParserRow<ParserDummy> reply[]= {
MGM_CMD("get nodeid reply", NULL, ""),
+ MGM_ARG("error_code", Int, Optional, "Error code"),
MGM_ARG("nodeid", Int, Optional, "Error message"),
MGM_ARG("result", String, Mandatory, "Error message"),
MGM_END()
@@ -1903,14 +2043,16 @@
nodeid= -1;
do {
const char * buf;
- if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
+ if (!prop->get("result", &buf) || strcmp(buf, "Ok") != 0)
+ {
const char *hostname= ndb_mgm_get_connected_host(handle);
unsigned port= ndb_mgm_get_connected_port(handle);
BaseString err;
+ Uint32 error_code= NDB_MGM_ALLOCID_ERROR;
err.assfmt("Could not alloc node id at %s port %d: %s",
hostname, port, buf);
- setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__,
- err.c_str());
+ prop->get("error_code", &error_code);
+ setError(handle, error_code, __LINE__, err.c_str());
break;
}
Uint32 _nodeid;
@@ -2351,6 +2493,58 @@
in.gets(buf, sizeof(buf));
DBUG_RETURN(0);
+}
+
+extern "C"
+int ndb_mgm_get_version(NdbMgmHandle handle,
+ int *major, int *minor, int *build, int len, char* str)
+{
+ DBUG_ENTER("ndb_mgm_get_version");
+ CHECK_HANDLE(handle, 0);
+ CHECK_CONNECTED(handle, 0);
+
+ Properties args;
+
+ const ParserRow<ParserDummy> reply[]= {
+ MGM_CMD("version", NULL, ""),
+ MGM_ARG("id", Int, Mandatory, "ID"),
+ MGM_ARG("major", Int, Mandatory, "Major"),
+ MGM_ARG("minor", Int, Mandatory, "Minor"),
+ MGM_ARG("string", String, Mandatory, "String"),
+ MGM_END()
+ };
+
+ const Properties *prop;
+ prop = ndb_mgm_call(handle, reply, "get version", &args);
+ CHECK_REPLY(prop, 0);
+
+ Uint32 id;
+ if(!prop->get("id",&id)){
+ fprintf(handle->errstream, "Unable to get value\n");
+ return 0;
+ }
+ *build= getBuild(id);
+
+ if(!prop->get("major",(Uint32*)major)){
+ fprintf(handle->errstream, "Unable to get value\n");
+ return 0;
+ }
+
+ if(!prop->get("minor",(Uint32*)minor)){
+ fprintf(handle->errstream, "Unable to get value\n");
+ return 0;
+ }
+
+ BaseString result;
+ if(!prop->get("string", result)){
+ fprintf(handle->errstream, "Unable to get value\n");
+ return 0;
+ }
+
+ strncpy(str, result.c_str(), len);
+
+ delete prop;
+ DBUG_RETURN(1);
}
template class Vector<const ParserRow<ParserDummy>*>;
--- 1.100/ndb/src/mgmsrv/MgmtSrvr.cpp 2006-06-16 21:00:57 +10:00
+++ 1.101/ndb/src/mgmsrv/MgmtSrvr.cpp 2006-06-20 18:27:46 +10:00
@@ -1863,7 +1863,7 @@
break;
case GSN_EVENT_REP:
{
- EventReport *rep = CAST_PTR(EventReport, signal->getDataPtrSend());
+ EventReport *rep = (EventReport*) signal->getDataPtr();
if (rep->getNodeId() == 0)
rep->setNodeId(refToNode(signal->theSendersBlockRef));
eventReport(signal->getDataPtr());
| Thread |
|---|
| • bk commit into 5.0 tree (stewart:1.2190) | Stewart Smith | 20 Jun |