Commit 0a3c9abe authored by unknown's avatar unknown

Merge mysql.com:/home/jonas/src/mysql-5.0

into  mysql.com:/home/jonas/src/mysql-5.0-push

parents 0eea2a12 281ca81e
ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3, mysqld,4, mysqld,5, mysqld,6, mysqld,7,
1,localhost,41943040,12582912 2,localhost,41943040,12582912
1 localhost 41943040 12582912
2 localhost 41943040 12582912
1 2
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults -r \\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --type=ndbd --host=localhost 2> /dev/null
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
* @{ * @{
*/ */
#include <stdio.h>
#include <ndb_types.h> #include <ndb_types.h>
#include "ndb_logevent.h" #include "ndb_logevent.h"
#include "mgmapi_config_parameters.h" #include "mgmapi_config_parameters.h"
...@@ -441,6 +442,12 @@ extern "C" { ...@@ -441,6 +442,12 @@ extern "C" {
int ndb_mgm_get_latest_error_line(const NdbMgmHandle handle); int ndb_mgm_get_latest_error_line(const NdbMgmHandle handle);
#endif #endif
/**
* Set error stream
*/
void ndb_mgm_set_error_stream(NdbMgmHandle, FILE *);
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
* @name Functions: Create/Destroy Management Server Handles * @name Functions: Create/Destroy Management Server Handles
......
...@@ -101,6 +101,7 @@ struct ndb_mgm_handle { ...@@ -101,6 +101,7 @@ struct ndb_mgm_handle {
#ifdef MGMAPI_LOG #ifdef MGMAPI_LOG
FILE* logfile; FILE* logfile;
#endif #endif
FILE *errstream;
}; };
#define SET_ERROR(h, e, s) setError(h, e, __LINE__, s) #define SET_ERROR(h, e, s) setError(h, e, __LINE__, s)
...@@ -154,6 +155,7 @@ ndb_mgm_create_handle() ...@@ -154,6 +155,7 @@ ndb_mgm_create_handle()
h->read_timeout = 50000; h->read_timeout = 50000;
h->write_timeout = 100; h->write_timeout = 100;
h->cfg_i = -1; h->cfg_i = -1;
h->errstream = stdout;
strncpy(h->last_error_desc, "No error", NDB_MGM_MAX_ERR_DESC_SIZE); strncpy(h->last_error_desc, "No error", NDB_MGM_MAX_ERR_DESC_SIZE);
...@@ -219,6 +221,13 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle) ...@@ -219,6 +221,13 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
extern "C"
void
ndb_mgm_set_error_stream(NdbMgmHandle handle, FILE * file)
{
handle->errstream = file;
}
/***************************************************************************** /*****************************************************************************
* Error handling * Error handling
*****************************************************************************/ *****************************************************************************/
...@@ -329,11 +338,8 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply, ...@@ -329,11 +338,8 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply,
/** /**
* Print some info about why the parser returns NULL * Print some info about why the parser returns NULL
*/ */
ndbout << "Error in mgm protocol parser. " fprintf(h->errstream, "Error in mgm protocol parser. cmd: >%s< status: %d cyrr: %d\n",
<< "cmd: '" << cmd cmd, (Uint32)ctx.m_status, ctx.m_currentToken);
<< "' status=" << (Uint32)ctx.m_status
<< ", curr=" << ctx.m_currentToken
<< endl;
DBUG_PRINT("info",("ctx.status: %d, ctx.m_currentToken: %s", DBUG_PRINT("info",("ctx.status: %d, ctx.m_currentToken: %s",
ctx.m_status, ctx.m_currentToken)); ctx.m_status, ctx.m_currentToken));
} }
...@@ -409,7 +415,7 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries, ...@@ -409,7 +415,7 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries,
#endif #endif
if (verbose > 0) { if (verbose > 0) {
char buf[1024]; char buf[1024];
ndbout_c("Unable to connect with connect string: %s", fprintf(handle->errstream, "Unable to connect with connect string: %s\n",
cfg.makeConnectString(buf,sizeof(buf))); cfg.makeConnectString(buf,sizeof(buf)));
verbose= -1; verbose= -1;
} }
...@@ -419,30 +425,33 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries, ...@@ -419,30 +425,33 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries,
"Unable to connect with connect string: %s", "Unable to connect with connect string: %s",
cfg.makeConnectString(buf,sizeof(buf))); cfg.makeConnectString(buf,sizeof(buf)));
if (verbose == -2) if (verbose == -2)
ndbout << ", failed." << endl; fprintf(handle->errstream, ", failed.\n");
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (verbose == -1) { if (verbose == -1) {
ndbout << "Retrying every " << retry_delay_in_seconds << " seconds"; fprintf(handle->errstream, "Retrying every %d seconds",
retry_delay_in_seconds);
if (no_retries > 0) if (no_retries > 0)
ndbout << ". Attempts left:"; fprintf(handle->errstream, ". Attempts left:");
else else
ndbout << ", until connected.";; fprintf(handle->errstream, ", until connected.");
ndbout << flush; fflush(handle->errstream);
verbose= -2; verbose= -2;
} }
if (no_retries > 0) { if (no_retries > 0) {
if (verbose == -2) { if (verbose == -2) {
ndbout << " " << no_retries; fprintf(handle->errstream, " %d", no_retries);
ndbout << flush; fflush(handle->errstream);
} }
no_retries--; no_retries--;
} }
NdbSleep_SecSleep(retry_delay_in_seconds); NdbSleep_SecSleep(retry_delay_in_seconds);
} }
if (verbose == -2) if (verbose == -2)
ndbout << endl; {
fprintf(handle->errstream, "\n");
fflush(handle->errstream);
}
handle->cfg_i = i; handle->cfg_i = i;
handle->socket = sockfd; handle->socket = sockfd;
...@@ -496,6 +505,8 @@ ndb_mgm_match_node_type(const char * type) ...@@ -496,6 +505,8 @@ ndb_mgm_match_node_type(const char * type)
for(int i = 0; i<no_of_type_values; i++) for(int i = 0; i<no_of_type_values; i++)
if(strcmp(type, type_values[i].str) == 0) if(strcmp(type, type_values[i].str) == 0)
return type_values[i].value; return type_values[i].value;
else if(strcmp(type, type_values[i].alias) == 0)
return type_values[i].value;
return NDB_MGM_NODE_TYPE_UNKNOWN; return NDB_MGM_NODE_TYPE_UNKNOWN;
} }
...@@ -1705,28 +1716,28 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) { ...@@ -1705,28 +1716,28 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) {
do { do {
const char * buf; const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
ndbout_c("ERROR Message: %s\n", buf); fprintf(handle->errstream, "ERROR Message: %s\n\n", buf);
break; break;
} }
buf = "<Unspecified>"; buf = "<Unspecified>";
if(!prop->get("Content-Type", &buf) || if(!prop->get("Content-Type", &buf) ||
strcmp(buf, "ndbconfig/octet-stream") != 0){ strcmp(buf, "ndbconfig/octet-stream") != 0){
ndbout_c("Unhandled response type: %s", buf); fprintf(handle->errstream, "Unhandled response type: %s\n", buf);
break; break;
} }
buf = "<Unspecified>"; buf = "<Unspecified>";
if(!prop->get("Content-Transfer-Encoding", &buf) if(!prop->get("Content-Transfer-Encoding", &buf)
|| strcmp(buf, "base64") != 0){ || strcmp(buf, "base64") != 0){
ndbout_c("Unhandled encoding: %s", buf); fprintf(handle->errstream, "Unhandled encoding: %s\n", buf);
break; break;
} }
buf = "<Content-Length Unspecified>"; buf = "<Content-Length Unspecified>";
Uint32 len = 0; Uint32 len = 0;
if(!prop->get("Content-Length", &len)){ if(!prop->get("Content-Length", &len)){
ndbout_c("Invalid response: %s\n", buf); fprintf(handle->errstream, "Invalid response: %s\n\n", buf);
break; break;
} }
...@@ -1751,14 +1762,14 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) { ...@@ -1751,14 +1762,14 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) {
const int res = base64_decode(buf64, len-1, tmp); const int res = base64_decode(buf64, len-1, tmp);
delete[] buf64; delete[] buf64;
if(res != 0){ if(res != 0){
ndbout_c("Failed to decode buffer"); fprintf(handle->errstream, "Failed to decode buffer\n");
break; break;
} }
ConfigValuesFactory cvf; ConfigValuesFactory cvf;
const int res2 = cvf.unpack(tmp); const int res2 = cvf.unpack(tmp);
if(!res2){ if(!res2){
ndbout_c("Failed to unpack buffer"); fprintf(handle->errstream, "Failed to unpack buffer\n");
break; break;
} }
...@@ -1868,7 +1879,7 @@ ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype) ...@@ -1868,7 +1879,7 @@ ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype)
} }
Uint32 _nodeid; Uint32 _nodeid;
if(!prop->get("nodeid", &_nodeid) != 0){ if(!prop->get("nodeid", &_nodeid) != 0){
ndbout_c("ERROR Message: <nodeid Unspecified>\n"); fprintf(handle->errstream, "ERROR Message: <nodeid Unspecified>\n");
break; break;
} }
nodeid= _nodeid; nodeid= _nodeid;
...@@ -1944,7 +1955,7 @@ ndb_mgm_set_int_parameter(NdbMgmHandle handle, ...@@ -1944,7 +1955,7 @@ ndb_mgm_set_int_parameter(NdbMgmHandle handle,
do { do {
const char * buf; const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
ndbout_c("ERROR Message: %s\n", buf); fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break; break;
} }
res= 0; res= 0;
...@@ -1987,7 +1998,7 @@ ndb_mgm_set_int64_parameter(NdbMgmHandle handle, ...@@ -1987,7 +1998,7 @@ ndb_mgm_set_int64_parameter(NdbMgmHandle handle,
do { do {
const char * buf; const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
ndbout_c("ERROR Message: %s\n", buf); fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break; break;
} }
res= 0; res= 0;
...@@ -2030,7 +2041,7 @@ ndb_mgm_set_string_parameter(NdbMgmHandle handle, ...@@ -2030,7 +2041,7 @@ ndb_mgm_set_string_parameter(NdbMgmHandle handle,
do { do {
const char * buf; const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
ndbout_c("ERROR Message: %s\n", buf); fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break; break;
} }
res= 0; res= 0;
...@@ -2067,7 +2078,7 @@ ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **purged){ ...@@ -2067,7 +2078,7 @@ ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **purged){
do { do {
const char * buf; const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
ndbout_c("ERROR Message: %s\n", buf); fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break; break;
} }
if (purged) { if (purged) {
...@@ -2149,7 +2160,7 @@ ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle, ...@@ -2149,7 +2160,7 @@ ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle,
do { do {
const char * buf; const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
ndbout_c("ERROR Message: %s\n", buf); fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break; break;
} }
res= 0; res= 0;
...@@ -2191,14 +2202,14 @@ ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle, ...@@ -2191,14 +2202,14 @@ ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle,
do { do {
const char * buf; const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){ if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
ndbout_c("ERROR Message: %s\n", buf); fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break; break;
} }
res= 0; res= 0;
} while(0); } while(0);
if(!prop->get("value",(Uint32*)value)){ if(!prop->get("value",(Uint32*)value)){
ndbout_c("Unable to get value"); fprintf(handle->errstream, "Unable to get value\n");
res = -4; res = -4;
} }
...@@ -2250,7 +2261,7 @@ ndb_mgm_get_mgmd_nodeid(NdbMgmHandle handle) ...@@ -2250,7 +2261,7 @@ ndb_mgm_get_mgmd_nodeid(NdbMgmHandle handle)
CHECK_REPLY(prop, 0); CHECK_REPLY(prop, 0);
if(!prop->get("nodeid",&nodeid)){ if(!prop->get("nodeid",&nodeid)){
ndbout_c("Unable to get value"); fprintf(handle->errstream, "Unable to get value\n");
return 0; return 0;
} }
......
...@@ -127,14 +127,14 @@ private: ...@@ -127,14 +127,14 @@ private:
Properties m_info; Properties m_info;
Properties m_systemDefaults; Properties m_systemDefaults;
static const ParamInfo m_ParamInfo[];
static const int m_NoOfParams;
static const AliasPair m_sectionNameAliases[]; static const AliasPair m_sectionNameAliases[];
static const char* m_sectionNames[]; static const char* m_sectionNames[];
static const int m_noOfSectionNames; static const int m_noOfSectionNames;
public: public:
static const ParamInfo m_ParamInfo[];
static const int m_NoOfParams;
static const SectionRule m_SectionRules[]; static const SectionRule m_SectionRules[];
static const ConfigRule m_ConfigRules[]; static const ConfigRule m_ConfigRules[];
static const int m_NoOfRules; static const int m_NoOfRules;
......
...@@ -9,7 +9,7 @@ ndbtools_PROGRAMS = \ ...@@ -9,7 +9,7 @@ ndbtools_PROGRAMS = \
ndb_show_tables \ ndb_show_tables \
ndb_select_all \ ndb_select_all \
ndb_select_count \ ndb_select_count \
ndb_restore ndb_restore ndb_config
tools_common_sources = ../test/src/NDBT_ReturnCodes.cpp \ tools_common_sources = ../test/src/NDBT_ReturnCodes.cpp \
../test/src/NDBT_Table.cpp \ ../test/src/NDBT_Table.cpp \
...@@ -33,6 +33,17 @@ ndb_restore_SOURCES = restore/restore_main.cpp \ ...@@ -33,6 +33,17 @@ ndb_restore_SOURCES = restore/restore_main.cpp \
restore/Restore.cpp \ restore/Restore.cpp \
../test/src/NDBT_ResultRow.cpp $(tools_common_sources) ../test/src/NDBT_ResultRow.cpp $(tools_common_sources)
ndb_config_SOURCES = config.cpp \
../src/mgmsrv/Config.cpp \
../src/mgmsrv/ConfigInfo.cpp \
../src/mgmsrv/InitConfigFileParser.cpp
ndb_config_CXXFLAGS = -I$(top_srcdir)/ndb/src/mgmapi \
-I$(top_srcdir)/ndb/src/mgmsrv \
-I$(top_srcdir)/ndb/include/mgmcommon \
-DMYSQLCLUSTERDIR="\"\""
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapitools.mk.am include $(top_srcdir)/ndb/config/type_ndbapitools.mk.am
...@@ -46,6 +57,7 @@ ndb_show_tables_LDFLAGS = @ndb_bin_am_ldflags@ ...@@ -46,6 +57,7 @@ ndb_show_tables_LDFLAGS = @ndb_bin_am_ldflags@
ndb_select_all_LDFLAGS = @ndb_bin_am_ldflags@ ndb_select_all_LDFLAGS = @ndb_bin_am_ldflags@
ndb_select_count_LDFLAGS = @ndb_bin_am_ldflags@ ndb_select_count_LDFLAGS = @ndb_bin_am_ldflags@
ndb_restore_LDFLAGS = @ndb_bin_am_ldflags@ ndb_restore_LDFLAGS = @ndb_bin_am_ldflags@
ndb_config_LDFLAGS = @ndb_bin_am_ldflags@
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%
......
This diff is collapsed.
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