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
ed3e1bb0
Commit
ed3e1bb0
authored
Dec 22, 2004
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1
into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1
parents
beb2c1d9
263832da
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
278 additions
and
109 deletions
+278
-109
mysql-test/ndb/basic.result
mysql-test/ndb/basic.result
+4
-4
ndb/include/logger/LogHandler.hpp
ndb/include/logger/LogHandler.hpp
+21
-10
ndb/include/logger/Logger.hpp
ndb/include/logger/Logger.hpp
+2
-0
ndb/include/ndbapi/ndb_cluster_connection.hpp
ndb/include/ndbapi/ndb_cluster_connection.hpp
+1
-1
ndb/include/transporter/TransporterRegistry.hpp
ndb/include/transporter/TransporterRegistry.hpp
+6
-1
ndb/include/util/ndb_opts.h
ndb/include/util/ndb_opts.h
+1
-1
ndb/src/common/logger/LogHandler.cpp
ndb/src/common/logger/LogHandler.cpp
+54
-8
ndb/src/common/logger/Logger.cpp
ndb/src/common/logger/Logger.cpp
+2
-2
ndb/src/common/transporter/Makefile.am
ndb/src/common/transporter/Makefile.am
+1
-1
ndb/src/common/transporter/SCI_Transporter.cpp
ndb/src/common/transporter/SCI_Transporter.cpp
+2
-1
ndb/src/common/transporter/SHM_Transporter.cpp
ndb/src/common/transporter/SHM_Transporter.cpp
+5
-1
ndb/src/common/transporter/TCP_Transporter.cpp
ndb/src/common/transporter/TCP_Transporter.cpp
+2
-1
ndb/src/common/transporter/Transporter.cpp
ndb/src/common/transporter/Transporter.cpp
+49
-8
ndb/src/common/transporter/Transporter.hpp
ndb/src/common/transporter/Transporter.hpp
+3
-1
ndb/src/common/transporter/TransporterRegistry.cpp
ndb/src/common/transporter/TransporterRegistry.cpp
+91
-42
ndb/src/kernel/main.cpp
ndb/src/kernel/main.cpp
+1
-1
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+18
-19
ndb/src/mgmsrv/main.cpp
ndb/src/mgmsrv/main.cpp
+5
-5
ndb/src/ndbapi/ndb_cluster_connection.cpp
ndb/src/ndbapi/ndb_cluster_connection.cpp
+9
-1
sql/mysqld.cc
sql/mysqld.cc
+1
-1
No files found.
mysql-test/ndb/basic.result
View file @
ed3e1bb0
...
...
@@ -31,12 +31,12 @@ QUIT Quit management client
<id> = ALL | Any database node id
Connected to Management Server at: localhost:1186
Node 1: started (Version 4.1.
8
)
Node 2: started (Version 4.1.
8
)
Node 1: started (Version 4.1.
9
)
Node 2: started (Version 4.1.
9
)
Node 1: started (Version 4.1.
8
)
Node 1: started (Version 4.1.
9
)
Node 2: started (Version 4.1.
8
)
Node 2: started (Version 4.1.
9
)
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
...
...
ndb/include/logger/LogHandler.hpp
View file @
ed3e1bb0
...
...
@@ -19,7 +19,6 @@
#include "Logger.hpp"
/**
* This class is the base class for all log handlers. A log handler is
* responsible for formatting and writing log messages to a specific output.
...
...
@@ -68,7 +67,8 @@ public:
/**
* Append a log message to the output stream/file whatever.
* append() will call writeHeader(), writeMessage() and writeFooter() for
* a child class and in that order.
* a child class and in that order. Append checks for repeated messages.
* append_impl() does not check for repeats.
*
* @param pCategory the category/name to tag the log entry with.
* @param level the log level.
...
...
@@ -76,6 +76,8 @@ public:
*/
void
append
(
const
char
*
pCategory
,
Logger
::
LoggerLevel
level
,
const
char
*
pMsg
);
void
append_impl
(
const
char
*
pCategory
,
Logger
::
LoggerLevel
level
,
const
char
*
pMsg
);
/**
* Returns a default formatted header. It currently has the
...
...
@@ -111,14 +113,6 @@ public:
*/
void
setDateTimeFormat
(
const
char
*
pFormat
);
/**
* Returns a string date and time string.
*
* @param pStr a string.
* @return a string with date and time.
*/
char
*
getTimeAsString
(
char
*
pStr
)
const
;
/**
* Returns the error code.
*/
...
...
@@ -185,6 +179,15 @@ protected:
virtual
void
writeFooter
()
=
0
;
private:
/**
* Returns a string date and time string.
* @note does not update time, uses m_now as time
* @param pStr a string.
* @return a string with date and time.
*/
char
*
getTimeAsString
(
char
*
pStr
)
const
;
time_t
m_now
;
/** Prohibit */
LogHandler
(
const
LogHandler
&
);
LogHandler
*
operator
=
(
const
LogHandler
&
);
...
...
@@ -192,6 +195,14 @@ private:
const
char
*
m_pDateTimeFormat
;
int
m_errorCode
;
// for handling repeated messages
unsigned
m_count_repeated_messages
;
unsigned
m_max_repeat_frequency
;
time_t
m_last_log_time
;
char
m_last_category
[
MAX_HEADER_LENGTH
];
char
m_last_message
[
MAX_LOG_MESSAGE_SIZE
];
Logger
::
LoggerLevel
m_last_level
;
};
#endif
ndb/include/logger/Logger.hpp
View file @
ed3e1bb0
...
...
@@ -20,6 +20,8 @@
#include <ndb_global.h>
#include <BaseString.hpp>
#define MAX_LOG_MESSAGE_SIZE 1024
class
LogHandler
;
class
LogHandlerList
;
...
...
ndb/include/ndbapi/ndb_cluster_connection.hpp
View file @
ed3e1bb0
...
...
@@ -82,7 +82,7 @@ public:
void
set_optimized_node_selection
(
int
val
);
int
no_db_nodes
();
unsigned
no_db_nodes
();
#endif
private:
...
...
ndb/include/transporter/TransporterRegistry.hpp
View file @
ed3e1bb0
...
...
@@ -100,6 +100,11 @@ public:
bool
init
(
NodeId
localNodeId
);
/**
* after a connect from client, perform connection using correct transporter
*/
bool
connect_server
(
NDB_SOCKET_TYPE
sockfd
);
/**
* Remove all transporters
*/
...
...
ndb/include/util/ndb_opts.h
View file @
ed3e1bb0
...
...
@@ -34,7 +34,7 @@ OPT_NDB_OPTIMIZED_NODE_SELECTION
#define OPT_NDB_CONNECTSTRING 'c'
#if
def NDB_SHM_TRANSPORTER
#if
defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
#define OPT_NDB_SHM_DEFAULT 1
#else
#define OPT_NDB_SHM_DEFAULT 0
...
...
ndb/src/common/logger/LogHandler.cpp
View file @
ed3e1bb0
...
...
@@ -25,6 +25,12 @@ LogHandler::LogHandler() :
m_pDateTimeFormat
(
"%d-%.2d-%.2d %.2d:%.2d:%.2d"
),
m_errorCode
(
0
)
{
m_max_repeat_frequency
=
3
;
// repeat messages maximum every 3 seconds
m_count_repeated_messages
=
0
;
m_last_category
[
0
]
=
0
;
m_last_message
[
0
]
=
0
;
m_last_log_time
=
0
;
m_now
=
0
;
}
LogHandler
::~
LogHandler
()
...
...
@@ -34,9 +40,51 @@ LogHandler::~LogHandler()
void
LogHandler
::
append
(
const
char
*
pCategory
,
Logger
::
LoggerLevel
level
,
const
char
*
pMsg
)
{
time_t
now
;
now
=
::
time
((
time_t
*
)
NULL
);
if
(
level
!=
m_last_level
||
strcmp
(
pCategory
,
m_last_category
)
||
strcmp
(
pMsg
,
m_last_message
))
{
if
(
m_count_repeated_messages
>
0
)
// print that message
append_impl
(
m_last_category
,
m_last_level
,
m_last_message
);
m_last_level
=
level
;
strncpy
(
m_last_category
,
pCategory
,
sizeof
(
m_last_category
));
strncpy
(
m_last_message
,
pMsg
,
sizeof
(
m_last_message
));
}
else
// repeated message
{
if
(
now
<
m_last_log_time
+
m_max_repeat_frequency
)
{
m_count_repeated_messages
++
;
m_now
=
now
;
return
;
}
}
m_now
=
now
;
append_impl
(
pCategory
,
level
,
pMsg
);
m_last_log_time
=
now
;
}
void
LogHandler
::
append_impl
(
const
char
*
pCategory
,
Logger
::
LoggerLevel
level
,
const
char
*
pMsg
)
{
writeHeader
(
pCategory
,
level
);
if
(
m_count_repeated_messages
==
0
)
writeMessage
(
pMsg
);
else
{
BaseString
str
(
pMsg
);
str
.
appfmt
(
" - Repeated %d times"
,
m_count_repeated_messages
);
writeMessage
(
str
.
c_str
());
m_count_repeated_messages
=
0
;
}
writeFooter
();
}
...
...
@@ -76,12 +124,10 @@ char*
LogHandler
::
getTimeAsString
(
char
*
pStr
)
const
{
struct
tm
*
tm_now
;
time_t
now
;
now
=
::
time
((
time_t
*
)
NULL
);
#ifdef NDB_WIN32
tm_now
=
localtime
(
&
now
);
tm_now
=
localtime
(
&
m_
now
);
#else
tm_now
=
::
localtime
(
&
now
);
//uses the "current" timezone
tm_now
=
::
localtime
(
&
m_
now
);
//uses the "current" timezone
#endif
BaseString
::
snprintf
(
pStr
,
MAX_DATE_TIME_HEADER_LENGTH
,
...
...
ndb/src/common/logger/Logger.cpp
View file @
ed3e1bb0
...
...
@@ -355,7 +355,7 @@ Logger::log(LoggerLevel logLevel, const char* pMsg, va_list ap) const
LogHandler
*
pHandler
=
NULL
;
while
(
(
pHandler
=
m_pHandlerList
->
next
())
!=
NULL
)
{
char
buf
[
1024
];
char
buf
[
MAX_LOG_MESSAGE_SIZE
];
BaseString
::
vsnprintf
(
buf
,
sizeof
(
buf
),
pMsg
,
ap
);
pHandler
->
append
(
m_pCategory
,
logLevel
,
buf
);
}
...
...
ndb/src/common/transporter/Makefile.am
View file @
ed3e1bb0
...
...
@@ -13,7 +13,7 @@ EXTRA_libtransporter_la_SOURCES = SHM_Transporter.cpp SHM_Transporter.unix.cpp S
libtransporter_la_LIBADD
=
@ndb_transporter_opt_objs@
libtransporter_la_DEPENDENCIES
=
@ndb_transporter_opt_objs@
INCLUDES_LOC
=
-I
$(top_srcdir)
/ndb/include/kernel
-I
$(top_srcdir)
/ndb/include/transporter @NDB_SCI_INCLUDES@
INCLUDES_LOC
=
-I
$(top_srcdir)
/ndb/include/
mgmapi
-I
$(top_srcdir)
/ndb/include/debugger
-I
$(top_srcdir)
/ndb/include/
kernel
-I
$(top_srcdir)
/ndb/include/transporter @NDB_SCI_INCLUDES@
include
$(top_srcdir)/ndb/config/common.mk.am
include
$(top_srcdir)/ndb/config/type_util.mk.am
...
...
ndb/src/common/transporter/SCI_Transporter.cpp
View file @
ed3e1bb0
...
...
@@ -44,7 +44,8 @@ SCI_Transporter::SCI_Transporter(TransporterRegistry &t_reg,
bool
chksm
,
bool
signalId
,
Uint32
reportFreq
)
:
Transporter
(
t_reg
,
lHostName
,
rHostName
,
r_port
,
_localNodeId
,
Transporter
(
t_reg
,
tt_SCI_TRANSPORTER
,
lHostName
,
rHostName
,
r_port
,
_localNodeId
,
_remoteNodeId
,
0
,
false
,
chksm
,
signalId
)
{
DBUG_ENTER
(
"SCI_Transporter::SCI_Transporter"
);
...
...
ndb/src/common/transporter/SHM_Transporter.cpp
View file @
ed3e1bb0
...
...
@@ -38,7 +38,8 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
bool
signalId
,
key_t
_shmKey
,
Uint32
_shmSize
)
:
Transporter
(
t_reg
,
lHostName
,
rHostName
,
r_port
,
lNodeId
,
rNodeId
,
Transporter
(
t_reg
,
tt_SHM_TRANSPORTER
,
lHostName
,
rHostName
,
r_port
,
lNodeId
,
rNodeId
,
0
,
false
,
checksum
,
signalId
),
shmKey
(
_shmKey
),
shmSize
(
_shmSize
)
...
...
@@ -256,6 +257,9 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
SocketOutputStream
s_output
(
sockfd
);
char
buf
[
256
];
#if 1
#endif
// Wait for server to create and attach
if
(
s_input
.
gets
(
buf
,
256
)
==
0
)
{
NDB_CLOSE_SOCKET
(
sockfd
);
...
...
ndb/src/common/transporter/TCP_Transporter.cpp
View file @
ed3e1bb0
...
...
@@ -72,7 +72,8 @@ TCP_Transporter::TCP_Transporter(TransporterRegistry &t_reg,
NodeId
rNodeId
,
bool
chksm
,
bool
signalId
,
Uint32
_reportFreq
)
:
Transporter
(
t_reg
,
lHostName
,
rHostName
,
r_port
,
lNodeId
,
rNodeId
,
Transporter
(
t_reg
,
tt_TCP_TRANSPORTER
,
lHostName
,
rHostName
,
r_port
,
lNodeId
,
rNodeId
,
0
,
false
,
chksm
,
signalId
),
m_sendBuffer
(
sendBufSize
)
{
...
...
ndb/src/common/transporter/Transporter.cpp
View file @
ed3e1bb0
...
...
@@ -24,7 +24,11 @@
#include <InputStream.hpp>
#include <OutputStream.hpp>
#include <EventLogger.hpp>
extern
EventLogger
g_eventLogger
;
Transporter
::
Transporter
(
TransporterRegistry
&
t_reg
,
TransporterType
_type
,
const
char
*
lHostName
,
const
char
*
rHostName
,
int
r_port
,
...
...
@@ -35,6 +39,7 @@ Transporter::Transporter(TransporterRegistry &t_reg,
:
m_r_port
(
r_port
),
remoteNodeId
(
rNodeId
),
localNodeId
(
lNodeId
),
isServer
(
lNodeId
<
rNodeId
),
m_packer
(
_signalId
,
_checksum
),
m_type
(
_type
),
m_transporter_registry
(
t_reg
)
{
DBUG_ENTER
(
"Transporter::Transporter"
);
...
...
@@ -73,7 +78,8 @@ Transporter::Transporter(TransporterRegistry &t_reg,
m_socket_client
=
0
;
else
m_socket_client
=
new
SocketClient
(
remoteHostName
,
r_port
,
new
SocketAuthSimple
(
"ndbd"
,
"ndbd passwd"
));
new
SocketAuthSimple
(
"ndbd"
,
"ndbd passwd"
));
DBUG_VOID_RETURN
;
}
...
...
@@ -84,7 +90,9 @@ Transporter::~Transporter(){
bool
Transporter
::
connect_server
(
NDB_SOCKET_TYPE
sockfd
)
{
// all initial negotiation is done in TransporterRegistry::connect_server
DBUG_ENTER
(
"Transporter::connect_server"
);
if
(
m_connected
)
{
DBUG_RETURN
(
true
);
// TODO assert(0);
...
...
@@ -108,27 +116,60 @@ Transporter::connect_client() {
if
(
sockfd
==
NDB_INVALID_SOCKET
)
return
false
;
DBUG_ENTER
(
"Transporter::connect_client"
);
// send info about own id
// send info about own transporter type
SocketOutputStream
s_output
(
sockfd
);
s_output
.
println
(
"%d
"
,
localNodeId
);
s_output
.
println
(
"%d
%d"
,
localNodeId
,
m_type
);
// get remote id
int
nodeId
;
int
nodeId
,
remote_transporter_type
=
-
1
;
SocketInputStream
s_input
(
sockfd
);
char
buf
[
256
];
if
(
s_input
.
gets
(
buf
,
256
)
==
0
)
{
NDB_CLOSE_SOCKET
(
sockfd
);
return
false
;
DBUG_RETURN
(
false
)
;
}
if
(
sscanf
(
buf
,
"%d"
,
&
nodeId
)
!=
1
)
{
int
r
=
sscanf
(
buf
,
"%d %d"
,
&
nodeId
,
&
remote_transporter_type
);
switch
(
r
)
{
case
2
:
break
;
case
1
:
// we're running version prior to 4.1.9
// ok, but with no checks on transporter configuration compatability
break
;
default:
NDB_CLOSE_SOCKET
(
sockfd
);
return
false
;
DBUG_RETURN
(
false
)
;
}
DBUG_PRINT
(
"info"
,
(
"nodeId=%d remote_transporter_type=%d"
,
nodeId
,
remote_transporter_type
));
if
(
remote_transporter_type
!=
-
1
)
{
if
(
remote_transporter_type
!=
m_type
)
{
DBUG_PRINT
(
"error"
,
(
"Transporter types mismatch this=%d remote=%d"
,
m_type
,
remote_transporter_type
));
NDB_CLOSE_SOCKET
(
sockfd
);
g_eventLogger
.
error
(
"Incompatible configuration: transporter type "
"mismatch with node %d"
,
nodeId
);
DBUG_RETURN
(
false
);
}
}
else
if
(
m_type
==
tt_SHM_TRANSPORTER
)
{
g_eventLogger
.
warning
(
"Unable to verify transporter compatability with node %d"
,
nodeId
);
}
bool
res
=
connect_client_impl
(
sockfd
);
if
(
res
){
m_connected
=
true
;
m_errorCount
=
0
;
}
return
res
;
DBUG_RETURN
(
res
)
;
}
void
...
...
ndb/src/common/transporter/Transporter.hpp
View file @
ed3e1bb0
...
...
@@ -71,6 +71,7 @@ public:
protected:
Transporter
(
TransporterRegistry
&
,
TransporterType
,
const
char
*
lHostName
,
const
char
*
rHostName
,
int
r_port
,
...
...
@@ -127,6 +128,7 @@ protected:
protected:
bool
m_connected
;
// Are we connected
TransporterType
m_type
;
TransporterRegistry
&
m_transporter_registry
;
void
*
get_callback_obj
()
{
return
m_transporter_registry
.
callbackObj
;
};
...
...
@@ -149,7 +151,7 @@ Transporter::getRemoteNodeId() const {
inline
NodeId
Transporter
::
getLocalNodeId
()
const
{
return
remote
NodeId
;
return
local
NodeId
;
}
inline
...
...
ndb/src/common/transporter/TransporterRegistry.cpp
View file @
ed3e1bb0
...
...
@@ -47,6 +47,9 @@
#include <InputStream.hpp>
#include <OutputStream.hpp>
#include <EventLogger.hpp>
extern
EventLogger
g_eventLogger
;
int
g_shm_pid
=
0
;
SocketServer
::
Session
*
TransporterService
::
newSession
(
NDB_SOCKET_TYPE
sockfd
)
...
...
@@ -57,51 +60,12 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
DBUG_RETURN
(
0
);
}
if
(
!
m_transporter_registry
->
connect_server
(
sockfd
))
{
// read node id from client
int
nodeId
;
SocketInputStream
s_input
(
sockfd
);
char
buf
[
256
];
if
(
s_input
.
gets
(
buf
,
256
)
==
0
)
{
NDB_CLOSE_SOCKET
(
sockfd
);
DBUG_PRINT
(
"error"
,
(
"Could not get node id from client"
));
DBUG_RETURN
(
0
);
}
if
(
sscanf
(
buf
,
"%d"
,
&
nodeId
)
!=
1
)
{
NDB_CLOSE_SOCKET
(
sockfd
);
DBUG_PRINT
(
"error"
,
(
"Error in node id from client"
));
DBUG_RETURN
(
0
);
}
//check that nodeid is valid and that there is an allocated transporter
if
(
nodeId
<
0
||
nodeId
>=
(
int
)
m_transporter_registry
->
maxTransporters
)
{
NDB_CLOSE_SOCKET
(
sockfd
);
DBUG_PRINT
(
"error"
,
(
"Node id out of range from client"
));
DBUG_RETURN
(
0
);
}
if
(
m_transporter_registry
->
theTransporters
[
nodeId
]
==
0
)
{
NDB_CLOSE_SOCKET
(
sockfd
);
DBUG_PRINT
(
"error"
,
(
"No transporter for this node id from client"
));
DBUG_RETURN
(
0
);
}
//check that the transporter should be connected
if
(
m_transporter_registry
->
performStates
[
nodeId
]
!=
TransporterRegistry
::
CONNECTING
)
{
NDB_CLOSE_SOCKET
(
sockfd
);
DBUG_PRINT
(
"error"
,
(
"Transporter in wrong state for this node id from client"
));
DBUG_RETURN
(
0
);
}
Transporter
*
t
=
m_transporter_registry
->
theTransporters
[
nodeId
];
// send info about own id (just as response to acknowledge connection)
SocketOutputStream
s_output
(
sockfd
);
s_output
.
println
(
"%d"
,
t
->
getLocalNodeId
());
// setup transporter (transporter responsible for closing sockfd)
t
->
connect_server
(
sockfd
);
}
DBUG_RETURN
(
0
);
}
...
...
@@ -195,6 +159,91 @@ TransporterRegistry::init(NodeId nodeId) {
return
true
;
}
bool
TransporterRegistry
::
connect_server
(
NDB_SOCKET_TYPE
sockfd
)
{
DBUG_ENTER
(
"TransporterRegistry::connect_server"
);
// read node id from client
// read transporter type
int
nodeId
,
remote_transporter_type
=
-
1
;
SocketInputStream
s_input
(
sockfd
);
char
buf
[
256
];
if
(
s_input
.
gets
(
buf
,
256
)
==
0
)
{
DBUG_PRINT
(
"error"
,
(
"Could not get node id from client"
));
DBUG_RETURN
(
false
);
}
int
r
=
sscanf
(
buf
,
"%d %d"
,
&
nodeId
,
&
remote_transporter_type
);
switch
(
r
)
{
case
2
:
break
;
case
1
:
// we're running version prior to 4.1.9
// ok, but with no checks on transporter configuration compatability
break
;
default:
DBUG_PRINT
(
"error"
,
(
"Error in node id from client"
));
DBUG_RETURN
(
false
);
}
DBUG_PRINT
(
"info"
,
(
"nodeId=%d remote_transporter_type=%d"
,
nodeId
,
remote_transporter_type
));
//check that nodeid is valid and that there is an allocated transporter
if
(
nodeId
<
0
||
nodeId
>=
(
int
)
maxTransporters
)
{
DBUG_PRINT
(
"error"
,
(
"Node id out of range from client"
));
DBUG_RETURN
(
false
);
}
if
(
theTransporters
[
nodeId
]
==
0
)
{
DBUG_PRINT
(
"error"
,
(
"No transporter for this node id from client"
));
DBUG_RETURN
(
false
);
}
//check that the transporter should be connected
if
(
performStates
[
nodeId
]
!=
TransporterRegistry
::
CONNECTING
)
{
DBUG_PRINT
(
"error"
,
(
"Transporter in wrong state for this node id from client"
));
DBUG_RETURN
(
false
);
}
Transporter
*
t
=
theTransporters
[
nodeId
];
// send info about own id (just as response to acknowledge connection)
// send info on own transporter type
SocketOutputStream
s_output
(
sockfd
);
s_output
.
println
(
"%d %d"
,
t
->
getLocalNodeId
(),
t
->
m_type
);
if
(
remote_transporter_type
!=
-
1
)
{
if
(
remote_transporter_type
!=
t
->
m_type
)
{
DBUG_PRINT
(
"error"
,
(
"Transporter types mismatch this=%d remote=%d"
,
t
->
m_type
,
remote_transporter_type
));
g_eventLogger
.
error
(
"Incompatible configuration: Transporter type "
"mismatch with node %d"
,
nodeId
);
// wait for socket close for 1 second to let message arrive at client
{
fd_set
a_set
;
FD_ZERO
(
&
a_set
);
FD_SET
(
sockfd
,
&
a_set
);
struct
timeval
timeout
;
timeout
.
tv_sec
=
1
;
timeout
.
tv_usec
=
0
;
select
(
sockfd
+
1
,
&
a_set
,
0
,
0
,
&
timeout
);
}
DBUG_RETURN
(
false
);
}
}
else
if
(
t
->
m_type
==
tt_SHM_TRANSPORTER
)
{
g_eventLogger
.
warning
(
"Unable to verify transporter compatability with node %d"
,
nodeId
);
}
// setup transporter (transporter responsible for closing sockfd)
t
->
connect_server
(
sockfd
);
DBUG_RETURN
(
true
);
}
bool
TransporterRegistry
::
createTransporter
(
TCP_TransporterConfiguration
*
config
)
{
#ifdef NDB_TCP_TRANSPORTER
...
...
ndb/src/kernel/main.cpp
View file @
ed3e1bb0
...
...
@@ -58,7 +58,7 @@ int main(int argc, char** argv)
// Print to stdout/console
g_eventLogger
.
createConsoleHandler
();
g_eventLogger
.
setCategory
(
"NDB"
);
g_eventLogger
.
enable
(
Logger
::
LL_
INFO
,
Logger
::
LL_ALERT
);
// Log INFO to ALERT
g_eventLogger
.
enable
(
Logger
::
LL_
ON
,
Logger
::
LL_ERROR
);
globalEmulatorData
.
create
();
...
...
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
ed3e1bb0
...
...
@@ -133,8 +133,7 @@ MgmtSrvr::signalRecvThreadRun()
}
}
EventLogger
g_EventLogger
;
extern
EventLogger
g_eventLogger
;
static
NdbOut
&
operator
<<
(
NdbOut
&
out
,
const
LogLevel
&
ll
)
...
...
@@ -200,7 +199,7 @@ MgmtSrvr::logLevelThreadRun()
void
MgmtSrvr
::
startEventLog
()
{
g_
E
ventLogger
.
setCategory
(
"MgmSrvr"
);
g_
e
ventLogger
.
setCategory
(
"MgmSrvr"
);
ndb_mgm_configuration_iterator
*
iter
=
ndb_mgm_create_configuration_iterator
((
ndb_mgm_configuration
*
)
_config
->
m_configValues
,
CFG_SECTION_NODE
);
...
...
@@ -226,7 +225,7 @@ MgmtSrvr::startEventLog()
logdest
.
assfmt
(
"FILE:filename=%s,maxsize=1000000,maxfiles=6"
,
clusterLog
);
}
if
(
!
g_
E
ventLogger
.
addHandler
(
logdest
))
{
if
(
!
g_
e
ventLogger
.
addHandler
(
logdest
))
{
ndbout
<<
"Warning: could not add log destination
\"
"
<<
logdest
.
c_str
()
<<
"
\"
"
<<
endl
;
}
...
...
@@ -250,21 +249,21 @@ MgmtSrvr::setEventLogFilter(int severity, int enable)
{
Logger
::
LoggerLevel
level
=
(
Logger
::
LoggerLevel
)
severity
;
if
(
enable
>
0
)
{
g_
E
ventLogger
.
enable
(
level
);
g_
e
ventLogger
.
enable
(
level
);
}
else
if
(
enable
==
0
)
{
g_
E
ventLogger
.
disable
(
level
);
}
else
if
(
g_
E
ventLogger
.
isEnable
(
level
))
{
g_
E
ventLogger
.
disable
(
level
);
g_
e
ventLogger
.
disable
(
level
);
}
else
if
(
g_
e
ventLogger
.
isEnable
(
level
))
{
g_
e
ventLogger
.
disable
(
level
);
}
else
{
g_
E
ventLogger
.
enable
(
level
);
g_
e
ventLogger
.
enable
(
level
);
}
return
g_
E
ventLogger
.
isEnable
(
level
);
return
g_
e
ventLogger
.
isEnable
(
level
);
}
bool
MgmtSrvr
::
isEventLogFilterEnabled
(
int
severity
)
{
return
g_
E
ventLogger
.
isEnable
((
Logger
::
LoggerLevel
)
severity
);
return
g_
e
ventLogger
.
isEnable
((
Logger
::
LoggerLevel
)
severity
);
}
static
ErrorItem
errorTable
[]
=
...
...
@@ -1990,7 +1989,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
}
default:
g_
E
ventLogger
.
error
(
"Unknown signal received. SignalNumber: "
g_
e
ventLogger
.
error
(
"Unknown signal received. SignalNumber: "
"%i from (%d, %x)"
,
gsn
,
refToNode
(
signal
->
theSendersBlockRef
),
...
...
@@ -2066,7 +2065,7 @@ MgmtSrvr::handleStopReply(NodeId nodeId, Uint32 errCode)
error:
if
(
errCode
!=
0
){
g_
E
ventLogger
.
error
(
"Unexpected signal received. SignalNumber: %i from %d"
,
g_
e
ventLogger
.
error
(
"Unexpected signal received. SignalNumber: %i from %d"
,
GSN_STOP_REF
,
nodeId
);
}
}
...
...
@@ -2286,7 +2285,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
m_reserved_nodes
.
set
(
id_found
);
char
tmp_str
[
128
];
m_reserved_nodes
.
getText
(
tmp_str
);
g_
E
ventLogger
.
info
(
"Mgmt server state: nodeid %d reserved for ip %s, m_reserved_nodes %s."
,
g_
e
ventLogger
.
info
(
"Mgmt server state: nodeid %d reserved for ip %s, m_reserved_nodes %s."
,
id_found
,
get_connect_address
(
id_found
),
tmp_str
);
DBUG_RETURN
(
true
);
}
...
...
@@ -2346,7 +2345,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
*
nodeId
);
}
g_
E
ventLogger
.
warning
(
"Allocate nodeid (%d) failed. Connection from ip %s. "
g_
e
ventLogger
.
warning
(
"Allocate nodeid (%d) failed. Connection from ip %s. "
"Returned error string
\"
%s
\"
"
,
*
nodeId
,
client_addr
!=
0
?
inet_ntoa
(((
struct
sockaddr_in
*
)(
client_addr
))
->
sin_addr
)
:
"<none>"
,
...
...
@@ -2369,10 +2368,10 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
}
}
if
(
tmp_connected
.
length
()
>
0
)
g_
E
ventLogger
.
info
(
"Mgmt server state: node id's %s connected but not reserved"
,
g_
e
ventLogger
.
info
(
"Mgmt server state: node id's %s connected but not reserved"
,
tmp_connected
.
c_str
());
if
(
tmp_not_connected
.
length
()
>
0
)
g_
E
ventLogger
.
info
(
"Mgmt server state: node id's %s not connected but reserved"
,
g_
e
ventLogger
.
info
(
"Mgmt server state: node id's %s not connected but reserved"
,
tmp_not_connected
.
c_str
());
}
DBUG_RETURN
(
false
);
...
...
@@ -2404,7 +2403,7 @@ MgmtSrvr::eventReport(NodeId nodeId, const Uint32 * theData)
EventReport
::
EventType
type
=
eventReport
->
getEventType
();
// Log event
g_
E
ventLogger
.
log
(
type
,
theData
,
nodeId
,
g_
e
ventLogger
.
log
(
type
,
theData
,
nodeId
,
&
m_event_listner
[
0
].
m_logLevel
);
m_event_listner
.
log
(
type
,
theData
,
nodeId
);
}
...
...
@@ -2647,7 +2646,7 @@ MgmtSrvr::Allocated_resources::~Allocated_resources()
char
tmp_str
[
128
];
m_mgmsrv
.
m_reserved_nodes
.
getText
(
tmp_str
);
g_
E
ventLogger
.
info
(
"Mgmt server state: nodeid %d freed, m_reserved_nodes %s."
,
g_
e
ventLogger
.
info
(
"Mgmt server state: nodeid %d freed, m_reserved_nodes %s."
,
get_nodeid
(),
tmp_str
);
}
}
...
...
ndb/src/mgmsrv/main.cpp
View file @
ed3e1bb0
...
...
@@ -86,7 +86,7 @@ static MgmGlobals glob;
* Global variables
*/
bool
g_StopServer
;
extern
EventLogger
g_
E
ventLogger
;
extern
EventLogger
g_
e
ventLogger
;
extern
int
global_mgmt_server_check
;
...
...
@@ -303,12 +303,12 @@ int main(int argc, char** argv)
BaseString
::
snprintf
(
msg
,
sizeof
(
msg
),
"NDB Cluster Management Server. %s"
,
NDB_VERSION_STRING
);
ndbout_c
(
msg
);
g_
E
ventLogger
.
info
(
msg
);
g_
e
ventLogger
.
info
(
msg
);
BaseString
::
snprintf
(
msg
,
256
,
"Id: %d, Command port: %d"
,
glob
.
localNodeId
,
glob
.
port
);
ndbout_c
(
msg
);
g_
E
ventLogger
.
info
(
msg
);
g_
e
ventLogger
.
info
(
msg
);
g_StopServer
=
false
;
glob
.
socketServer
->
startServer
();
...
...
@@ -324,10 +324,10 @@ int main(int argc, char** argv)
NdbSleep_MilliSleep
(
500
);
}
g_
E
ventLogger
.
info
(
"Shutting down server..."
);
g_
e
ventLogger
.
info
(
"Shutting down server..."
);
glob
.
socketServer
->
stopServer
();
glob
.
socketServer
->
stopSessions
();
g_
E
ventLogger
.
info
(
"Shutdown complete"
);
g_
e
ventLogger
.
info
(
"Shutdown complete"
);
return
0
;
error_end:
return
1
;
...
...
ndb/src/ndbapi/ndb_cluster_connection.cpp
View file @
ed3e1bb0
...
...
@@ -31,6 +31,9 @@
#include <Vector.hpp>
#include <md5_hash.hpp>
#include <EventLogger.hpp>
EventLogger
g_eventLogger
;
static
int
g_run_connect_thread
=
0
;
#include <NdbMutex.h>
...
...
@@ -174,7 +177,7 @@ Ndb_cluster_connection_impl::get_next_node(Ndb_cluster_connection_node_iter &ite
return
node
.
id
;
}
int
unsigned
Ndb_cluster_connection
::
no_db_nodes
()
{
return
m_impl
.
m_all_nodes
.
size
();
...
...
@@ -248,6 +251,11 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
{
DBUG_ENTER
(
"Ndb_cluster_connection"
);
DBUG_PRINT
(
"enter"
,(
"Ndb_cluster_connection this=0x%x"
,
this
));
g_eventLogger
.
createConsoleHandler
();
g_eventLogger
.
setCategory
(
"NdbApi"
);
g_eventLogger
.
enable
(
Logger
::
LL_ON
,
Logger
::
LL_ERROR
);
m_transporter_facade
=
TransporterFacade
::
theFacadeInstance
=
new
TransporterFacade
();
...
...
sql/mysqld.cc
View file @
ed3e1bb0
...
...
@@ -53,7 +53,7 @@
#endif
#ifdef HAVE_NDBCLUSTER_DB
#define OPT_NDBCLUSTER_DEFAULT 0
#if
def NDB_SHM_TRANSPORTER
#if
defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
#define OPT_NDB_SHM_DEFAULT 1
#else
#define OPT_NDB_SHM_DEFAULT 0
...
...
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