Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
8bfc619e
Commit
8bfc619e
authored
Sep 25, 2004
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved LocalConfig out of config retriver
parent
65629eb2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
67 additions
and
79 deletions
+67
-79
ndb/include/mgmcommon/ConfigRetriever.hpp
ndb/include/mgmcommon/ConfigRetriever.hpp
+2
-15
ndb/include/ndbapi/ndb_cluster_connection.hpp
ndb/include/ndbapi/ndb_cluster_connection.hpp
+2
-0
ndb/src/common/mgmcommon/ConfigRetriever.cpp
ndb/src/common/mgmcommon/ConfigRetriever.cpp
+4
-21
ndb/src/kernel/main.cpp
ndb/src/kernel/main.cpp
+11
-3
ndb/src/kernel/vm/Configuration.cpp
ndb/src/kernel/vm/Configuration.cpp
+8
-3
ndb/src/kernel/vm/Configuration.hpp
ndb/src/kernel/vm/Configuration.hpp
+3
-1
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+5
-4
ndb/src/mgmsrv/MgmtSrvr.hpp
ndb/src/mgmsrv/MgmtSrvr.hpp
+2
-2
ndb/src/mgmsrv/MgmtSrvrConfig.cpp
ndb/src/mgmsrv/MgmtSrvrConfig.cpp
+1
-2
ndb/src/mgmsrv/main.cpp
ndb/src/mgmsrv/main.cpp
+7
-22
ndb/src/ndbapi/TransporterFacade.hpp
ndb/src/ndbapi/TransporterFacade.hpp
+0
-1
ndb/src/ndbapi/ndb_cluster_connection.cpp
ndb/src/ndbapi/ndb_cluster_connection.cpp
+22
-5
No files found.
ndb/include/mgmcommon/ConfigRetriever.hpp
View file @
8bfc619e
...
...
@@ -28,7 +28,7 @@
*/
class
ConfigRetriever
{
public:
ConfigRetriever
(
Uint32
version
,
Uint32
nodeType
);
ConfigRetriever
(
LocalConfig
&
local_config
,
Uint32
version
,
Uint32
nodeType
);
~
ConfigRetriever
();
/**
...
...
@@ -54,16 +54,6 @@ public:
const
char
*
getErrorString
();
/**
* Sets connectstring which can be used instead of local config file
*/
void
setConnectString
(
const
char
*
connectString
);
/**
* Sets name of local config file (usually not needed)
*/
void
setLocalConfigFileName
(
const
char
*
connectString
);
/**
* @return Node id of this node (as stated in local config or connectString)
*/
...
...
@@ -93,12 +83,9 @@ private:
void
setError
(
ErrorType
,
const
char
*
errorMsg
);
BaseString
_localConfigFileName
;
struct
LocalConfig
_localConfig
;
struct
LocalConfig
&
_localConfig
;
Uint32
_ownNodeId
;
BaseString
m_connectString
;
Uint32
m_version
;
Uint32
m_node_type
;
NdbMgmHandle
m_handle
;
...
...
ndb/include/ndbapi/ndb_cluster_connection.hpp
View file @
8bfc619e
...
...
@@ -19,6 +19,7 @@
#define CLUSTER_CONNECTION_HPP
class
TransporterFacade
;
class
LocalConfig
;
class
ConfigRetriever
;
class
NdbThread
;
...
...
@@ -37,6 +38,7 @@ private:
void
connect_thread
();
char
*
m_connect_string
;
TransporterFacade
*
m_facade
;
LocalConfig
*
m_local_config
;
ConfigRetriever
*
m_config_retriever
;
NdbThread
*
m_connect_thread
;
int
(
*
m_connect_callback
)(
void
);
...
...
ndb/src/common/mgmcommon/ConfigRetriever.cpp
View file @
8bfc619e
...
...
@@ -45,8 +45,10 @@
//****************************************************************************
//****************************************************************************
ConfigRetriever
::
ConfigRetriever
(
Uint32
version
,
Uint32
node_type
)
{
ConfigRetriever
::
ConfigRetriever
(
LocalConfig
&
local_config
,
Uint32
version
,
Uint32
node_type
)
:
_localConfig
(
local_config
)
{
m_handle
=
0
;
m_version
=
version
;
m_node_type
=
node_type
;
...
...
@@ -66,15 +68,6 @@ ConfigRetriever::~ConfigRetriever(){
int
ConfigRetriever
::
init
()
{
if
(
!
_localConfig
.
init
(
m_connectString
.
c_str
(),
_localConfigFileName
.
c_str
())){
setError
(
CR_ERROR
,
"error in retrieving contact info for mgmtsrvr"
);
_localConfig
.
printError
();
_localConfig
.
printUsage
();
return
-
1
;
}
return
_ownNodeId
=
_localConfig
.
_ownNodeId
;
}
...
...
@@ -230,16 +223,6 @@ ConfigRetriever::getErrorString(){
return
errorString
.
c_str
();
}
void
ConfigRetriever
::
setLocalConfigFileName
(
const
char
*
localConfigFileName
)
{
_localConfigFileName
.
assign
(
localConfigFileName
?
localConfigFileName
:
""
);
}
void
ConfigRetriever
::
setConnectString
(
const
char
*
connectString
)
{
m_connectString
.
assign
(
connectString
?
connectString
:
""
);
}
bool
ConfigRetriever
::
verifyConfig
(
const
struct
ndb_mgm_configuration
*
conf
,
Uint32
nodeid
){
...
...
ndb/src/kernel/main.cpp
View file @
8bfc619e
...
...
@@ -19,6 +19,7 @@
#include <ndb_version.h>
#include "Configuration.hpp"
#include <LocalConfig.hpp>
#include <TransporterRegistry.hpp>
#include "vm/SimBlockList.hpp"
...
...
@@ -67,12 +68,19 @@ NDB_MAIN(ndb_kernel){
// Parse command line options
Configuration
*
theConfig
=
globalEmulatorData
.
theConfiguration
;
if
(
!
theConfig
->
init
(
argc
,
argv
)){
return
0
;
return
NRT_Default
;
}
LocalConfig
local_config
;
if
(
!
local_config
.
init
(
theConfig
->
getConnectString
(),
0
)){
local_config
.
printError
();
local_config
.
printUsage
();
return
NRT_Default
;
}
{
// Do configuration
signal
(
SIGPIPE
,
SIG_IGN
);
theConfig
->
fetch_configuration
();
theConfig
->
fetch_configuration
(
local_config
);
}
chdir
(
NdbConfig_get_path
(
0
));
...
...
@@ -135,7 +143,7 @@ NDB_MAIN(ndb_kernel){
exit
(
0
);
}
g_eventLogger
.
info
(
"Ndb has terminated (pid %d) restarting"
,
child
);
theConfig
->
fetch_configuration
();
theConfig
->
fetch_configuration
(
local_config
);
}
g_eventLogger
.
info
(
"Angel pid: %d ndb pid: %d"
,
getppid
(),
getpid
());
...
...
ndb/src/kernel/vm/Configuration.cpp
View file @
8bfc619e
...
...
@@ -16,6 +16,7 @@
#include <ndb_global.h>
#include <LocalConfig.hpp>
#include "Configuration.hpp"
#include <ErrorHandlingMacros.hpp>
#include "GlobalData.hpp"
...
...
@@ -184,7 +185,7 @@ Configuration::closeConfiguration(){
}
void
Configuration
::
fetch_configuration
(){
Configuration
::
fetch_configuration
(
LocalConfig
&
local_config
){
/**
* Fetch configuration from management server
*/
...
...
@@ -192,8 +193,7 @@ Configuration::fetch_configuration(){
delete
m_config_retriever
;
}
m_config_retriever
=
new
ConfigRetriever
(
NDB_VERSION
,
NODE_TYPE_DB
);
m_config_retriever
->
setConnectString
(
_connectString
?
_connectString
:
""
);
m_config_retriever
=
new
ConfigRetriever
(
local_config
,
NDB_VERSION
,
NODE_TYPE_DB
);
if
(
m_config_retriever
->
init
()
==
-
1
||
m_config_retriever
->
do_connect
()
==
-
1
){
...
...
@@ -416,6 +416,11 @@ Configuration::setRestartOnErrorInsert(int i){
m_restartOnErrorInsert
=
i
;
}
const
char
*
Configuration
::
getConnectString
()
const
{
return
_connectString
;
}
char
*
Configuration
::
getConnectStringCopy
()
const
{
if
(
_connectString
!=
0
)
...
...
ndb/src/kernel/vm/Configuration.hpp
View file @
8bfc619e
...
...
@@ -21,6 +21,7 @@
#include <ndb_types.h>
class
ConfigRetriever
;
class
LocalConfig
;
class
Configuration
{
public:
...
...
@@ -32,7 +33,7 @@ public:
*/
bool
init
(
int
argc
,
const
char
**
argv
);
void
fetch_configuration
();
void
fetch_configuration
(
LocalConfig
&
local_config
);
void
setupConfiguration
();
void
closeConfiguration
();
...
...
@@ -54,6 +55,7 @@ public:
const
char
*
programName
()
const
;
const
char
*
fileSystemPath
()
const
;
const
char
*
backupFilePath
()
const
;
const
char
*
getConnectString
()
const
;
char
*
getConnectStringCopy
()
const
;
/**
...
...
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
8bfc619e
...
...
@@ -401,7 +401,7 @@ MgmtSrvr::getPort() const {
/* Constructor */
MgmtSrvr
::
MgmtSrvr
(
NodeId
nodeId
,
const
BaseString
&
configFilename
,
const
BaseString
&
ndb_config_filename
,
LocalConfig
&
local_config
,
Config
*
config
)
:
_blockNumber
(
1
),
// Hard coded block number since it makes it easy to send
// signals to other management servers.
...
...
@@ -409,7 +409,9 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
m_allocated_resources
(
*
this
),
theSignalIdleList
(
NULL
),
theWaitState
(
WAIT_SUBSCRIBE_CONF
),
m_statisticsListner
(
this
){
m_statisticsListner
(
this
),
m_local_config
(
local_config
)
{
DBUG_ENTER
(
"MgmtSrvr::MgmtSrvr"
);
...
...
@@ -424,7 +426,6 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
m_newConfig
=
NULL
;
m_configFilename
=
configFilename
;
m_localNdbConfigFilename
=
ndb_config_filename
;
m_nextConfigGenerationNumber
=
0
;
...
...
@@ -514,7 +515,7 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
{
DBUG_PRINT
(
"info"
,
(
"verifyConfig"
));
ConfigRetriever
cr
(
NDB_VERSION
,
NDB_MGM_NODE_TYPE_MGM
);
ConfigRetriever
cr
(
m_local_config
,
NDB_VERSION
,
NDB_MGM_NODE_TYPE_MGM
);
if
(
!
cr
.
verifyConfig
(
config
->
m_configValues
,
_ownNodeId
))
{
ndbout
<<
cr
.
getErrorString
()
<<
endl
;
exit
(
-
1
);
...
...
ndb/src/mgmsrv/MgmtSrvr.hpp
View file @
8bfc619e
...
...
@@ -173,7 +173,7 @@ public:
MgmtSrvr
(
NodeId
nodeId
,
/* Local nodeid */
const
BaseString
&
config_filename
,
/* Where to save config */
const
BaseString
&
ndb_config_filename
,
/* Ndb.cfg filename */
LocalConfig
&
local_config
,
/* Ndb.cfg filename */
Config
*
config
);
NodeId
getOwnNodeId
()
const
{
return
_ownNodeId
;};
...
...
@@ -528,8 +528,8 @@ private:
NdbMutex
*
m_configMutex
;
const
Config
*
_config
;
Config
*
m_newConfig
;
LocalConfig
&
m_local_config
;
BaseString
m_configFilename
;
BaseString
m_localNdbConfigFilename
;
Uint32
m_nextConfigGenerationNumber
;
NodeBitmask
m_reserved_nodes
;
...
...
ndb/src/mgmsrv/MgmtSrvrConfig.cpp
View file @
8bfc619e
...
...
@@ -288,8 +288,7 @@ MgmtSrvr::readConfig() {
Config
*
MgmtSrvr
::
fetchConfig
()
{
ConfigRetriever
cr
(
NDB_VERSION
,
NODE_TYPE_MGM
);
cr
.
setLocalConfigFileName
(
m_localNdbConfigFilename
.
c_str
());
ConfigRetriever
cr
(
m_local_config
,
NDB_VERSION
,
NODE_TYPE_MGM
);
struct
ndb_mgm_configuration
*
tmp
=
cr
.
getConfig
();
if
(
tmp
!=
0
){
Config
*
conf
=
new
Config
();
...
...
ndb/src/mgmsrv/main.cpp
View file @
8bfc619e
...
...
@@ -173,15 +173,19 @@ NDB_MAIN(mgmsrv){
/****************************
* Read configuration files *
****************************/
if
(
!
readLocalConfig
())
LocalConfig
local_config
;
if
(
!
local_config
.
init
(
0
,
glob
.
local_config_filename
)){
local_config
.
printError
();
goto
error_end
;
}
glob
.
localNodeId
=
local_config
.
_ownNodeId
;
if
(
!
readGlobalConfig
())
goto
error_end
;
glob
.
mgmObject
=
new
MgmtSrvr
(
glob
.
localNodeId
,
BaseString
(
glob
.
config_filename
),
BaseString
(
glob
.
local_config_filename
==
0
?
""
:
glob
.
local_config_filename
),
local_config
,
glob
.
cluster_config
);
chdir
(
NdbConfig_get_path
(
0
));
...
...
@@ -320,25 +324,6 @@ MgmGlobals::~MgmGlobals(){
free
(
interface_name
);
}
/**
* @fn readLocalConfig
* @param glob : Global variables
* @return true if success, false otherwise.
*/
static
bool
readLocalConfig
(){
// Read local config file
LocalConfig
lc
;
if
(
!
lc
.
init
(
0
,
glob
.
local_config_filename
)){
lc
.
printError
();
return
false
;
}
glob
.
localNodeId
=
lc
.
_ownNodeId
;
return
true
;
}
/**
* @fn readGlobalConfig
* @param glob : Global variables
...
...
ndb/src/ndbapi/TransporterFacade.hpp
View file @
8bfc619e
...
...
@@ -236,7 +236,6 @@ public:
NdbMutex
*
theMutexPtr
;
private:
static
TransporterFacade
*
theFacadeInstance
;
static
ConfigRetriever
*
s_config_retriever
;
public:
GlobalDictCache
m_globalDictCache
;
...
...
ndb/src/ndbapi/ndb_cluster_connection.cpp
View file @
8bfc619e
...
...
@@ -16,6 +16,7 @@
#include <ndb_global.h>
#include <my_pthread.h>
#include <my_sys.h>
#include <ndb_cluster_connection.hpp>
#include <TransporterFacade.hpp>
...
...
@@ -30,14 +31,18 @@ static int g_run_connect_thread= 0;
Ndb_cluster_connection
::
Ndb_cluster_connection
(
const
char
*
connect_string
)
{
DBUG_ENTER
(
"Ndb_cluster_connection"
);
DBUG_PRINT
(
"enter"
,(
"Ndb_cluster_connection this=0x%x"
,
this
));
m_facade
=
TransporterFacade
::
theFacadeInstance
=
new
TransporterFacade
();
if
(
connect_string
)
m_connect_string
=
strdup
(
connect_string
);
m_connect_string
=
my_strdup
(
connect_string
,
MYF
(
MY_WME
)
);
else
m_connect_string
=
0
;
m_config_retriever
=
0
;
m_local_config
=
0
;
m_connect_thread
=
0
;
m_connect_callback
=
0
;
DBUG_VOID_RETURN
;
}
extern
"C"
pthread_handler_decl
(
run_ndb_cluster_connection_connect_thread
,
me
)
...
...
@@ -99,8 +104,16 @@ int Ndb_cluster_connection::connect(int reconnect)
do
{
if
(
m_config_retriever
==
0
)
{
m_config_retriever
=
new
ConfigRetriever
(
NDB_VERSION
,
NODE_TYPE_API
);
m_config_retriever
->
setConnectString
(
m_connect_string
);
if
(
m_local_config
==
0
)
{
m_local_config
=
new
LocalConfig
();
if
(
m_local_config
->
init
(
m_connect_string
,
0
))
{
ndbout
<<
"Configuration error: Unable to retrieve local config"
<<
endl
;
m_local_config
->
printError
();
m_local_config
->
printUsage
();
DBUG_RETURN
(
-
1
);
}
}
m_config_retriever
=
new
ConfigRetriever
(
*
m_local_config
,
NDB_VERSION
,
NODE_TYPE_API
);
if
(
m_config_retriever
->
init
()
==
-
1
)
break
;
}
...
...
@@ -145,6 +158,8 @@ int Ndb_cluster_connection::connect(int reconnect)
Ndb_cluster_connection
::~
Ndb_cluster_connection
()
{
DBUG_ENTER
(
"~Ndb_cluster_connection"
);
DBUG_PRINT
(
"enter"
,(
"~Ndb_cluster_connection this=0x%x"
,
this
));
TransporterFacade
::
stop_instance
();
if
(
m_connect_thread
)
{
...
...
@@ -161,10 +176,12 @@ Ndb_cluster_connection::~Ndb_cluster_connection()
abort
();
TransporterFacade
::
theFacadeInstance
=
0
;
}
if
(
m_connect_string
)
free
(
m_connect_string
);
my_free
(
m_connect_string
,
MYF
(
MY_ALLOW_ZERO_PTR
));
if
(
m_config_retriever
)
delete
m_config_retriever
;
if
(
m_local_config
==
0
)
delete
m_local_config
;
DBUG_VOID_RETURN
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment