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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e88eba65
Commit
e88eba65
authored
Feb 23, 2005
by
stewart@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the mgm connection used for fetching configuration as a transporter.
parent
15bb6b98
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
123 additions
and
18 deletions
+123
-18
ndb/include/mgmapi/mgmapi.h
ndb/include/mgmapi/mgmapi.h
+4
-0
ndb/include/transporter/TransporterRegistry.hpp
ndb/include/transporter/TransporterRegistry.hpp
+10
-1
ndb/src/common/transporter/Transporter.cpp
ndb/src/common/transporter/Transporter.cpp
+9
-0
ndb/src/common/transporter/Transporter.hpp
ndb/src/common/transporter/Transporter.hpp
+1
-0
ndb/src/common/transporter/TransporterRegistry.cpp
ndb/src/common/transporter/TransporterRegistry.cpp
+53
-17
ndb/src/kernel/vm/Configuration.cpp
ndb/src/kernel/vm/Configuration.cpp
+3
-0
ndb/src/mgmapi/mgmapi.cpp
ndb/src/mgmapi/mgmapi.cpp
+31
-0
ndb/src/mgmsrv/Services.cpp
ndb/src/mgmsrv/Services.cpp
+10
-0
ndb/src/mgmsrv/Services.hpp
ndb/src/mgmsrv/Services.hpp
+2
-0
No files found.
ndb/include/mgmapi/mgmapi.h
View file @
e88eba65
...
@@ -996,6 +996,10 @@ extern "C" {
...
@@ -996,6 +996,10 @@ extern "C" {
*/
*/
NDB_SOCKET_TYPE
ndb_mgm_convert_to_transporter
(
NdbMgmHandle
handle
);
NDB_SOCKET_TYPE
ndb_mgm_convert_to_transporter
(
NdbMgmHandle
handle
);
/**
* Get the node id of the mgm server we're connected to
*/
Uint32
ndb_mgm_get_mgmd_nodeid
(
NdbMgmHandle
handle
);
/**
/**
* Config iterator
* Config iterator
...
...
ndb/include/transporter/TransporterRegistry.hpp
View file @
e88eba65
...
@@ -116,11 +116,20 @@ public:
...
@@ -116,11 +116,20 @@ public:
*/
*/
bool
connect_server
(
NDB_SOCKET_TYPE
sockfd
);
bool
connect_server
(
NDB_SOCKET_TYPE
sockfd
);
int
TransporterRegistry
::
connect_client
(
NdbMgmHandle
h
);
/**
/**
* use a mgmd connection to connect as a transporter
* Given a SocketClient, creates a NdbMgmHandle, turns it into a transporter
* and returns the socket.
*/
*/
NDB_SOCKET_TYPE
connect_ndb_mgmd
(
SocketClient
*
sc
);
NDB_SOCKET_TYPE
connect_ndb_mgmd
(
SocketClient
*
sc
);
/**
* Given a connected NdbMgmHandle, turns it into a transporter
* and returns the socket.
*/
NDB_SOCKET_TYPE
connect_ndb_mgmd
(
NdbMgmHandle
h
);
/**
/**
* Remove all transporters
* Remove all transporters
*/
*/
...
...
ndb/src/common/transporter/Transporter.cpp
View file @
e88eba65
...
@@ -124,6 +124,15 @@ Transporter::connect_client() {
...
@@ -124,6 +124,15 @@ Transporter::connect_client() {
else
else
sockfd
=
m_socket_client
->
connect
();
sockfd
=
m_socket_client
->
connect
();
connect_client
(
sockfd
);
}
bool
Transporter
::
connect_client
(
NDB_SOCKET_TYPE
sockfd
)
{
if
(
m_connected
)
return
true
;
if
(
sockfd
==
NDB_INVALID_SOCKET
)
if
(
sockfd
==
NDB_INVALID_SOCKET
)
return
false
;
return
false
;
...
...
ndb/src/common/transporter/Transporter.hpp
View file @
e88eba65
...
@@ -44,6 +44,7 @@ public:
...
@@ -44,6 +44,7 @@ public:
* Use isConnected() to check status
* Use isConnected() to check status
*/
*/
bool
connect_client
();
bool
connect_client
();
bool
connect_client
(
NDB_SOCKET_TYPE
sockfd
);
bool
connect_server
(
NDB_SOCKET_TYPE
socket
);
bool
connect_server
(
NDB_SOCKET_TYPE
socket
);
/**
/**
...
...
ndb/src/common/transporter/TransporterRegistry.cpp
View file @
e88eba65
...
@@ -1521,10 +1521,61 @@ TransporterRegistry::get_transporter(NodeId nodeId) {
...
@@ -1521,10 +1521,61 @@ TransporterRegistry::get_transporter(NodeId nodeId) {
return
theTransporters
[
nodeId
];
return
theTransporters
[
nodeId
];
}
}
int
TransporterRegistry
::
connect_client
(
NdbMgmHandle
h
)
{
DBUG_ENTER
(
"TransporterRegistry::connect_client(NdbMgmHandle)"
);
Uint32
mgm_nodeid
=
ndb_mgm_get_mgmd_nodeid
(
h
);
Transporter
*
t
=
theTransporters
[
mgm_nodeid
];
if
(
!
t
)
return
-
1
;
DBUG_RETURN
(
t
->
connect_client
(
connect_ndb_mgmd
(
h
)));
}
/**
* Given a connected NdbMgmHandle, turns it into a transporter
* and returns the socket.
*/
NDB_SOCKET_TYPE
TransporterRegistry
::
connect_ndb_mgmd
(
NdbMgmHandle
h
)
{
struct
ndb_mgm_reply
mgm_reply
;
if
(
h
==
NULL
)
{
return
NDB_INVALID_SOCKET
;
}
for
(
unsigned
int
i
=
0
;
i
<
m_transporter_interface
.
size
();
i
++
)
if
(
ndb_mgm_set_connection_int_parameter
(
h
,
get_localNodeId
(),
m_transporter_interface
[
i
].
m_remote_nodeId
,
CFG_CONNECTION_SERVER_PORT
,
m_transporter_interface
[
i
].
m_s_service_port
,
&
mgm_reply
)
<
0
)
{
ndb_mgm_destroy_handle
(
&
h
);
return
NDB_INVALID_SOCKET
;
}
/**
* convert_to_transporter also disposes of the handle (i.e. we don't leak
* memory here.
*/
NDB_SOCKET_TYPE
sockfd
=
ndb_mgm_convert_to_transporter
(
h
);
if
(
sockfd
==
NDB_INVALID_SOCKET
)
ndb_mgm_destroy_handle
(
&
h
);
return
sockfd
;
}
/**
* Given a SocketClient, creates a NdbMgmHandle, turns it into a transporter
* and returns the socket.
*/
NDB_SOCKET_TYPE
TransporterRegistry
::
connect_ndb_mgmd
(
SocketClient
*
sc
)
NDB_SOCKET_TYPE
TransporterRegistry
::
connect_ndb_mgmd
(
SocketClient
*
sc
)
{
{
NdbMgmHandle
h
=
ndb_mgm_create_handle
();
NdbMgmHandle
h
=
ndb_mgm_create_handle
();
struct
ndb_mgm_reply
mgm_reply
;
if
(
h
==
NULL
)
if
(
h
==
NULL
)
{
{
...
@@ -1562,22 +1613,7 @@ NDB_SOCKET_TYPE TransporterRegistry::connect_ndb_mgmd(SocketClient *sc)
...
@@ -1562,22 +1613,7 @@ NDB_SOCKET_TYPE TransporterRegistry::connect_ndb_mgmd(SocketClient *sc)
return
NDB_INVALID_SOCKET
;
return
NDB_INVALID_SOCKET
;
}
}
for
(
unsigned
int
i
=
0
;
i
<
m_transporter_interface
.
size
();
i
++
)
return
connect_ndb_mgmd
(
h
);
if
(
ndb_mgm_set_connection_int_parameter
(
h
,
get_localNodeId
(),
m_transporter_interface
[
i
].
m_remote_nodeId
,
CFG_CONNECTION_SERVER_PORT
,
m_transporter_interface
[
i
].
m_s_service_port
,
&
mgm_reply
)
<
0
)
{
ndb_mgm_destroy_handle
(
&
h
);
return
NDB_INVALID_SOCKET
;
}
NDB_SOCKET_TYPE
sockfd
=
ndb_mgm_convert_to_transporter
(
h
);
if
(
sockfd
==
NDB_INVALID_SOCKET
)
ndb_mgm_destroy_handle
(
&
h
);
return
sockfd
;
}
}
template
class
Vector
<
TransporterRegistry
::
Transporter_interface
>;
template
class
Vector
<
TransporterRegistry
::
Transporter_interface
>;
ndb/src/kernel/vm/Configuration.cpp
View file @
e88eba65
...
@@ -313,6 +313,9 @@ Configuration::setupConfiguration(){
...
@@ -313,6 +313,9 @@ Configuration::setupConfiguration(){
ERROR_SET
(
fatal
,
ERR_INVALID_CONFIG
,
"Invalid configuration fetched"
,
ERROR_SET
(
fatal
,
ERR_INVALID_CONFIG
,
"Invalid configuration fetched"
,
"No transporters configured"
);
"No transporters configured"
);
}
}
if
(
!
globalTransporterRegistry
.
connect_client
(
m_config_retriever
->
get_mgmHandle
()))
ERROR_SET
(
fatal
,
ERR_INVALID_CONFIG
,
"Connection to mgmd terminated before setup was complete"
,
"StopOnError missing"
);
}
}
/**
/**
...
...
ndb/src/mgmapi/mgmapi.cpp
View file @
e88eba65
...
@@ -2208,4 +2208,35 @@ ndb_mgm_convert_to_transporter(NdbMgmHandle handle)
...
@@ -2208,4 +2208,35 @@ ndb_mgm_convert_to_transporter(NdbMgmHandle handle)
return
s
;
return
s
;
}
}
extern
"C"
Uint32
ndb_mgm_get_mgmd_nodeid
(
NdbMgmHandle
handle
)
{
Uint32
nodeid
=
0
;
DBUG_ENTER
(
"ndb_mgm_get_mgmd_nodeid"
);
CHECK_HANDLE
(
handle
,
0
);
CHECK_CONNECTED
(
handle
,
0
);
Properties
args
;
const
ParserRow
<
ParserDummy
>
reply
[]
=
{
MGM_CMD
(
"get mgmd nodeid reply"
,
NULL
,
""
),
MGM_ARG
(
"nodeid"
,
Int
,
Mandatory
,
"Node ID"
),
MGM_END
()
};
const
Properties
*
prop
;
prop
=
ndb_mgm_call
(
handle
,
reply
,
"get mgmd nodeid"
,
&
args
);
CHECK_REPLY
(
prop
,
0
);
if
(
!
prop
->
get
(
"nodeid"
,
&
nodeid
)){
ndbout_c
(
"Unable to get value"
);
return
0
;
}
delete
prop
;
DBUG_RETURN
(
nodeid
);
}
template
class
Vector
<
const
ParserRow
<
ParserDummy
>
*>
;
template
class
Vector
<
const
ParserRow
<
ParserDummy
>
*>
;
ndb/src/mgmsrv/Services.cpp
View file @
e88eba65
...
@@ -266,6 +266,8 @@ ParserRow<MgmApiSession> commands[] = {
...
@@ -266,6 +266,8 @@ ParserRow<MgmApiSession> commands[] = {
MGM_CMD
(
"transporter connect"
,
&
MgmApiSession
::
transporter_connect
,
""
),
MGM_CMD
(
"transporter connect"
,
&
MgmApiSession
::
transporter_connect
,
""
),
MGM_CMD
(
"get mgmd nodeid"
,
&
MgmApiSession
::
get_mgmd_nodeid
,
""
),
MGM_END
()
MGM_END
()
};
};
...
@@ -1554,5 +1556,13 @@ MgmApiSession::transporter_connect(Parser_t::Context &ctx,
...
@@ -1554,5 +1556,13 @@ MgmApiSession::transporter_connect(Parser_t::Context &ctx,
m_mgmsrv
.
transporter_connect
(
s
);
m_mgmsrv
.
transporter_connect
(
s
);
}
}
void
MgmApiSession
::
get_mgmd_nodeid
(
Parser_t
::
Context
&
ctx
,
Properties
const
&
args
)
{
m_output
->
println
(
"get mgmd nodeid reply"
);
m_output
->
println
(
"nodeid:%u"
,
m_mgmsrv
.
getOwnNodeId
());
m_output
->
println
(
""
);
}
template
class
MutexVector
<
int
>;
template
class
MutexVector
<
int
>;
template
class
Vector
<
ParserRow
<
MgmApiSession
>
const
*>
;
template
class
Vector
<
ParserRow
<
MgmApiSession
>
const
*>
;
ndb/src/mgmsrv/Services.hpp
View file @
e88eba65
...
@@ -99,6 +99,8 @@ public:
...
@@ -99,6 +99,8 @@ public:
void
check_connection
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
);
void
check_connection
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
);
void
transporter_connect
(
Parser_t
::
Context
&
ctx
,
Properties
const
&
args
);
void
transporter_connect
(
Parser_t
::
Context
&
ctx
,
Properties
const
&
args
);
void
get_mgmd_nodeid
(
Parser_t
::
Context
&
ctx
,
Properties
const
&
args
);
void
repCommand
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
);
void
repCommand
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
);
};
};
...
...
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