diff options
author | unknown <joreland@mysql.com> | 2004-12-31 06:36:32 +0100 |
---|---|---|
committer | unknown <joreland@mysql.com> | 2004-12-31 06:36:32 +0100 |
commit | 5098405248ef944f5ef61052a9ea3baa5885a571 (patch) | |
tree | a1d6407a6626529b28b62eaf78d244fe41fa644f /ndb/src/mgmapi/mgmapi.cpp | |
parent | af2a68488bd28479b929c8825af80559b980cef1 (diff) | |
parent | 5df5f5c174299fc76e65e8273570f09090b41df5 (diff) | |
download | mariadb-git-5098405248ef944f5ef61052a9ea3baa5885a571.tar.gz |
merge
BitKeeper/etc/logging_ok:
auto-union
ndb/docs/wl2077.txt:
Auto merged
ndb/include/Makefile.am:
Auto merged
ndb/include/ndbapi/NdbTransaction.hpp:
Auto merged
ndb/src/common/debugger/EventLogger.cpp:
Auto merged
ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Auto merged
ndb/src/common/logger/Logger.cpp:
Auto merged
ndb/src/common/mgmcommon/ConfigRetriever.cpp:
Auto merged
ndb/src/common/util/Makefile.am:
Auto merged
ndb/src/kernel/blocks/dbacc/DbaccInit.cpp:
Auto merged
ndb/src/kernel/blocks/dbacc/Makefile.am:
Auto merged
ndb/src/kernel/main.cpp:
Auto merged
ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Auto merged
ndb/src/kernel/blocks/dbdih/Dbdih.hpp:
Auto merged
ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
Auto merged
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
Auto merged
ndb/src/kernel/blocks/dbtux/Dbtux.hpp:
Auto merged
ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp:
Auto merged
ndb/src/kernel/vm/Configuration.cpp:
Auto merged
ndb/src/kernel/vm/Configuration.hpp:
Auto merged
ndb/src/mgmapi/mgmapi.cpp:
Auto merged
ndb/src/mgmsrv/CommandInterpreter.cpp:
Auto merged
ndb/src/mgmsrv/InitConfigFileParser.cpp:
Auto merged
ndb/src/mgmsrv/MgmtSrvr.cpp:
Auto merged
ndb/src/mgmsrv/MgmtSrvr.hpp:
Auto merged
ndb/src/mgmsrv/Services.cpp:
Auto merged
ndb/src/mgmsrv/Services.hpp:
Auto merged
ndb/src/mgmsrv/main.cpp:
Auto merged
ndb/src/ndbapi/NdbBlob.cpp:
Auto merged
ndb/src/ndbapi/NdbDictionary.cpp:
Auto merged
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Auto merged
ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Auto merged
ndb/src/ndbapi/NdbOperationExec.cpp:
Auto merged
ndb/src/ndbapi/NdbReceiver.cpp:
Auto merged
ndb/src/ndbapi/NdbScanOperation.cpp:
Auto merged
ndb/src/ndbapi/NdbTransaction.cpp:
Auto merged
ndb/src/ndbapi/Ndbif.cpp:
Auto merged
ndb/src/ndbapi/Ndbinit.cpp:
Auto merged
ndb/src/ndbapi/Ndblist.cpp:
Auto merged
ndb/src/ndbapi/TransporterFacade.cpp:
Auto merged
ndb/src/ndbapi/TransporterFacade.hpp:
Auto merged
ndb/src/ndbapi/ndberror.c:
Auto merged
ndb/test/ndbapi/Makefile.am:
Auto merged
ndb/test/ndbapi/testDict.cpp:
Auto merged
ndb/test/ndbapi/testNdbApi.cpp:
Auto merged
ndb/test/src/NdbRestarter.cpp:
Auto merged
ndb/test/tools/Makefile.am:
Auto merged
ndb/tools/Makefile.am:
Auto merged
ndb/tools/delete_all.cpp:
Auto merged
ndb/tools/desc.cpp:
Auto merged
ndb/tools/select_all.cpp:
Auto merged
ndb/tools/select_count.cpp:
Auto merged
scripts/make_win_src_distribution.sh:
Auto merged
sql/ha_ndbcluster.h:
Auto merged
Diffstat (limited to 'ndb/src/mgmapi/mgmapi.cpp')
-rw-r--r-- | ndb/src/mgmapi/mgmapi.cpp | 104 |
1 files changed, 85 insertions, 19 deletions
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index 01eaf4badc8..166bd45d48b 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -917,21 +917,67 @@ ndb_mgm_restart(NdbMgmHandle handle, int no_of_nodes, const int *node_list) return ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0); } +static const char *clusterlog_level_names[]= + { "enabled", "debug", "info", "warning", "error", "critical", "alert" }; + +struct ndb_mgm_clusterlog_levels +{ + const char* name; + enum ndb_mgm_clusterlog_level level; +} clusterlog_levels[] = { + { clusterlog_level_names[0], NDB_MGM_CLUSTERLOG_ON }, + { clusterlog_level_names[1], NDB_MGM_CLUSTERLOG_DEBUG }, + { clusterlog_level_names[2], NDB_MGM_CLUSTERLOG_INFO }, + { clusterlog_level_names[3], NDB_MGM_CLUSTERLOG_WARNING }, + { clusterlog_level_names[4], NDB_MGM_CLUSTERLOG_ERROR }, + { clusterlog_level_names[5], NDB_MGM_CLUSTERLOG_CRITICAL }, + { clusterlog_level_names[6], NDB_MGM_CLUSTERLOG_ALERT }, + { "all", NDB_MGM_CLUSTERLOG_ALL }, + { 0, NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL }, +}; + +extern "C" +ndb_mgm_clusterlog_level +ndb_mgm_match_clusterlog_level(const char * name) +{ + if(name == 0) + return NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL; + + for(int i = 0; clusterlog_levels[i].name !=0 ; i++) + if(strcasecmp(name, clusterlog_levels[i].name) == 0) + return clusterlog_levels[i].level; + + return NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL; +} + +extern "C" +const char * +ndb_mgm_get_clusterlog_level_string(enum ndb_mgm_clusterlog_level level) +{ + int i= (int)level; + if (i >= 0 && i < (int)NDB_MGM_CLUSTERLOG_ALL) + return clusterlog_level_names[i]; + for(i = (int)NDB_MGM_CLUSTERLOG_ALL; clusterlog_levels[i].name != 0; i++) + if(clusterlog_levels[i].level == level) + return clusterlog_levels[i].name; + return 0; +} + extern "C" unsigned int * ndb_mgm_get_logfilter(NdbMgmHandle handle) { SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_get_logfilter"); - static Uint32 enabled[7] = {0,0,0,0,0,0,0}; + static Uint32 enabled[(int)NDB_MGM_CLUSTERLOG_ALL] = {0,0,0,0,0,0,0}; const ParserRow<ParserDummy> getinfo_reply[] = { MGM_CMD("clusterlog", NULL, ""), - MGM_ARG("enabled", Int, Mandatory, ""), - MGM_ARG("debug", Int, Mandatory, ""), - MGM_ARG("info", Int, Mandatory, ""), - MGM_ARG("warning", Int, Mandatory, ""), - MGM_ARG("error", Int, Mandatory, ""), - MGM_ARG("critical", Int, Mandatory, ""), - MGM_ARG("alert", Int, Mandatory, ""), + MGM_ARG(clusterlog_level_names[0], Int, Mandatory, ""), + MGM_ARG(clusterlog_level_names[1], Int, Mandatory, ""), + MGM_ARG(clusterlog_level_names[2], Int, Mandatory, ""), + MGM_ARG(clusterlog_level_names[3], Int, Mandatory, ""), + MGM_ARG(clusterlog_level_names[4], Int, Mandatory, ""), + MGM_ARG(clusterlog_level_names[5], Int, Mandatory, ""), + MGM_ARG(clusterlog_level_names[6], Int, Mandatory, ""), }; CHECK_HANDLE(handle, NULL); CHECK_CONNECTED(handle, NULL); @@ -941,10 +987,8 @@ ndb_mgm_get_logfilter(NdbMgmHandle handle) reply = ndb_mgm_call(handle, getinfo_reply, "get info clusterlog", &args); CHECK_REPLY(reply, NULL); - const char *names[] = { "enabled", "debug", "info", "warning", "error", - "critical", "alert" }; - for(int i=0; i < 7; i++) { - reply->get(names[i], &enabled[i]); + for(int i=0; i < (int)NDB_MGM_CLUSTERLOG_ALL; i++) { + reply->get(clusterlog_level_names[i], &enabled[i]); } return enabled; } @@ -953,6 +997,7 @@ extern "C" int ndb_mgm_filter_clusterlog(NdbMgmHandle handle, enum ndb_mgm_clusterlog_level level, + int enable, struct ndb_mgm_reply* /*reply*/) { SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_filter_clusterlog"); @@ -967,6 +1012,7 @@ ndb_mgm_filter_clusterlog(NdbMgmHandle handle, Properties args; args.put("level", level); + args.put("enable", enable); const Properties *reply; reply = ndb_mgm_call(handle, filter_reply, "set logfilter", &args); @@ -974,11 +1020,14 @@ ndb_mgm_filter_clusterlog(NdbMgmHandle handle, BaseString result; reply->get("result", result); - if(strcmp(result.c_str(), "1") == 0) { + + if (strcmp(result.c_str(), "1") == 0) + retval = 1; + else if (strcmp(result.c_str(), "0") == 0) retval = 0; - } else { + else + { SET_ERROR(handle, EINVAL, result.c_str()); - retval = -1; } delete reply; return retval; @@ -1056,15 +1105,18 @@ ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId, "set cluster loglevel", &args); CHECK_REPLY(reply, -1); + DBUG_ENTER("ndb_mgm_set_loglevel_clusterlog"); + DBUG_PRINT("enter",("node=%d, category=%d, level=%d", nodeId, cat, level)); + BaseString result; reply->get("result", result); if(strcmp(result.c_str(), "Ok") != 0) { SET_ERROR(handle, EINVAL, result.c_str()); delete reply; - return -1; + DBUG_RETURN(-1); } delete reply; - return 0; + DBUG_RETURN(0); } extern "C" @@ -1496,7 +1548,8 @@ ndb_mgm_start(NdbMgmHandle handle, int no_of_nodes, const int * node_list) *****************************************************************************/ extern "C" int -ndb_mgm_start_backup(NdbMgmHandle handle, unsigned int* _backup_id, +ndb_mgm_start_backup(NdbMgmHandle handle, int wait_completed, + unsigned int* _backup_id, struct ndb_mgm_reply* /*reply*/) { SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_start_backup"); @@ -1510,8 +1563,17 @@ ndb_mgm_start_backup(NdbMgmHandle handle, unsigned int* _backup_id, CHECK_CONNECTED(handle, -1); Properties args; + args.put("completed", wait_completed); const Properties *reply; - reply = ndb_mgm_call(handle, start_backup_reply, "start backup", &args); + { // start backup can take some time, set timeout high + Uint64 old_timeout= handle->read_timeout; + if (wait_completed == 2) + handle->read_timeout= 30*60*1000; // 30 minutes + else if (wait_completed == 1) + handle->read_timeout= 5*60*1000; // 5 minutes + reply = ndb_mgm_call(handle, start_backup_reply, "start backup", &args); + handle->read_timeout= old_timeout; + } CHECK_REPLY(reply, -1); BaseString result; @@ -1693,6 +1755,9 @@ ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype) { CHECK_HANDLE(handle, 0); CHECK_CONNECTED(handle, 0); + union { long l; char c[sizeof(long)]; } endian_check; + + endian_check.l = 1; int nodeid= handle->cfg._ownNodeId; @@ -1703,6 +1768,7 @@ ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype) args.put("user", "mysqld"); args.put("password", "mysqld"); args.put("public key", "a public key"); + args.put("endian", (endian_check.c[sizeof(long)-1])?"big":"little"); const ParserRow<ParserDummy> reply[]= { MGM_CMD("get nodeid reply", NULL, ""), |