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
11dbfe47
Commit
11dbfe47
authored
Sep 17, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix backup event
parent
2f43e54a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
90 additions
and
163 deletions
+90
-163
ndb/include/debugger/EventLogger.hpp
ndb/include/debugger/EventLogger.hpp
+2
-2
ndb/include/kernel/LogLevel.hpp
ndb/include/kernel/LogLevel.hpp
+18
-5
ndb/include/kernel/signaldata/EventSubscribeReq.hpp
ndb/include/kernel/signaldata/EventSubscribeReq.hpp
+6
-8
ndb/include/kernel/signaldata/SetLogLevelOrd.hpp
ndb/include/kernel/signaldata/SetLogLevelOrd.hpp
+8
-13
ndb/src/common/debugger/EventLogger.cpp
ndb/src/common/debugger/EventLogger.cpp
+21
-20
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
+10
-11
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+22
-99
ndb/src/mgmsrv/Services.cpp
ndb/src/mgmsrv/Services.cpp
+3
-5
No files found.
ndb/include/debugger/EventLogger.hpp
View file @
11dbfe47
...
...
@@ -125,7 +125,7 @@ public:
* @param theData the event data.
* @param nodeId the node id of event origin.
*/
virtual
void
log
(
int
eventType
,
const
Uint32
*
theData
,
NodeId
nodeId
=
0
);
virtual
void
log
(
int
,
const
Uint32
*
,
NodeId
=
0
,
const
class
LogLevel
*
=
0
);
/**
* Returns the event text for the specified event report type.
...
...
ndb/include/kernel/LogLevel.hpp
View file @
11dbfe47
...
...
@@ -88,6 +88,8 @@ public:
return
memcmp
(
this
,
&
l
,
sizeof
(
*
this
))
==
0
;
}
LogLevel
&
operator
=
(
const
class
EventSubscribeReq
&
req
);
private:
/**
* The actual data
...
...
@@ -103,9 +105,7 @@ LogLevel::LogLevel(){
inline
LogLevel
&
LogLevel
::
operator
=
(
const
LogLevel
&
org
){
for
(
Uint32
i
=
0
;
i
<
LOGLEVEL_CATEGORIES
;
i
++
){
logLevelData
[
i
]
=
org
.
logLevelData
[
i
];
}
memcpy
(
logLevelData
,
org
.
logLevelData
,
sizeof
(
logLevelData
));
return
*
this
;
}
...
...
@@ -121,7 +121,7 @@ inline
void
LogLevel
::
setLogLevel
(
EventCategory
ec
,
Uint32
level
){
assert
(
ec
>=
0
&&
(
Uint32
)
ec
<
LOGLEVEL_CATEGORIES
);
logLevelData
[
ec
]
=
level
;
logLevelData
[
ec
]
=
(
Uint8
)
level
;
}
inline
...
...
@@ -129,7 +129,7 @@ Uint32
LogLevel
::
getLogLevel
(
EventCategory
ec
)
const
{
assert
(
ec
>=
0
&&
(
Uint32
)
ec
<
LOGLEVEL_CATEGORIES
);
return
logLevelData
[
ec
];
return
(
Uint32
)
logLevelData
[
ec
];
}
inline
...
...
@@ -142,4 +142,17 @@ LogLevel::set_max(const LogLevel & org){
return
*
this
;
}
#include <signaldata/EventSubscribeReq.hpp>
inline
LogLevel
&
LogLevel
::
operator
=
(
const
EventSubscribeReq
&
req
)
{
clear
();
for
(
size_t
i
=
0
;
i
<
req
.
noOfEntries
;
i
++
){
logLevelData
[(
req
.
theData
[
i
]
>>
16
)]
=
req
.
theData
[
i
]
&
0xFFFF
;
}
return
*
this
;
}
#endif
ndb/include/kernel/signaldata/EventSubscribeReq.hpp
View file @
11dbfe47
...
...
@@ -38,7 +38,7 @@ struct EventSubscribeReq {
*/
friend
class
MgmtSrvr
;
STATIC_CONST
(
SignalLength
=
2
2
);
STATIC_CONST
(
SignalLength
=
2
+
LogLevel
::
LOGLEVEL_CATEGORIES
);
/**
* Note: If you use the same blockRef as you have used earlier,
...
...
@@ -52,14 +52,12 @@ struct EventSubscribeReq {
*/
Uint32
noOfEntries
;
Uint32
theCategories
[
10
];
Uint32
theLevels
[
10
];
Uint32
theData
[
LogLevel
::
LOGLEVEL_CATEGORIES
];
EventSubscribeReq
&
operator
=
(
const
LogLevel
&
ll
){
noOfEntries
=
_
LOGLEVEL_CATEGORIES
;
noOfEntries
=
LogLevel
::
LOGLEVEL_CATEGORIES
;
for
(
size_t
i
=
0
;
i
<
noOfEntries
;
i
++
){
theCategories
[
i
]
=
i
;
theLevels
[
i
]
=
ll
.
getLogLevel
((
LogLevel
::
EventCategory
)
i
);
theData
[
i
]
=
(
i
<<
16
)
|
ll
.
getLogLevel
((
LogLevel
::
EventCategory
)
i
);
}
return
*
this
;
}
...
...
ndb/include/kernel/signaldata/SetLogLevelOrd.hpp
View file @
11dbfe47
...
...
@@ -40,11 +40,10 @@ class SetLogLevelOrd {
friend
class
NodeLogLevel
;
private:
STATIC_CONST
(
SignalLength
=
25
);
STATIC_CONST
(
SignalLength
=
1
+
LogLevel
::
LOGLEVEL_CATEGORIES
);
Uint32
noOfEntries
;
Uint32
theCategories
[
12
];
Uint32
theLevels
[
12
];
Uint32
theData
[
LogLevel
::
LOGLEVEL_CATEGORIES
];
void
clear
();
...
...
@@ -54,10 +53,9 @@ private:
void
setLogLevel
(
LogLevel
::
EventCategory
ec
,
int
level
=
7
);
SetLogLevelOrd
&
operator
=
(
const
LogLevel
&
ll
){
noOfEntries
=
_
LOGLEVEL_CATEGORIES
;
noOfEntries
=
LogLevel
::
LOGLEVEL_CATEGORIES
;
for
(
size_t
i
=
0
;
i
<
noOfEntries
;
i
++
){
theCategories
[
i
]
=
i
;
theLevels
[
i
]
=
ll
.
getLogLevel
((
LogLevel
::
EventCategory
)
i
);
theData
[
i
]
=
(
i
<<
16
)
|
ll
.
getLogLevel
((
LogLevel
::
EventCategory
)
i
);
}
return
*
this
;
}
...
...
@@ -65,8 +63,7 @@ private:
SetLogLevelOrd
&
operator
=
(
const
EventSubscribeReq
&
ll
){
noOfEntries
=
ll
.
noOfEntries
;
for
(
size_t
i
=
0
;
i
<
noOfEntries
;
i
++
){
theCategories
[
i
]
=
ll
.
theCategories
[
i
];
theLevels
[
i
]
=
ll
.
theLevels
[
i
];
theData
[
i
]
=
ll
.
theData
[
i
];
}
return
*
this
;
}
...
...
@@ -81,9 +78,7 @@ SetLogLevelOrd::clear(){
inline
void
SetLogLevelOrd
::
setLogLevel
(
LogLevel
::
EventCategory
ec
,
int
level
){
assert
(
noOfEntries
<
12
);
theCategories
[
noOfEntries
]
=
ec
;
theLevels
[
noOfEntries
]
=
level
;
theData
[
noOfEntries
]
=
(
ec
<<
16
)
|
level
;
noOfEntries
++
;
}
...
...
ndb/src/common/debugger/EventLogger.cpp
View file @
11dbfe47
...
...
@@ -793,8 +793,6 @@ EventLogger::getText(char * m_text, size_t m_text_len,
);
break
;
}
case
EventReport
:
:
GrepSubscriptionInfo
:
{
GrepEvent
::
Subscription
event
=
(
GrepEvent
::
Subscription
)
theData
[
1
];
...
...
@@ -1308,16 +1306,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
EventLogger
::
EventLogger
()
:
m_filterLevel
(
15
)
{
setCategory
(
"EventLogger"
);
m_logLevel
.
setLogLevel
(
LogLevel
::
llStartUp
,
m_filterLevel
);
m_logLevel
.
setLogLevel
(
LogLevel
::
llShutdown
,
m_filterLevel
);
m_logLevel
.
setLogLevel
(
LogLevel
::
llStatistic
,
m_filterLevel
);
m_logLevel
.
setLogLevel
(
LogLevel
::
llCheckpoint
,
m_filterLevel
);
m_logLevel
.
setLogLevel
(
LogLevel
::
llNodeRestart
,
m_filterLevel
);
m_logLevel
.
setLogLevel
(
LogLevel
::
llConnection
,
m_filterLevel
);
m_logLevel
.
setLogLevel
(
LogLevel
::
llError
,
m_filterLevel
);
m_logLevel
.
setLogLevel
(
LogLevel
::
llInfo
,
m_filterLevel
);
enable
(
Logger
::
Logger
::
LL_INFO
,
Logger
::
Logger
::
LL_ALERT
);
// Log INFO to ALERT
enable
(
Logger
::
Logger
::
LL_INFO
,
Logger
::
Logger
::
LL_ALERT
);
}
EventLogger
::~
EventLogger
()
...
...
@@ -1338,23 +1327,35 @@ EventLogger::close()
removeAllHandlers
();
}
static
NdbOut
&
operator
<<
(
NdbOut
&
out
,
const
LogLevel
&
ll
)
{
out
<<
"[LogLevel: "
;
for
(
size_t
i
=
0
;
i
<
LogLevel
::
LOGLEVEL_CATEGORIES
;
i
++
)
out
<<
ll
.
getLogLevel
((
LogLevel
::
EventCategory
)
i
)
<<
" "
;
out
<<
"]"
;
return
out
;
}
void
EventLogger
::
log
(
int
eventType
,
const
Uint32
*
theData
,
NodeId
nodeId
)
EventLogger
::
log
(
int
eventType
,
const
Uint32
*
theData
,
NodeId
nodeId
,
const
LogLevel
*
ll
)
{
Uint32
threshold
=
0
;
Logger
::
LoggerLevel
severity
=
Logger
::
LL_WARNING
;
LogLevel
::
EventCategory
cat
;
for
(
unsigned
i
=
0
;
i
<
EventLogger
::
matrixSize
;
i
++
){
if
(
EventLogger
::
matrix
[
i
].
eventType
==
eventType
){
cat
=
EventLogger
::
matrix
[
i
].
eventCategory
;
threshold
=
EventLogger
::
matrix
[
i
].
threshold
;
severity
=
EventLogger
::
matrix
[
i
].
severity
;
for
(
unsigned
i
=
0
;
i
<
EventLogger
Base
::
matrixSize
;
i
++
){
if
(
EventLogger
Base
::
matrix
[
i
].
eventType
==
eventType
){
cat
=
EventLogger
Base
::
matrix
[
i
].
eventCategory
;
threshold
=
EventLogger
Base
::
matrix
[
i
].
threshold
;
severity
=
EventLogger
Base
::
matrix
[
i
].
severity
;
break
;
}
}
if
(
threshold
<=
m_logLevel
.
getLogLevel
(
cat
)){
Uint32
set
=
ll
?
ll
->
getLogLevel
(
cat
)
:
m_logLevel
.
getLogLevel
(
cat
);
if
(
threshold
<=
set
){
switch
(
severity
){
case
Logger
:
:
LL_ALERT
:
alert
(
EventLogger
::
getText
(
m_text
,
sizeof
(
m_text
),
...
...
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
View file @
11dbfe47
...
...
@@ -169,8 +169,8 @@ void Cmvmi::execSET_LOGLEVELORD(Signal* signal)
jamEntry
();
for
(
unsigned
int
i
=
0
;
i
<
llOrd
->
noOfEntries
;
i
++
){
category
=
(
LogLevel
::
EventCategory
)
llOrd
->
theCategories
[
i
]
;
level
=
llOrd
->
the
Levels
[
i
]
;
category
=
(
LogLevel
::
EventCategory
)
(
llOrd
->
theData
[
i
]
>>
16
)
;
level
=
llOrd
->
the
Data
[
i
]
&
0xFFFF
;
clogLevel
.
setLogLevel
(
category
,
level
);
}
...
...
@@ -196,10 +196,10 @@ void Cmvmi::execEVENT_REP(Signal* signal)
Uint32
threshold
=
16
;
LogLevel
::
EventCategory
eventCategory
=
(
LogLevel
::
EventCategory
)
0
;
for
(
unsigned
int
i
=
0
;
i
<
EventLogger
::
matrixSize
;
i
++
){
if
(
EventLogger
::
matrix
[
i
].
eventType
==
eventType
){
eventCategory
=
EventLogger
::
matrix
[
i
].
eventCategory
;
threshold
=
EventLogger
::
matrix
[
i
].
threshold
;
for
(
unsigned
int
i
=
0
;
i
<
EventLogger
Base
::
matrixSize
;
i
++
){
if
(
EventLogger
Base
::
matrix
[
i
].
eventType
==
eventType
){
eventCategory
=
EventLogger
Base
::
matrix
[
i
].
eventCategory
;
threshold
=
EventLogger
Base
::
matrix
[
i
].
threshold
;
break
;
}
}
...
...
@@ -266,10 +266,9 @@ Cmvmi::execEVENT_SUBSCRIBE_REQ(Signal * signal){
LogLevel
::
EventCategory
category
;
Uint32
level
=
0
;
for
(
Uint32
i
=
0
;
i
<
subReq
->
noOfEntries
;
i
++
){
category
=
(
LogLevel
::
EventCategory
)
subReq
->
theCategories
[
i
];
level
=
subReq
->
theLevels
[
i
];
ptr
.
p
->
logLevel
.
setLogLevel
(
category
,
level
);
category
=
(
LogLevel
::
EventCategory
)(
subReq
->
theData
[
i
]
>>
16
);
level
=
subReq
->
theData
[
i
]
&
0xFFFF
;
ptr
.
p
->
logLevel
.
setLogLevel
(
category
,
level
);
}
}
...
...
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
11dbfe47
...
...
@@ -133,6 +133,16 @@ MgmtSrvr::signalRecvThreadRun()
EventLogger
g_EventLogger
;
static
NdbOut
&
operator
<<
(
NdbOut
&
out
,
const
LogLevel
&
ll
)
{
out
<<
"[LogLevel: "
;
for
(
size_t
i
=
0
;
i
<
LogLevel
::
LOGLEVEL_CATEGORIES
;
i
++
)
out
<<
ll
.
getLogLevel
((
LogLevel
::
EventCategory
)
i
)
<<
" "
;
out
<<
"]"
;
return
out
;
}
void
MgmtSrvr
::
logLevelThreadRun
()
{
...
...
@@ -167,6 +177,10 @@ MgmtSrvr::logLevelThreadRun()
m_log_level_requests
.
erase
(
0
,
false
);
m_log_level_requests
.
unlock
();
LogLevel
tmp
;
tmp
=
req
;
ndbout
<<
"req3: "
<<
tmp
<<
endl
;
if
(
req
.
blockRef
==
0
){
req
.
blockRef
=
_ownReference
;
setEventReportingLevelImpl
(
0
,
req
);
...
...
@@ -564,9 +578,11 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
{
MgmStatService
::
StatListener
se
;
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
::
llError
,
15
);
se
.
m_logLevel
.
setLogLevel
(
LogLevel
::
llBackup
,
15
);
m_statisticsListner
.
m_clients
.
push_back
(
se
);
m_statisticsListner
.
m_logLevel
=
se
.
m_logLevel
;
}
...
...
@@ -1557,8 +1573,8 @@ MgmtSrvr::send(NdbApiSignal* signal, Uint32 node, Uint32 node_type){
Uint32
max
=
(
node
==
0
)
?
MAX_NODES
:
node
+
1
;
for
(;
node
<
max
;
node
++
){
while
(
nodeTypes
[
node
]
!=
node_type
&&
node
<
max
)
node
++
;
if
(
nodeTypes
[
node
]
!=
node_type
)
while
(
nodeTypes
[
node
]
!=
(
int
)
node_type
&&
node
<
max
)
node
++
;
if
(
nodeTypes
[
node
]
!=
(
int
)
node_type
)
break
;
theFacade
->
sendSignalUnCond
(
signal
,
node
);
}
...
...
@@ -1969,7 +1985,6 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
event
.
Completed
.
NoOfLogBytes
=
rep
->
noOfLogBytes
;
event
.
Completed
.
NoOfRecords
=
rep
->
noOfRecords
;
event
.
Completed
.
NoOfLogRecords
=
rep
->
noOfLogRecords
;
event
.
Completed
.
stopGCP
=
rep
->
stopGCP
;
event
.
Completed
.
startGCP
=
rep
->
startGCP
;
event
.
Nodes
=
rep
->
nodes
;
...
...
@@ -2352,9 +2367,9 @@ MgmtSrvr::eventReport(NodeId nodeId, const Uint32 * theData)
const
EventReport
*
const
eventReport
=
(
EventReport
*
)
&
theData
[
0
];
EventReport
::
EventType
type
=
eventReport
->
getEventType
();
// Log event
g_EventLogger
.
log
(
type
,
theData
,
nodeId
);
g_EventLogger
.
log
(
type
,
theData
,
nodeId
,
&
m_statisticsListner
.
m_clients
[
0
].
m_logLevel
);
m_statisticsListner
.
log
(
type
,
theData
,
nodeId
);
}
...
...
@@ -2467,98 +2482,6 @@ MgmtSrvr::abortBackup(Uint32 backupId)
void
MgmtSrvr
::
backupCallback
(
BackupEvent
&
event
)
{
char
str
[
255
];
bool
ok
=
false
;
switch
(
event
.
Event
){
case
BackupEvent
:
:
BackupStarted
:
ok
=
true
;
snprintf
(
str
,
sizeof
(
str
),
"Backup %d started"
,
event
.
Started
.
BackupId
);
break
;
case
BackupEvent
:
:
BackupFailedToStart
:
ok
=
true
;
snprintf
(
str
,
sizeof
(
str
),
"Backup failed to start (Backup error %d)"
,
event
.
FailedToStart
.
ErrorCode
);
break
;
case
BackupEvent
:
:
BackupCompleted
:
ok
=
true
;
snprintf
(
str
,
sizeof
(
str
),
"Backup %d completed"
,
event
.
Completed
.
BackupId
);
g_EventLogger
.
info
(
str
);
snprintf
(
str
,
sizeof
(
str
),
" StartGCP: %d StopGCP: %d"
,
event
.
Completed
.
startGCP
,
event
.
Completed
.
stopGCP
);
g_EventLogger
.
info
(
str
);
snprintf
(
str
,
sizeof
(
str
),
" #Records: %d #LogRecords: %d"
,
event
.
Completed
.
NoOfRecords
,
event
.
Completed
.
NoOfLogRecords
);
g_EventLogger
.
info
(
str
);
snprintf
(
str
,
sizeof
(
str
),
" Data: %d bytes Log: %d bytes"
,
event
.
Completed
.
NoOfBytes
,
event
.
Completed
.
NoOfLogBytes
);
break
;
case
BackupEvent
:
:
BackupAborted
:
ok
=
true
;
snprintf
(
str
,
sizeof
(
str
),
"Backup %d has been aborted reason %d"
,
event
.
Aborted
.
BackupId
,
event
.
Aborted
.
Reason
);
break
;
}
if
(
!
ok
){
snprintf
(
str
,
sizeof
(
str
),
"Unknown backup event: %d"
,
event
.
Event
);
}
g_EventLogger
.
info
(
str
);
switch
(
theWaitState
){
case
WAIT_BACKUP_STARTED
:
switch
(
event
.
Event
){
case
BackupEvent
:
:
BackupStarted
:
case
BackupEvent
:
:
BackupFailedToStart
:
m_lastBackupEvent
=
event
;
theWaitState
=
NO_WAIT
;
break
;
default:
snprintf
(
str
,
sizeof
(
str
),
"Received event %d in unexpected state WAIT_BACKUP_STARTED"
,
event
.
Event
);
g_EventLogger
.
info
(
str
);
return
;
}
break
;
case
WAIT_BACKUP_COMPLETED
:
switch
(
event
.
Event
){
case
BackupEvent
:
:
BackupCompleted
:
case
BackupEvent
:
:
BackupAborted
:
case
BackupEvent
:
:
BackupFailedToStart
:
m_lastBackupEvent
=
event
;
theWaitState
=
NO_WAIT
;
break
;
default:
snprintf
(
str
,
sizeof
(
str
),
"Received event %d in unexpected state WAIT_BACKUP_COMPLETED"
,
event
.
Event
);
g_EventLogger
.
info
(
str
);
return
;
}
break
;
default:
snprintf
(
str
,
sizeof
(
str
),
"Received event %d in unexpected state = %d"
,
event
.
Event
,
theWaitState
);
g_EventLogger
.
info
(
str
);
return
;
}
}
...
...
ndb/src/mgmsrv/Services.cpp
View file @
11dbfe47
...
...
@@ -780,8 +780,7 @@ MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
EventSubscribeReq
req
;
req
.
blockRef
=
0
;
req
.
noOfEntries
=
1
;
req
.
theCategories
[
0
]
=
category
;
req
.
theLevels
[
0
]
=
level
;
req
.
theData
[
0
]
=
(
category
<<
16
)
|
level
;
m_mgmsrv
.
m_log_level_requests
.
push_back
(
req
);
m_output
->
println
(
"set cluster loglevel reply"
);
...
...
@@ -815,8 +814,7 @@ MgmApiSession::setLogLevel(Parser<MgmApiSession>::Context &,
EventSubscribeReq
req
;
req
.
blockRef
=
node
;
req
.
noOfEntries
=
1
;
req
.
theCategories
[
0
]
=
category
;
req
.
theLevels
[
0
]
=
level
;
req
.
theData
[
0
]
=
(
category
<<
16
)
|
level
;
m_mgmsrv
.
m_log_level_requests
.
push_back
(
req
);
m_output
->
println
(
"set loglevel reply"
);
...
...
@@ -1239,7 +1237,7 @@ MgmApiSession::configChange(Parser_t::Context &,
m_output
->
println
(
""
);
}
NdbOut
&
static
NdbOut
&
operator
<<
(
NdbOut
&
out
,
const
LogLevel
&
ll
)
{
out
<<
"[LogLevel: "
;
...
...
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