remove duplicate info in paramInfo and ConfigInfo

parent 592e0f22
......@@ -13,13 +13,16 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MYSQLCLUSTERdir= .
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
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/type_util.mk.am
......
......@@ -16,10 +16,7 @@
#include <ndb_types.h>
#include <mgmapi.h>
#include "mgmapi_configuration.hpp"
#include "../mgmsrv/ParamInfo.hpp"
extern const ParamInfo ParamInfoArray[];
extern const int ParamInfoNum;
#include "../mgmsrv/ConfigInfo.hpp"
ndb_mgm_configuration_iterator::ndb_mgm_configuration_iterator
(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,
return -1;
}
for (int i = 0; i < ParamInfoNum; i++) {
if (paramId == ParamInfoArray[i]._paramId && strcmp(DB_TOKEN, ParamInfoArray[i]._section) == 0) {
ConfigInfo data;
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;
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);
}
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);
}
......
......@@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#ifndef NDB_MGMAPI
#include <ndb_opt_defaults.h>
#include <NdbTCP.h>
......@@ -26,6 +27,11 @@
extern my_bool opt_ndb_shm;
extern my_bool opt_core;
#else
#include "ConfigInfo.hpp"
#include <mgmapi_config_parameters.h>
#endif /* NDB_MGMAPI */
#define MAX_LINE_LENGTH 255
#define KEY_INTERNAL 0
#define MAX_INT_RNIL 0xfffffeff
......@@ -46,6 +52,7 @@ extern my_bool opt_core;
#define MGM_TOKEN "MGM"
#define API_TOKEN "API"
#ifndef NDB_MGMAPI
const ConfigInfo::AliasPair
ConfigInfo::m_sectionNameAliases[]={
{API_TOKEN, "MYSQLD"},
......@@ -218,6 +225,7 @@ const DepricationTransform f_deprication[] = {
{ MGM_TOKEN, "Id", "NodeId", 0, 1 },
{ 0, 0, 0, 0, 0}
};
#endif /* NDB_MGMAPI */
/**
* The default constructors create objects with suitable values for the
......@@ -2154,7 +2162,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo);
#ifndef NDB_MGMAPI
/****************************************************************************
* Ctor
****************************************************************************/
......@@ -3742,3 +3750,4 @@ check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>&sections,
}
template class Vector<ConfigInfo::ConfigRuleSection>;
#endif /* NDB_MGMAPI */
......@@ -16,11 +16,13 @@
#ifndef ConfigInfo_H
#define ConfigInfo_H
#ifndef NDB_MGMAPI
#include <kernel_types.h>
#include <Properties.hpp>
#include <ndb_limits.h>
#include <NdbOut.hpp>
#include "InitConfigFileParser.hpp"
#endif /* NDB_MGMAPI */
/**
* A MANDATORY parameters must be specified in the config file
......@@ -63,6 +65,7 @@ public:
const char* _max;
};
#ifndef NDB_MGMAPI
struct AliasPair{
const char * name;
const char * alias;
......@@ -132,14 +135,17 @@ private:
static const AliasPair m_sectionNameAliases[];
static const char* m_sectionNames[];
static const int m_noOfSectionNames;
#endif /* NDB_MGMAPI */
public:
static const ParamInfo m_ParamInfo[];
static const int m_NoOfParams;
#ifndef NDB_MGMAPI
static const SectionRule m_SectionRules[];
static const ConfigRule m_ConfigRules[];
static const int m_NoOfRules;
#endif /* NDB_MGMAPI */
};
#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