Commit 8c171be8 authored by unknown's avatar unknown

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

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


ndb/src/mgmapi/mgmapi.cpp:
  Auto merged
ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
ndb/src/mgmsrv/ConfigInfo.hpp:
  Auto merged
parents 24d1c004 3f34de0b
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
......@@ -49,6 +49,7 @@
* @{
*/
#include <stdio.h>
#include <ndb_types.h>
#include "mgmapi_config_parameters.h"
......@@ -351,6 +352,12 @@ extern "C" {
int ndb_mgm_get_latest_error_line(const NdbMgmHandle handle);
#endif
/**
* Set error stream
*/
void ndb_mgm_set_error_stream(NdbMgmHandle, FILE *);
/** @} *********************************************************************/
/**
* @name Functions: Create/Destroy Management Server Handles
......
......@@ -50,8 +50,11 @@
#define CFG_DB_FILESYSTEM_PATH 125
#define CFG_DB_NO_REDOLOG_FILES 126
#define CFG_DB_DISC_BANDWIDTH 127
#define CFG_DB_SR_DISC_BANDWITH 128
#define CFG_DB_LCP_DISC_PAGES_TUP 127
#define CFG_DB_LCP_DISC_PAGES_TUP_SR 128
#define CFG_DB_LCP_DISC_PAGES_ACC 137
#define CFG_DB_LCP_DISC_PAGES_ACC_SR 138
#define CFG_DB_TRANSACTION_CHECK_INTERVAL 129
#define CFG_DB_TRANSACTION_INACTIVE_TIMEOUT 130
......
......@@ -722,10 +722,12 @@ void Dbacc::execREAD_CONFIG_REQ(Signal* signal)
ndbrestart1Lab(signal);
clblPagesPerTick = 50;
//ndb_mgm_get_int_parameter(p, CFG_DB_, &clblPagesPerTick);
ndb_mgm_get_int_parameter(p, CFG_DB_LCP_DISC_PAGES_ACC_SR,
&clblPagesPerTick);
clblPagesPerTickAfterSr = 50;
//ndb_mgm_get_int_parameter(p, CFG_DB_, &clblPagesPerTickAfterSr);
ndb_mgm_get_int_parameter(p, CFG_DB_LCP_DISC_PAGES_ACC,
&clblPagesPerTickAfterSr);
tdata0 = 0;
initialiseRecordsLab(signal, ref, senderData);
......
......@@ -663,10 +663,12 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
initialiseRecordsLab(signal, 0, ref, senderData);
clblPagesPerTick = 50;
//ndb_mgm_get_int_parameter(p, CFG_DB_, &clblPagesPerTick);
ndb_mgm_get_int_parameter(p, CFG_DB_LCP_DISC_PAGES_TUP_SR,
&clblPagesPerTick);
clblPagesPerTickAfterSr = 50;
//ndb_mgm_get_int_parameter(p, CFG_DB_, &clblPagesPerTickAfterSr);
ndb_mgm_get_int_parameter(p, CFG_DB_LCP_DISC_PAGES_TUP,
&clblPagesPerTickAfterSr);
}//Dbtup::execSIZEALT_REP()
......
......@@ -100,6 +100,7 @@ struct ndb_mgm_handle {
#ifdef MGMAPI_LOG
FILE* logfile;
#endif
FILE *errstream;
};
#define SET_ERROR(h, e, s) setError(h, e, __LINE__, s)
......@@ -153,6 +154,7 @@ ndb_mgm_create_handle()
h->read_timeout = 50000;
h->write_timeout = 100;
h->cfg_i = 0;
h->errstream = stdout;
strncpy(h->last_error_desc, "No error", NDB_MGM_MAX_ERR_DESC_SIZE);
......@@ -213,6 +215,13 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
DBUG_VOID_RETURN;
}
extern "C"
void
ndb_mgm_set_error_stream(NdbMgmHandle handle, FILE * file)
{
handle->errstream = file;
}
/*****************************************************************************
* Error handling
*****************************************************************************/
......@@ -382,8 +391,8 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries,
break;
if (verbose > 0) {
char buf[1024];
ndbout_c("Unable to connect with connect string: %s",
cfg.makeConnectString(buf,sizeof(buf)));
fprintf(handle->errstream, "Unable to connect with connect string: %s\n",
cfg.makeConnectString(buf,sizeof(buf)));
verbose= -1;
}
if (no_retries == 0) {
......@@ -392,32 +401,35 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries,
"Unable to connect with connect string: %s",
cfg.makeConnectString(buf,sizeof(buf)));
if (verbose == -2)
ndbout << ", failed." << endl;
fprintf(handle->errstream, ", failed.\n");
return -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)
ndbout << ". Attempts left:";
fprintf(handle->errstream, ". Attempts left:");
else
ndbout << ", until connected.";;
ndbout << flush;
fprintf(handle->errstream, ", until connected.");
fflush(handle->errstream);
verbose= -2;
}
if (no_retries > 0) {
if (verbose == -2) {
ndbout << " " << no_retries;
ndbout << flush;
fprintf(handle->errstream, " %d", no_retries);
fflush(handle->errstream);
}
no_retries--;
}
NdbSleep_SecSleep(retry_delay_in_seconds);
}
if (verbose == -2)
ndbout << endl;
{
fprintf(handle->errstream, "\n");
fflush(handle->errstream);
}
handle->cfg_i = i;
handle->socket = sockfd;
handle->connected = 1;
......@@ -469,7 +481,9 @@ ndb_mgm_match_node_type(const char * type)
for(int i = 0; i<no_of_type_values; i++)
if(strcmp(type, type_values[i].str) == 0)
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;
}
......@@ -1664,28 +1678,28 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) {
do {
const char * buf;
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;
}
buf = "<Unspecified>";
if(!prop->get("Content-Type", &buf) ||
strcmp(buf, "ndbconfig/octet-stream") != 0){
ndbout_c("Unhandled response type: %s", buf);
fprintf(handle->errstream, "Unhandled response type: %s\n", buf);
break;
}
buf = "<Unspecified>";
if(!prop->get("Content-Transfer-Encoding", &buf)
|| strcmp(buf, "base64") != 0){
ndbout_c("Unhandled encoding: %s", buf);
fprintf(handle->errstream, "Unhandled encoding: %s\n", buf);
break;
}
buf = "<Content-Length Unspecified>";
Uint32 len = 0;
if(!prop->get("Content-Length", &len)){
ndbout_c("Invalid response: %s\n", buf);
fprintf(handle->errstream, "Invalid response: %s\n\n", buf);
break;
}
......@@ -1710,14 +1724,14 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) {
const int res = base64_decode(buf64, len-1, tmp);
delete[] buf64;
if(res != 0){
ndbout_c("Failed to decode buffer");
fprintf(handle->errstream, "Failed to decode buffer\n");
break;
}
ConfigValuesFactory cvf;
const int res2 = cvf.unpack(tmp);
if(!res2){
ndbout_c("Failed to unpack buffer");
fprintf(handle->errstream, "Failed to unpack buffer\n");
break;
}
......@@ -1821,7 +1835,7 @@ ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype)
}
Uint32 _nodeid;
if(!prop->get("nodeid", &_nodeid) != 0){
ndbout_c("ERROR Message: <nodeid Unspecified>\n");
fprintf(handle->errstream, "ERROR Message: <nodeid Unspecified>\n");
break;
}
nodeid= _nodeid;
......@@ -1897,7 +1911,7 @@ ndb_mgm_set_int_parameter(NdbMgmHandle handle,
do {
const char * buf;
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;
}
res= 0;
......@@ -1940,7 +1954,7 @@ ndb_mgm_set_int64_parameter(NdbMgmHandle handle,
do {
const char * buf;
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;
}
res= 0;
......@@ -1983,7 +1997,7 @@ ndb_mgm_set_string_parameter(NdbMgmHandle handle,
do {
const char * buf;
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;
}
res= 0;
......@@ -2020,7 +2034,7 @@ ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **purged){
do {
const char * buf;
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;
}
if (purged) {
......
......@@ -915,7 +915,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
STR_VALUE(MAX_INT_RNIL) },
{
KEY_INTERNAL,
CFG_DB_LCP_DISC_PAGES_TUP_SR,
"NoOfDiskPagesToDiskDuringRestartTUP",
DB_TOKEN,
"?",
......@@ -927,7 +927,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
STR_VALUE(MAX_INT_RNIL) },
{
KEY_INTERNAL,
CFG_DB_LCP_DISC_PAGES_TUP,
"NoOfDiskPagesToDiskAfterRestartTUP",
DB_TOKEN,
"?",
......@@ -939,7 +939,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
STR_VALUE(MAX_INT_RNIL) },
{
KEY_INTERNAL,
CFG_DB_LCP_DISC_PAGES_ACC_SR,
"NoOfDiskPagesToDiskDuringRestartACC",
DB_TOKEN,
"?",
......@@ -951,7 +951,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
STR_VALUE(MAX_INT_RNIL) },
{
KEY_INTERNAL,
CFG_DB_LCP_DISC_PAGES_ACC,
"NoOfDiskPagesToDiskAfterRestartACC",
DB_TOKEN,
"?",
......
......@@ -127,14 +127,14 @@ private:
Properties m_info;
Properties m_systemDefaults;
static const ParamInfo m_ParamInfo[];
static const int m_NoOfParams;
static const AliasPair m_sectionNameAliases[];
static const char* m_sectionNames[];
static const int m_noOfSectionNames;
public:
static const ParamInfo m_ParamInfo[];
static const int m_NoOfParams;
static const SectionRule m_SectionRules[];
static const ConfigRule m_ConfigRules[];
static const int m_NoOfRules;
......
......@@ -9,7 +9,7 @@ ndbtools_PROGRAMS = \
ndb_show_tables \
ndb_select_all \
ndb_select_count \
ndb_restore
ndb_restore ndb_config
tools_common_sources = ../test/src/NDBT_ReturnCodes.cpp \
../test/src/NDBT_Table.cpp \
......@@ -32,6 +32,16 @@ ndb_restore_SOURCES = restore/restore_main.cpp \
restore/consumer_printer.cpp \
restore/Restore.cpp
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/type_ndbapitools.mk.am
......@@ -45,6 +55,7 @@ ndb_show_tables_LDFLAGS = @ndb_bin_am_ldflags@
ndb_select_all_LDFLAGS = @ndb_bin_am_ldflags@
ndb_select_count_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
%::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