remove duplicate info in paramInfo and ConfigInfo

parent 592e0f22
...@@ -13,13 +13,16 @@ ...@@ -13,13 +13,16 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MYSQLCLUSTERdir= .
noinst_LTLIBRARIES = libmgmapi.la noinst_LTLIBRARIES = libmgmapi.la
libmgmapi_la_SOURCES = mgmapi.cpp ndb_logevent.cpp mgmapi_configuration.cpp LocalConfig.cpp ../kernel/error/ndbd_exit_codes.c ../mgmsrv/ParamInfo.cpp libmgmapi_la_SOURCES = mgmapi.cpp ndb_logevent.cpp mgmapi_configuration.cpp LocalConfig.cpp ../kernel/error/ndbd_exit_codes.c ../mgmsrv/ConfigInfo.cpp
INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/include/mgmapi INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/include/mgmapi
DEFS_LOC = -DNO_DEBUG_MESSAGES -DNDB_PORT="\"@ndb_port@\"" DEFS_LOC = -DNDB_MGMAPI -DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\"" \
-DNO_DEBUG_MESSAGES -DNDB_PORT="\"@ndb_port@\""
include $(top_srcdir)/storage/ndb/config/common.mk.am include $(top_srcdir)/storage/ndb/config/common.mk.am
include $(top_srcdir)/storage/ndb/config/type_util.mk.am include $(top_srcdir)/storage/ndb/config/type_util.mk.am
......
...@@ -16,10 +16,7 @@ ...@@ -16,10 +16,7 @@
#include <ndb_types.h> #include <ndb_types.h>
#include <mgmapi.h> #include <mgmapi.h>
#include "mgmapi_configuration.hpp" #include "mgmapi_configuration.hpp"
#include "../mgmsrv/ParamInfo.hpp" #include "../mgmsrv/ConfigInfo.hpp"
extern const ParamInfo ParamInfoArray[];
extern const int ParamInfoNum;
ndb_mgm_configuration_iterator::ndb_mgm_configuration_iterator ndb_mgm_configuration_iterator::ndb_mgm_configuration_iterator
(const ndb_mgm_configuration & conf, unsigned type_of_section) (const ndb_mgm_configuration & conf, unsigned type_of_section)
...@@ -187,18 +184,19 @@ ndb_mgm_get_db_parameter_info(Uint32 paramId, struct ndb_mgm_param_info * info, ...@@ -187,18 +184,19 @@ ndb_mgm_get_db_parameter_info(Uint32 paramId, struct ndb_mgm_param_info * info,
return -1; return -1;
} }
for (int i = 0; i < ParamInfoNum; i++) { ConfigInfo data;
if (paramId == ParamInfoArray[i]._paramId && strcmp(DB_TOKEN, ParamInfoArray[i]._section) == 0) { for (int i = 0; i < data.m_NoOfParams; i++) {
if (paramId == data.m_ParamInfo[i]._paramId && strcmp("DB", data.m_ParamInfo[i]._section) == 0) {
size_t tmp = 0; size_t tmp = 0;
if (tmp + sizeof(info->m_id) <= *size) if (tmp + sizeof(info->m_id) <= *size)
{ {
info->m_id = ParamInfoArray[i]._paramId; info->m_id = data.m_ParamInfo[i]._paramId;
tmp += sizeof(info->m_id); tmp += sizeof(info->m_id);
} }
if (tmp + sizeof(info->m_name) <= *size) if (tmp + sizeof(info->m_name) <= *size)
{ {
info->m_name = ParamInfoArray[i]._fname; info->m_name = data.m_ParamInfo[i]._fname;
tmp += sizeof(info->m_name); tmp += sizeof(info->m_name);
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h> #include <ndb_global.h>
#ifndef NDB_MGMAPI
#include <ndb_opt_defaults.h> #include <ndb_opt_defaults.h>
#include <NdbTCP.h> #include <NdbTCP.h>
...@@ -26,6 +27,11 @@ ...@@ -26,6 +27,11 @@
extern my_bool opt_ndb_shm; extern my_bool opt_ndb_shm;
extern my_bool opt_core; extern my_bool opt_core;
#else
#include "ConfigInfo.hpp"
#include <mgmapi_config_parameters.h>
#endif /* NDB_MGMAPI */
#define MAX_LINE_LENGTH 255 #define MAX_LINE_LENGTH 255
#define KEY_INTERNAL 0 #define KEY_INTERNAL 0
#define MAX_INT_RNIL 0xfffffeff #define MAX_INT_RNIL 0xfffffeff
...@@ -46,6 +52,7 @@ extern my_bool opt_core; ...@@ -46,6 +52,7 @@ extern my_bool opt_core;
#define MGM_TOKEN "MGM" #define MGM_TOKEN "MGM"
#define API_TOKEN "API" #define API_TOKEN "API"
#ifndef NDB_MGMAPI
const ConfigInfo::AliasPair const ConfigInfo::AliasPair
ConfigInfo::m_sectionNameAliases[]={ ConfigInfo::m_sectionNameAliases[]={
{API_TOKEN, "MYSQLD"}, {API_TOKEN, "MYSQLD"},
...@@ -218,6 +225,7 @@ const DepricationTransform f_deprication[] = { ...@@ -218,6 +225,7 @@ const DepricationTransform f_deprication[] = {
{ MGM_TOKEN, "Id", "NodeId", 0, 1 }, { MGM_TOKEN, "Id", "NodeId", 0, 1 },
{ 0, 0, 0, 0, 0} { 0, 0, 0, 0, 0}
}; };
#endif /* NDB_MGMAPI */
/** /**
* The default constructors create objects with suitable values for the * The default constructors create objects with suitable values for the
...@@ -2154,7 +2162,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -2154,7 +2162,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo); const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo);
#ifndef NDB_MGMAPI
/**************************************************************************** /****************************************************************************
* Ctor * Ctor
****************************************************************************/ ****************************************************************************/
...@@ -3742,3 +3750,4 @@ check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>&sections, ...@@ -3742,3 +3750,4 @@ check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>&sections,
} }
template class Vector<ConfigInfo::ConfigRuleSection>; template class Vector<ConfigInfo::ConfigRuleSection>;
#endif /* NDB_MGMAPI */
...@@ -16,11 +16,13 @@ ...@@ -16,11 +16,13 @@
#ifndef ConfigInfo_H #ifndef ConfigInfo_H
#define ConfigInfo_H #define ConfigInfo_H
#ifndef NDB_MGMAPI
#include <kernel_types.h> #include <kernel_types.h>
#include <Properties.hpp> #include <Properties.hpp>
#include <ndb_limits.h> #include <ndb_limits.h>
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include "InitConfigFileParser.hpp" #include "InitConfigFileParser.hpp"
#endif /* NDB_MGMAPI */
/** /**
* A MANDATORY parameters must be specified in the config file * A MANDATORY parameters must be specified in the config file
...@@ -63,6 +65,7 @@ public: ...@@ -63,6 +65,7 @@ public:
const char* _max; const char* _max;
}; };
#ifndef NDB_MGMAPI
struct AliasPair{ struct AliasPair{
const char * name; const char * name;
const char * alias; const char * alias;
...@@ -132,14 +135,17 @@ private: ...@@ -132,14 +135,17 @@ private:
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;
#endif /* NDB_MGMAPI */
public: public:
static const ParamInfo m_ParamInfo[]; static const ParamInfo m_ParamInfo[];
static const int m_NoOfParams; static const int m_NoOfParams;
#ifndef NDB_MGMAPI
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;
#endif /* NDB_MGMAPI */
}; };
#endif // ConfigInfo_H #endif // ConfigInfo_H
This diff is collapsed.
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef PARAMINFO_H
#define PARAMINFO_H
#define DB_TOKEN "DB"
#define MGM_TOKEN "MGM"
#define API_TOKEN "API"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* The Configuration parameter type and status
*/
enum ParameterType { CI_BOOL, CI_INT, CI_INT64, CI_STRING, CI_SECTION };
enum ParameterStatus { CI_USED, ///< Active
CI_DEPRICATED, ///< Can be, but shouldn't
CI_NOTIMPLEMENTED, ///< Is ignored.
CI_INTERNAL ///< Not configurable by the user
};
/**
* Entry for one configuration parameter
*/
typedef struct m_ParamInfo {
Uint32 _paramId;
const char* _fname;
const char* _section;
const char* _description;
ParameterStatus _status;
bool _updateable;
ParameterType _type;
const char* _default;
const char* _min;
const char* _max;
}ParamInfo;
#ifdef __cplusplus
}
#endif
#endif
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