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
02dab285
Commit
02dab285
authored
Dec 08, 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-clean
parents
3519e554
c2c61833
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
129 additions
and
88 deletions
+129
-88
mysql-test/ndb/ndbcluster.sh
mysql-test/ndb/ndbcluster.sh
+1
-2
ndb/include/debugger/EventLogger.hpp
ndb/include/debugger/EventLogger.hpp
+5
-0
ndb/include/kernel/LogLevel.hpp
ndb/include/kernel/LogLevel.hpp
+8
-4
ndb/src/common/debugger/EventLogger.cpp
ndb/src/common/debugger/EventLogger.cpp
+25
-10
ndb/src/common/portlib/NdbTCP.cpp
ndb/src/common/portlib/NdbTCP.cpp
+6
-6
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
+8
-15
ndb/src/mgmapi/mgmapi.cpp
ndb/src/mgmapi/mgmapi.cpp
+5
-2
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+18
-16
ndb/src/mgmsrv/MgmtSrvr.hpp
ndb/src/mgmsrv/MgmtSrvr.hpp
+11
-8
ndb/src/mgmsrv/Services.cpp
ndb/src/mgmsrv/Services.cpp
+38
-25
ndb/src/ndbapi/TransporterFacade.cpp
ndb/src/ndbapi/TransporterFacade.cpp
+4
-0
No files found.
mysql-test/ndb/ndbcluster.sh
View file @
02dab285
...
@@ -67,8 +67,7 @@ while test $# -gt 0; do
...
@@ -67,8 +67,7 @@ while test $# -gt 0; do
initial_ndb
=
1
initial_ndb
=
1
;;
;;
--debug
*
)
--debug
*
)
f
=
`
echo
"
$1
"
|
sed
-e
"s;--debug=;;"
`
flags_ndb
=
"
$flags_ndb
$1
"
flags_ndb
=
"
$flags_ndb
$f
"
;;
;;
--status
)
--status
)
status_ndb
=
1
status_ndb
=
1
...
...
ndb/include/debugger/EventLogger.hpp
View file @
02dab285
...
@@ -48,6 +48,11 @@ public:
...
@@ -48,6 +48,11 @@ public:
static
const
EventRepLogLevelMatrix
matrix
[];
static
const
EventRepLogLevelMatrix
matrix
[];
static
const
Uint32
matrixSize
;
static
const
Uint32
matrixSize
;
static
int
EventLoggerBase
::
event_lookup
(
int
eventType
,
LogLevel
::
EventCategory
&
cat
,
Uint32
&
threshold
,
Logger
::
LoggerLevel
&
severity
);
};
};
/**
/**
...
...
ndb/include/kernel/LogLevel.hpp
View file @
02dab285
...
@@ -73,7 +73,7 @@ public:
...
@@ -73,7 +73,7 @@ public:
/**
/**
* Note level is valid as 0-15
* Note level is valid as 0-15
*/
*/
void
setLogLevel
(
EventCategory
ec
,
Uint32
level
=
7
);
int
setLogLevel
(
EventCategory
ec
,
Uint32
level
=
7
);
/**
/**
* Get the loglevel (0-15) for a category
* Get the loglevel (0-15) for a category
...
@@ -119,10 +119,14 @@ LogLevel::clear(){
...
@@ -119,10 +119,14 @@ LogLevel::clear(){
}
}
inline
inline
void
int
LogLevel
::
setLogLevel
(
EventCategory
ec
,
Uint32
level
){
LogLevel
::
setLogLevel
(
EventCategory
ec
,
Uint32
level
){
assert
(
ec
>=
0
&&
(
Uint32
)
ec
<
LOGLEVEL_CATEGORIES
);
if
(
ec
>=
0
&&
(
Uint32
)
ec
<
LOGLEVEL_CATEGORIES
)
{
logLevelData
[
ec
]
=
(
Uint8
)
level
;
logLevelData
[
ec
]
=
(
Uint8
)
level
;
return
0
;
}
return
1
;
}
}
inline
inline
...
...
ndb/src/common/debugger/EventLogger.cpp
View file @
02dab285
...
@@ -1342,27 +1342,41 @@ operator<<(NdbOut& out, const LogLevel & ll)
...
@@ -1342,27 +1342,41 @@ operator<<(NdbOut& out, const LogLevel & ll)
return
out
;
return
out
;
}
}
void
int
EventLogger
::
log
(
int
eventType
,
const
Uint32
*
theData
,
NodeId
nodeId
,
EventLoggerBase
::
event_lookup
(
int
eventType
,
const
LogLevel
*
ll
)
LogLevel
::
EventCategory
&
cat
,
Uint32
&
threshold
,
Logger
::
LoggerLevel
&
severity
)
{
{
Uint32
threshold
=
0
;
Logger
::
LoggerLevel
severity
=
Logger
::
LL_WARNING
;
LogLevel
::
EventCategory
cat
=
LogLevel
::
llInvalid
;
for
(
unsigned
i
=
0
;
i
<
EventLoggerBase
::
matrixSize
;
i
++
){
for
(
unsigned
i
=
0
;
i
<
EventLoggerBase
::
matrixSize
;
i
++
){
if
(
EventLoggerBase
::
matrix
[
i
].
eventType
==
eventType
){
if
(
EventLoggerBase
::
matrix
[
i
].
eventType
==
eventType
){
cat
=
EventLoggerBase
::
matrix
[
i
].
eventCategory
;
cat
=
EventLoggerBase
::
matrix
[
i
].
eventCategory
;
threshold
=
EventLoggerBase
::
matrix
[
i
].
threshold
;
threshold
=
EventLoggerBase
::
matrix
[
i
].
threshold
;
severity
=
EventLoggerBase
::
matrix
[
i
].
severity
;
severity
=
EventLoggerBase
::
matrix
[
i
].
severity
;
break
;
return
0
;
}
}
}
}
return
1
;
}
void
EventLogger
::
log
(
int
eventType
,
const
Uint32
*
theData
,
NodeId
nodeId
,
const
LogLevel
*
ll
)
{
Uint32
threshold
=
0
;
Logger
::
LoggerLevel
severity
=
Logger
::
LL_WARNING
;
LogLevel
::
EventCategory
cat
=
LogLevel
::
llInvalid
;
DBUG_ENTER
(
"EventLogger::log"
);
DBUG_PRINT
(
"enter"
,(
"eventType=%d, nodeid=%d"
,
eventType
,
nodeId
));
if
(
cat
==
LogLevel
::
llInvalid
)
if
(
EventLoggerBase
::
event_lookup
(
eventType
,
cat
,
threshold
,
severity
)
)
return
;
DBUG_VOID_RETURN
;
Uint32
set
=
ll
?
ll
->
getLogLevel
(
cat
)
:
m_logLevel
.
getLogLevel
(
cat
);
Uint32
set
=
ll
?
ll
->
getLogLevel
(
cat
)
:
m_logLevel
.
getLogLevel
(
cat
);
DBUG_PRINT
(
"info"
,(
"threshold=%d, set=%d"
,
threshold
,
set
));
if
(
ll
)
DBUG_PRINT
(
"info"
,(
"m_logLevel.getLogLevel=%d"
,
m_logLevel
.
getLogLevel
(
cat
)));
if
(
threshold
<=
set
){
if
(
threshold
<=
set
){
switch
(
severity
){
switch
(
severity
){
case
Logger
:
:
LL_ALERT
:
case
Logger
:
:
LL_ALERT
:
...
@@ -1401,6 +1415,7 @@ EventLogger::log(int eventType, const Uint32* theData, NodeId nodeId,
...
@@ -1401,6 +1415,7 @@ EventLogger::log(int eventType, const Uint32* theData, NodeId nodeId,
break
;
break
;
}
}
}
// if (..
}
// if (..
DBUG_VOID_RETURN
;
}
}
int
int
...
...
ndb/src/common/portlib/NdbTCP.cpp
View file @
02dab285
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
extern
"C"
extern
"C"
int
int
Ndb_getInAddr
(
struct
in_addr
*
dst
,
const
char
*
address
)
{
Ndb_getInAddr
(
struct
in_addr
*
dst
,
const
char
*
address
)
{
DBUG_ENTER
(
"Ndb_getInAddr"
);
//
DBUG_ENTER("Ndb_getInAddr");
{
{
int
tmp_errno
;
int
tmp_errno
;
struct
hostent
tmp_hostent
,
*
hp
;
struct
hostent
tmp_hostent
,
*
hp
;
...
@@ -33,7 +33,7 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
...
@@ -33,7 +33,7 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
{
{
memcpy
(
dst
,
hp
->
h_addr
,
min
(
sizeof
(
*
dst
),
(
size_t
)
hp
->
h_length
));
memcpy
(
dst
,
hp
->
h_addr
,
min
(
sizeof
(
*
dst
),
(
size_t
)
hp
->
h_length
));
my_gethostbyname_r_free
();
my_gethostbyname_r_free
();
DBUG_RETURN
(
0
);
return
0
;
//
DBUG_RETURN(0);
}
}
my_gethostbyname_r_free
();
my_gethostbyname_r_free
();
}
}
...
@@ -47,11 +47,11 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
...
@@ -47,11 +47,11 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
#endif
#endif
)
)
{
{
DBUG_RETURN
(
0
);
return
0
;
//
DBUG_RETURN(0);
}
}
DBUG_PRINT
(
"error"
,(
"inet_addr(%s) - %d - %s"
,
//
DBUG_PRINT("error",("inet_addr(%s) - %d - %s",
address
,
errno
,
strerror
(
errno
)));
//
address, errno, strerror(errno)));
DBUG_RETURN
(
-
1
);
return
-
1
;
//
DBUG_RETURN(-1);
}
}
#if 0
#if 0
...
...
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
View file @
02dab285
...
@@ -193,21 +193,11 @@ void Cmvmi::execEVENT_REP(Signal* signal)
...
@@ -193,21 +193,11 @@ void Cmvmi::execEVENT_REP(Signal* signal)
/**
/**
* If entry is not found
* If entry is not found
*/
*/
Uint32
threshold
=
16
;
Uint32
threshold
;
LogLevel
::
EventCategory
eventCategory
=
(
LogLevel
::
EventCategory
)
0
;
LogLevel
::
EventCategory
eventCategory
;
Logger
::
LoggerLevel
severity
;
for
(
unsigned
int
i
=
0
;
i
<
EventLoggerBase
::
matrixSize
;
i
++
){
if
(
EventLoggerBase
::
event_lookup
(
eventType
,
eventCategory
,
threshold
,
severity
))
if
(
EventLoggerBase
::
matrix
[
i
].
eventType
==
eventType
){
eventCategory
=
EventLoggerBase
::
matrix
[
i
].
eventCategory
;
threshold
=
EventLoggerBase
::
matrix
[
i
].
threshold
;
break
;
}
}
if
(
threshold
>
15
){
// No entry found in matrix (or event that should never be printed)
return
;
return
;
}
SubscriberPtr
ptr
;
SubscriberPtr
ptr
;
for
(
subscribers
.
first
(
ptr
);
ptr
.
i
!=
RNIL
;
subscribers
.
next
(
ptr
)){
for
(
subscribers
.
first
(
ptr
);
ptr
.
i
!=
RNIL
;
subscribers
.
next
(
ptr
)){
...
@@ -225,14 +215,15 @@ void Cmvmi::execEVENT_REP(Signal* signal)
...
@@ -225,14 +215,15 @@ void Cmvmi::execEVENT_REP(Signal* signal)
// Print the event info
// Print the event info
g_eventLogger
.
log
(
eventReport
->
getEventType
(),
signal
->
theData
);
g_eventLogger
.
log
(
eventReport
->
getEventType
(),
signal
->
theData
);
return
;
}
//execEVENT_REP()
}
//execEVENT_REP()
void
void
Cmvmi
::
execEVENT_SUBSCRIBE_REQ
(
Signal
*
signal
){
Cmvmi
::
execEVENT_SUBSCRIBE_REQ
(
Signal
*
signal
){
EventSubscribeReq
*
subReq
=
(
EventSubscribeReq
*
)
&
signal
->
theData
[
0
];
EventSubscribeReq
*
subReq
=
(
EventSubscribeReq
*
)
&
signal
->
theData
[
0
];
SubscriberPtr
ptr
;
SubscriberPtr
ptr
;
jamEntry
();
jamEntry
();
DBUG_ENTER
(
"Cmvmi::execEVENT_SUBSCRIBE_REQ"
);
/**
/**
* Search for subcription
* Search for subcription
...
@@ -269,11 +260,13 @@ Cmvmi::execEVENT_SUBSCRIBE_REQ(Signal * signal){
...
@@ -269,11 +260,13 @@ Cmvmi::execEVENT_SUBSCRIBE_REQ(Signal * signal){
category
=
(
LogLevel
::
EventCategory
)(
subReq
->
theData
[
i
]
>>
16
);
category
=
(
LogLevel
::
EventCategory
)(
subReq
->
theData
[
i
]
>>
16
);
level
=
subReq
->
theData
[
i
]
&
0xFFFF
;
level
=
subReq
->
theData
[
i
]
&
0xFFFF
;
ptr
.
p
->
logLevel
.
setLogLevel
(
category
,
level
);
ptr
.
p
->
logLevel
.
setLogLevel
(
category
,
level
);
DBUG_PRINT
(
"info"
,(
"entry %d: level=%d, category= %d"
,
i
,
level
,
category
));
}
}
}
}
signal
->
theData
[
0
]
=
ptr
.
i
;
signal
->
theData
[
0
]
=
ptr
.
i
;
sendSignal
(
ptr
.
p
->
blockRef
,
GSN_EVENT_SUBSCRIBE_CONF
,
signal
,
1
,
JBB
);
sendSignal
(
ptr
.
p
->
blockRef
,
GSN_EVENT_SUBSCRIBE_CONF
,
signal
,
1
,
JBB
);
DBUG_VOID_RETURN
;
}
}
void
void
...
...
ndb/src/mgmapi/mgmapi.cpp
View file @
02dab285
...
@@ -1102,15 +1102,18 @@ ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId,
...
@@ -1102,15 +1102,18 @@ ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int nodeId,
"set cluster loglevel"
,
&
args
);
"set cluster loglevel"
,
&
args
);
CHECK_REPLY
(
reply
,
-
1
);
CHECK_REPLY
(
reply
,
-
1
);
DBUG_ENTER
(
"ndb_mgm_set_loglevel_clusterlog"
);
DBUG_PRINT
(
"enter"
,(
"node=%d, category=%d, level=%d"
,
nodeId
,
cat
,
level
));
BaseString
result
;
BaseString
result
;
reply
->
get
(
"result"
,
result
);
reply
->
get
(
"result"
,
result
);
if
(
strcmp
(
result
.
c_str
(),
"Ok"
)
!=
0
)
{
if
(
strcmp
(
result
.
c_str
(),
"Ok"
)
!=
0
)
{
SET_ERROR
(
handle
,
EINVAL
,
result
.
c_str
());
SET_ERROR
(
handle
,
EINVAL
,
result
.
c_str
());
delete
reply
;
delete
reply
;
return
-
1
;
DBUG_RETURN
(
-
1
)
;
}
}
delete
reply
;
delete
reply
;
return
0
;
DBUG_RETURN
(
0
)
;
}
}
extern
"C"
extern
"C"
...
...
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
02dab285
...
@@ -153,7 +153,7 @@ MgmtSrvr::logLevelThreadRun()
...
@@ -153,7 +153,7 @@ MgmtSrvr::logLevelThreadRun()
* Handle started nodes
* Handle started nodes
*/
*/
EventSubscribeReq
req
;
EventSubscribeReq
req
;
req
=
m_
statisticsListner
.
m_clients
[
0
].
m_logLevel
;
req
=
m_
event_listner
[
0
].
m_logLevel
;
req
.
blockRef
=
_ownReference
;
req
.
blockRef
=
_ownReference
;
SetLogLevelOrd
ord
;
SetLogLevelOrd
ord
;
...
@@ -409,7 +409,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
...
@@ -409,7 +409,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
_ownReference
(
0
),
_ownReference
(
0
),
theSignalIdleList
(
NULL
),
theSignalIdleList
(
NULL
),
theWaitState
(
WAIT_SUBSCRIBE_CONF
),
theWaitState
(
WAIT_SUBSCRIBE_CONF
),
m_
statisticsL
istner
(
this
)
m_
event_l
istner
(
this
)
{
{
DBUG_ENTER
(
"MgmtSrvr::MgmtSrvr"
);
DBUG_ENTER
(
"MgmtSrvr::MgmtSrvr"
);
...
@@ -547,16 +547,18 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
...
@@ -547,16 +547,18 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
}
}
}
}
// Setup clusterlog as client[0] in m_event_listner
{
{
MgmStatService
::
StatL
istener
se
;
Ndb_mgmd_event_service
::
Event_l
istener
se
;
se
.
m_socket
=
-
1
;
se
.
m_socket
=
-
1
;
for
(
size_t
t
=
0
;
t
<
LogLevel
::
LOGLEVEL_CATEGORIES
;
t
++
){
for
(
size_t
t
=
0
;
t
<
LogLevel
::
LOGLEVEL_CATEGORIES
;
t
++
){
se
.
m_logLevel
.
setLogLevel
((
LogLevel
::
EventCategory
)
t
,
7
);
se
.
m_logLevel
.
setLogLevel
((
LogLevel
::
EventCategory
)
t
,
7
);
}
}
se
.
m_logLevel
.
setLogLevel
(
LogLevel
::
llError
,
15
);
se
.
m_logLevel
.
setLogLevel
(
LogLevel
::
llError
,
15
);
se
.
m_logLevel
.
setLogLevel
(
LogLevel
::
llConnection
,
8
);
se
.
m_logLevel
.
setLogLevel
(
LogLevel
::
llBackup
,
15
);
se
.
m_logLevel
.
setLogLevel
(
LogLevel
::
llBackup
,
15
);
m_
statisticsL
istner
.
m_clients
.
push_back
(
se
);
m_
event_l
istner
.
m_clients
.
push_back
(
se
);
m_
statisticsL
istner
.
m_logLevel
=
se
.
m_logLevel
;
m_
event_l
istner
.
m_logLevel
=
se
.
m_logLevel
;
}
}
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -2071,21 +2073,18 @@ MgmtSrvr::handleStopReply(NodeId nodeId, Uint32 errCode)
...
@@ -2071,21 +2073,18 @@ MgmtSrvr::handleStopReply(NodeId nodeId, Uint32 errCode)
void
void
MgmtSrvr
::
handleStatus
(
NodeId
nodeId
,
bool
alive
)
MgmtSrvr
::
handleStatus
(
NodeId
nodeId
,
bool
alive
)
{
{
DBUG_ENTER
(
"MgmtSrvr::handleStatus"
);
Uint32
theData
[
25
];
theData
[
1
]
=
nodeId
;
if
(
alive
)
{
if
(
alive
)
{
m_started_nodes
.
push_back
(
nodeId
);
m_started_nodes
.
push_back
(
nodeId
);
Uint32
theData
[
25
];
theData
[
0
]
=
EventReport
::
Connected
;
theData
[
0
]
=
EventReport
::
Connected
;
theData
[
1
]
=
nodeId
;
eventReport
(
_ownNodeId
,
theData
);
}
else
{
}
else
{
handleStopReply
(
nodeId
,
0
);
handleStopReply
(
nodeId
,
0
);
Uint32
theData
[
25
];
theData
[
0
]
=
EventReport
::
Disconnected
;
theData
[
0
]
=
EventReport
::
Disconnected
;
theData
[
1
]
=
nodeId
;
eventReport
(
_ownNodeId
,
theData
);
}
}
eventReport
(
_ownNodeId
,
theData
);
DBUG_VOID_RETURN
;
}
}
//****************************************************************************
//****************************************************************************
...
@@ -2106,8 +2105,11 @@ void
...
@@ -2106,8 +2105,11 @@ void
MgmtSrvr
::
nodeStatusNotification
(
void
*
mgmSrv
,
Uint32
nodeId
,
MgmtSrvr
::
nodeStatusNotification
(
void
*
mgmSrv
,
Uint32
nodeId
,
bool
alive
,
bool
nfComplete
)
bool
alive
,
bool
nfComplete
)
{
{
DBUG_ENTER
(
"MgmtSrvr::nodeStatusNotification"
);
DBUG_PRINT
(
"enter"
,(
"nodeid= %d, alive= %d, nfComplete= %d"
,
nodeId
,
alive
,
nfComplete
));
if
(
!
(
!
alive
&&
nfComplete
))
if
(
!
(
!
alive
&&
nfComplete
))
((
MgmtSrvr
*
)
mgmSrv
)
->
handleStatus
(
nodeId
,
alive
);
((
MgmtSrvr
*
)
mgmSrv
)
->
handleStatus
(
nodeId
,
alive
);
DBUG_VOID_RETURN
;
}
}
enum
ndb_mgm_node_type
enum
ndb_mgm_node_type
...
@@ -2387,8 +2389,8 @@ MgmtSrvr::eventReport(NodeId nodeId, const Uint32 * theData)
...
@@ -2387,8 +2389,8 @@ MgmtSrvr::eventReport(NodeId nodeId, const Uint32 * theData)
EventReport
::
EventType
type
=
eventReport
->
getEventType
();
EventReport
::
EventType
type
=
eventReport
->
getEventType
();
// Log event
// Log event
g_EventLogger
.
log
(
type
,
theData
,
nodeId
,
g_EventLogger
.
log
(
type
,
theData
,
nodeId
,
&
m_
statisticsListner
.
m_clients
[
0
].
m_logLevel
);
&
m_
event_listner
[
0
].
m_logLevel
);
m_
statisticsL
istner
.
log
(
type
,
theData
,
nodeId
);
m_
event_l
istner
.
log
(
type
,
theData
,
nodeId
);
}
}
/***************************************************************************
/***************************************************************************
...
@@ -2741,5 +2743,5 @@ template bool SignalQueue::waitFor<SigMatch>(Vector<SigMatch>&, SigMatch*&, NdbA
...
@@ -2741,5 +2743,5 @@ template bool SignalQueue::waitFor<SigMatch>(Vector<SigMatch>&, SigMatch*&, NdbA
#endif
#endif
template
class
MutexVector
<
unsigned
short
>;
template
class
MutexVector
<
unsigned
short
>;
template
class
MutexVector
<
MgmStatService
::
StatL
istener
>;
template
class
MutexVector
<
Ndb_mgmd_event_service
::
Event_l
istener
>;
template
class
MutexVector
<
EventSubscribeReq
>;
template
class
MutexVector
<
EventSubscribeReq
>;
ndb/src/mgmsrv/MgmtSrvr.hpp
View file @
02dab285
...
@@ -43,27 +43,30 @@ class Config;
...
@@ -43,27 +43,30 @@ class Config;
class
SetLogLevelOrd
;
class
SetLogLevelOrd
;
class
SocketServer
;
class
SocketServer
;
class
MgmStatS
ervice
:
public
EventLoggerBase
class
Ndb_mgmd_event_s
ervice
:
public
EventLoggerBase
{
{
friend
class
MgmtSrvr
;
friend
class
MgmtSrvr
;
public:
public:
struct
StatL
istener
:
public
EventLoggerBase
{
struct
Event_l
istener
:
public
EventLoggerBase
{
NDB_SOCKET_TYPE
m_socket
;
NDB_SOCKET_TYPE
m_socket
;
};
};
private:
private:
class
MgmtSrvr
*
m_mgmsrv
;
class
MgmtSrvr
*
m_mgmsrv
;
MutexVector
<
StatL
istener
>
m_clients
;
MutexVector
<
Event_l
istener
>
m_clients
;
public:
public:
MgmStatS
ervice
(
class
MgmtSrvr
*
m
)
:
m_clients
(
5
)
{
Ndb_mgmd_event_s
ervice
(
class
MgmtSrvr
*
m
)
:
m_clients
(
5
)
{
m_mgmsrv
=
m
;
m_mgmsrv
=
m
;
}
}
void
add_listener
(
const
StatL
istener
&
);
void
add_listener
(
const
Event_l
istener
&
);
void
log
(
int
eventType
,
const
Uint32
*
theData
,
NodeId
nodeId
);
void
log
(
int
eventType
,
const
Uint32
*
theData
,
NodeId
nodeId
);
void
stopSessions
();
void
stop_sessions
();
Event_listener
&
operator
[](
unsigned
i
)
{
return
m_clients
[
i
];
}
const
Event_listener
&
operator
[](
unsigned
i
)
const
{
return
m_clients
[
i
];
}
};
};
/**
/**
...
@@ -732,8 +735,8 @@ private:
...
@@ -732,8 +735,8 @@ private:
LogLevel
m_nodeLogLevel
[
MAX_NODES
];
LogLevel
m_nodeLogLevel
[
MAX_NODES
];
enum
ndb_mgm_node_type
nodeTypes
[
MAX_NODES
];
enum
ndb_mgm_node_type
nodeTypes
[
MAX_NODES
];
friend
class
MgmApiSession
;
friend
class
MgmApiSession
;
friend
class
MgmStatS
ervice
;
friend
class
Ndb_mgmd_event_s
ervice
;
MgmStatService
m_statisticsL
istner
;
Ndb_mgmd_event_service
m_event_l
istner
;
/**
/**
* Handles the thread wich upon a 'Node is started' event will
* Handles the thread wich upon a 'Node is started' event will
...
...
ndb/src/mgmsrv/Services.cpp
View file @
02dab285
...
@@ -208,12 +208,12 @@ ParserRow<MgmApiSession> commands[] = {
...
@@ -208,12 +208,12 @@ ParserRow<MgmApiSession> commands[] = {
MGM_CMD
(
"set loglevel"
,
&
MgmApiSession
::
setLogLevel
,
""
),
MGM_CMD
(
"set loglevel"
,
&
MgmApiSession
::
setLogLevel
,
""
),
MGM_ARG
(
"node"
,
Int
,
Mandatory
,
"Node"
),
MGM_ARG
(
"node"
,
Int
,
Mandatory
,
"Node"
),
MGM_ARG
(
"category"
,
String
,
Mandatory
,
"Event category"
),
MGM_ARG
(
"category"
,
Int
,
Mandatory
,
"Event category"
),
MGM_ARG
(
"level"
,
Int
,
Mandatory
,
"Log level (0-15)"
),
MGM_ARG
(
"level"
,
Int
,
Mandatory
,
"Log level (0-15)"
),
MGM_CMD
(
"set cluster loglevel"
,
&
MgmApiSession
::
setClusterLogLevel
,
""
),
MGM_CMD
(
"set cluster loglevel"
,
&
MgmApiSession
::
setClusterLogLevel
,
""
),
MGM_ARG
(
"node"
,
Int
,
Mandatory
,
"Node"
),
MGM_ARG
(
"node"
,
Int
,
Mandatory
,
"Node"
),
MGM_ARG
(
"category"
,
String
,
Mandatory
,
"Event category"
),
MGM_ARG
(
"category"
,
Int
,
Mandatory
,
"Event category"
),
MGM_ARG
(
"level"
,
Int
,
Mandatory
,
"Log level (0-15)"
),
MGM_ARG
(
"level"
,
Int
,
Mandatory
,
"Log level (0-15)"
),
MGM_CMD
(
"set logfilter"
,
&
MgmApiSession
::
setLogFilter
,
""
),
MGM_CMD
(
"set logfilter"
,
&
MgmApiSession
::
setLogFilter
,
""
),
...
@@ -781,20 +781,35 @@ MgmApiSession::bye(Parser<MgmApiSession>::Context &,
...
@@ -781,20 +781,35 @@ MgmApiSession::bye(Parser<MgmApiSession>::Context &,
void
void
MgmApiSession
::
setClusterLogLevel
(
Parser
<
MgmApiSession
>::
Context
&
,
MgmApiSession
::
setClusterLogLevel
(
Parser
<
MgmApiSession
>::
Context
&
,
Properties
const
&
args
)
{
Properties
const
&
args
)
{
Uint32
node
,
level
,
category
;
const
char
*
reply
=
"set cluster loglevel reply"
;
Uint32
node
,
level
,
cat
;
BaseString
errorString
;
BaseString
errorString
;
SetLogLevelOrd
logLevel
;
SetLogLevelOrd
logLevel
;
int
result
;
int
result
;
DBUG_ENTER
(
"MgmApiSession::setClusterLogLevel"
);
args
.
get
(
"node"
,
&
node
);
args
.
get
(
"node"
,
&
node
);
args
.
get
(
"category"
,
&
cat
egory
);
args
.
get
(
"category"
,
&
cat
);
args
.
get
(
"level"
,
&
level
);
args
.
get
(
"level"
,
&
level
);
DBUG_PRINT
(
"enter"
,(
"node=%d, category=%d, level=%d"
,
node
,
cat
,
level
));
/* XXX should use constants for this value */
/* XXX should use constants for this value */
if
(
level
>
15
)
{
if
(
level
>
15
)
{
m_output
->
println
(
"set cluster loglevel reply"
);
m_output
->
println
(
reply
);
m_output
->
println
(
"result: Invalid loglevel
"
);
m_output
->
println
(
"result: Invalid loglevel
%d"
,
level
);
m_output
->
println
(
""
);
m_output
->
println
(
""
);
return
;
DBUG_VOID_RETURN
;
}
LogLevel
::
EventCategory
category
=
(
LogLevel
::
EventCategory
)(
cat
-
(
int
)
CFG_MIN_LOGLEVEL
);
if
(
m_mgmsrv
.
m_event_listner
[
0
].
m_logLevel
.
setLogLevel
(
category
,
level
))
{
m_output
->
println
(
reply
);
m_output
->
println
(
"result: Invalid category %d"
,
category
);
m_output
->
println
(
""
);
DBUG_VOID_RETURN
;
}
}
EventSubscribeReq
req
;
EventSubscribeReq
req
;
...
@@ -803,9 +818,10 @@ MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
...
@@ -803,9 +818,10 @@ MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
req
.
theData
[
0
]
=
(
category
<<
16
)
|
level
;
req
.
theData
[
0
]
=
(
category
<<
16
)
|
level
;
m_mgmsrv
.
m_log_level_requests
.
push_back
(
req
);
m_mgmsrv
.
m_log_level_requests
.
push_back
(
req
);
m_output
->
println
(
"set cluster loglevel reply"
);
m_output
->
println
(
reply
);
m_output
->
println
(
"result: Ok"
);
m_output
->
println
(
"result: Ok"
);
m_output
->
println
(
""
);
m_output
->
println
(
""
);
DBUG_VOID_RETURN
;
}
}
void
void
...
@@ -1263,21 +1279,17 @@ operator<<(NdbOut& out, const LogLevel & ll)
...
@@ -1263,21 +1279,17 @@ operator<<(NdbOut& out, const LogLevel & ll)
}
}
void
void
MgmStatS
ervice
::
log
(
int
eventType
,
const
Uint32
*
theData
,
NodeId
nodeId
){
Ndb_mgmd_event_s
ervice
::
log
(
int
eventType
,
const
Uint32
*
theData
,
NodeId
nodeId
){
Uint32
threshold
=
0
;
Uint32
threshold
;
LogLevel
::
EventCategory
cat
=
LogLevel
::
llInvalid
;
LogLevel
::
EventCategory
cat
;
Logger
::
LoggerLevel
severity
;
int
i
;
int
i
;
DBUG_ENTER
(
"Ndb_mgmd_event_service::log"
);
DBUG_PRINT
(
"enter"
,(
"eventType=%d, nodeid=%d"
,
eventType
,
nodeId
));
for
(
i
=
0
;
(
unsigned
)
i
<
EventLogger
::
matrixSize
;
i
++
){
if
(
EventLoggerBase
::
event_lookup
(
eventType
,
cat
,
threshold
,
severity
))
if
(
EventLogger
::
matrix
[
i
].
eventType
==
eventType
){
DBUG_VOID_RETURN
;
cat
=
EventLogger
::
matrix
[
i
].
eventCategory
;
threshold
=
EventLogger
::
matrix
[
i
].
threshold
;
break
;
}
}
if
(
cat
==
LogLevel
::
llInvalid
)
return
;
char
m_text
[
256
];
char
m_text
[
256
];
EventLogger
::
getText
(
m_text
,
sizeof
(
m_text
),
eventType
,
theData
,
nodeId
);
EventLogger
::
getText
(
m_text
,
sizeof
(
m_text
),
eventType
,
theData
,
nodeId
);
...
@@ -1316,10 +1328,11 @@ MgmStatService::log(int eventType, const Uint32* theData, NodeId nodeId){
...
@@ -1316,10 +1328,11 @@ MgmStatService::log(int eventType, const Uint32* theData, NodeId nodeId){
m_mgmsrv
->
m_log_level_requests
.
push_back
(
req
);
m_mgmsrv
->
m_log_level_requests
.
push_back
(
req
);
}
}
}
}
DBUG_VOID_RETURN
;
}
}
void
void
MgmStatService
::
add_listener
(
const
StatL
istener
&
client
){
Ndb_mgmd_event_service
::
add_listener
(
const
Event_l
istener
&
client
){
m_clients
.
push_back
(
client
);
m_clients
.
push_back
(
client
);
LogLevel
tmp
=
m_logLevel
;
LogLevel
tmp
=
m_logLevel
;
tmp
.
set_max
(
client
.
m_logLevel
);
tmp
.
set_max
(
client
.
m_logLevel
);
...
@@ -1334,7 +1347,7 @@ MgmStatService::add_listener(const StatListener& client){
...
@@ -1334,7 +1347,7 @@ MgmStatService::add_listener(const StatListener& client){
}
}
void
void
MgmStatService
::
stopS
essions
(){
Ndb_mgmd_event_service
::
stop_s
essions
(){
for
(
int
i
=
m_clients
.
size
()
-
1
;
i
>=
0
;
i
--
){
for
(
int
i
=
m_clients
.
size
()
-
1
;
i
>=
0
;
i
--
){
if
(
m_clients
[
i
].
m_socket
>=
0
){
if
(
m_clients
[
i
].
m_socket
>=
0
){
NDB_CLOSE_SOCKET
(
m_clients
[
i
].
m_socket
);
NDB_CLOSE_SOCKET
(
m_clients
[
i
].
m_socket
);
...
@@ -1374,7 +1387,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
...
@@ -1374,7 +1387,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
int
result
=
0
;
int
result
=
0
;
BaseString
msg
;
BaseString
msg
;
MgmStatService
::
StatL
istener
le
;
Ndb_mgmd_event_service
::
Event_l
istener
le
;
le
.
m_socket
=
m_socket
;
le
.
m_socket
=
m_socket
;
Vector
<
BaseString
>
list
;
Vector
<
BaseString
>
list
;
...
@@ -1419,7 +1432,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
...
@@ -1419,7 +1432,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
goto
done
;
goto
done
;
}
}
m_mgmsrv
.
m_
statisticsL
istner
.
add_listener
(
le
);
m_mgmsrv
.
m_
event_l
istner
.
add_listener
(
le
);
m_stop
=
true
;
m_stop
=
true
;
m_socket
=
-
1
;
m_socket
=
-
1
;
...
...
ndb/src/ndbapi/TransporterFacade.cpp
View file @
02dab285
...
@@ -626,6 +626,9 @@ TransporterFacade::ReportNodeFailureComplete(NodeId tNodeId)
...
@@ -626,6 +626,9 @@ TransporterFacade::ReportNodeFailureComplete(NodeId tNodeId)
* After the restart the node is up again and the Ndb object
* After the restart the node is up again and the Ndb object
* might not have noticed the failure.
* might not have noticed the failure.
*/
*/
DBUG_ENTER
(
"TransporterFacade::ReportNodeFailureComplete"
);
DBUG_PRINT
(
"enter"
,(
"nodeid= %d"
,
tNodeId
));
Uint32
sz
=
m_threads
.
m_statusNext
.
size
();
Uint32
sz
=
m_threads
.
m_statusNext
.
size
();
for
(
Uint32
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
Uint32
i
=
0
;
i
<
sz
;
i
++
)
{
if
(
m_threads
.
getInUse
(
i
)){
if
(
m_threads
.
getInUse
(
i
)){
...
@@ -634,6 +637,7 @@ TransporterFacade::ReportNodeFailureComplete(NodeId tNodeId)
...
@@ -634,6 +637,7 @@ TransporterFacade::ReportNodeFailureComplete(NodeId tNodeId)
(
*
RegPC
)
(
obj
,
tNodeId
,
false
,
true
);
(
*
RegPC
)
(
obj
,
tNodeId
,
false
,
true
);
}
}
}
}
DBUG_VOID_RETURN
;
}
}
void
void
...
...
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