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
1a94812b
Commit
1a94812b
authored
Jan 25, 2005
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated logevent example
added handling of Arbit log events
parent
51def113
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
124 additions
and
22 deletions
+124
-22
ndb/examples/mgmapi_logevent_example/mgmapi_logevent.cpp
ndb/examples/mgmapi_logevent_example/mgmapi_logevent.cpp
+56
-20
ndb/include/mgmapi/ndb_logevent.h
ndb/include/mgmapi/ndb_logevent.h
+60
-0
ndb/src/mgmapi/ndb_logevent.cpp
ndb/src/mgmapi/ndb_logevent.cpp
+8
-2
No files found.
ndb/examples/mgmapi_logevent_example/mgmapi_logevent.cpp
View file @
1a94812b
...
...
@@ -42,8 +42,13 @@
int
main
()
{
NdbMgmHandle
h
;
NdbLogEventHandle
l
;
int
filter
[]
=
{
15
,
NDB_MGM_EVENT_CATEGORY_BACKUP
,
0
};
NdbLogEventHandle
le
;
int
filter
[]
=
{
15
,
NDB_MGM_EVENT_CATEGORY_BACKUP
,
15
,
NDB_MGM_EVENT_CATEGORY_CONNECTION
,
15
,
NDB_MGM_EVENT_CATEGORY_NODE_RESTART
,
15
,
NDB_MGM_EVENT_CATEGORY_STARTUP
,
15
,
NDB_MGM_EVENT_CATEGORY_ERROR
,
0
};
struct
ndb_logevent
event
;
ndb_init
();
...
...
@@ -56,48 +61,79 @@ int main()
}
if
(
ndb_mgm_connect
(
h
,
0
,
0
,
0
))
MGMERROR
(
h
);
l
=
ndb_mgm_create_logevent_handle
(
h
,
filter
);
if
(
l
==
0
)
MGMERROR
(
h
);
l
e
=
ndb_mgm_create_logevent_handle
(
h
,
filter
);
if
(
l
e
==
0
)
MGMERROR
(
h
);
while
(
1
)
{
int
timeout
=
5000
;
int
r
=
ndb_logevent_get_next
(
l
,
&
event
,
timeout
);
int
r
=
ndb_logevent_get_next
(
l
e
,
&
event
,
timeout
);
if
(
r
==
0
)
printf
(
"No event within %d milliseconds
\n
"
,
timeout
);
else
if
(
r
<
0
)
LOGEVENTERROR
(
l
)
LOGEVENTERROR
(
l
e
)
else
{
printf
(
"Event %d from node ID %d
\n
"
,
event
.
type
,
event
.
source_nodeid
);
printf
(
"Category %d, severity %d, level %d
\n
"
,
event
.
category
,
event
.
severity
,
event
.
level
);
switch
(
event
.
type
)
{
case
NDB_LE_BackupStarted
:
printf
(
"
BackupStartded
\n
"
);
printf
(
"Starting node ID: %d
\n
"
,
event
.
BackupStarted
.
starting_node
);
printf
(
"Backup ID: %d
\n
"
,
event
.
BackupStarted
.
backup_id
);
printf
(
"
Node %d: BackupStarted
\n
"
,
event
.
source_nodeid
);
printf
(
"
Starting node ID: %d
\n
"
,
event
.
BackupStarted
.
starting_node
);
printf
(
"
Backup ID: %d
\n
"
,
event
.
BackupStarted
.
backup_id
);
break
;
case
NDB_LE_BackupCompleted
:
printf
(
"
BackupCompleted
\n
"
);
printf
(
"Backup ID: %d
\n
"
,
event
.
BackupStarted
.
backup_id
);
printf
(
"
Node %d: BackupCompleted
\n
"
,
event
.
source_nodeid
);
printf
(
"
Backup ID: %d
\n
"
,
event
.
BackupStarted
.
backup_id
);
break
;
case
NDB_LE_BackupAborted
:
printf
(
"Node %d: BackupAborted
\n
"
,
event
.
source_nodeid
);
break
;
case
NDB_LE_BackupFailedToStart
:
printf
(
"Node %d: BackupFailedToStart
\n
"
,
event
.
source_nodeid
);
break
;
case
NDB_LE_NodeFailCompleted
:
printf
(
"Node %d: NodeFailCompleted
\n
"
,
event
.
source_nodeid
);
break
;
case
NDB_LE_ArbitResult
:
printf
(
"Node %d: ArbitResult
\n
"
,
event
.
source_nodeid
);
printf
(
" code %d, arbit_node %d
\n
"
,
event
.
ArbitResult
.
code
&
0xffff
,
event
.
ArbitResult
.
arbit_node
);
break
;
case
NDB_LE_DeadDueToHeartbeat
:
printf
(
"Node %d: DeadDueToHeartbeat
\n
"
,
event
.
source_nodeid
);
printf
(
" node %d
\n
"
,
event
.
DeadDueToHeartbeat
.
node
);
break
;
case
NDB_LE_Connected
:
printf
(
"Node %d: Connected
\n
"
,
event
.
source_nodeid
);
printf
(
" node %d
\n
"
,
event
.
Connected
.
node
);
break
;
case
NDB_LE_Disconnected
:
printf
(
"Node %d: Disconnected
\n
"
,
event
.
source_nodeid
);
printf
(
" node %d
\n
"
,
event
.
Disconnected
.
node
);
break
;
case
NDB_LE_NDBStartCompleted
:
printf
(
"Node %d: StartCompleted
\n
"
,
event
.
source_nodeid
);
printf
(
" version %d.%d.%d
\n
"
,
event
.
NDBStartCompleted
.
version
>>
16
&
0xff
,
event
.
NDBStartCompleted
.
version
>>
8
&
0xff
,
event
.
NDBStartCompleted
.
version
>>
0
&
0xff
);
break
;
case
NDB_LE_ArbitState
:
printf
(
"Node %d: ArbitState
\n
"
,
event
.
source_nodeid
);
printf
(
" code %d, arbit_node %d
\n
"
,
event
.
ArbitState
.
code
&
0xffff
,
event
.
ArbitResult
.
arbit_node
);
break
;
default:
printf
(
"Unexpected event
\n
"
);
break
;
}
}
}
ndb_mgm_destroy_logevent_handle
(
&
l
);
ndb_mgm_destroy_logevent_handle
(
&
l
e
);
ndb_mgm_destroy_handle
(
&
h
);
ndb_end
(
0
);
return
0
;
...
...
ndb/include/mgmapi/ndb_logevent.h
View file @
1a94812b
...
...
@@ -286,101 +286,125 @@ extern "C" {
*/
union
{
/* CONNECT */
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
}
Connected
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
}
Disconnected
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
}
CommunicationClosed
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
}
CommunicationOpened
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
unsigned
version
;
}
ConnectedApiVersion
;
/* CHECKPOINT */
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
gci
;
}
GlobalCheckpointStarted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
gci
;
}
GlobalCheckpointCompleted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
lci
;
unsigned
keep_gci
;
unsigned
restore_gci
;
}
LocalCheckpointStarted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
lci
;
}
LocalCheckpointCompleted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
data
;
}
LCPStoppedInCalcKeepGci
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
unsigned
table_id
;
unsigned
fragment_id
;
}
LCPFragmentCompleted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
acc_count
;
unsigned
tup_count
;
}
UndoLogBlocked
;
/* STARTUP */
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
version
;
}
NDBStartStarted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
version
;
}
NDBStartCompleted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
}
STTORRYRecieved
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
phase
;
unsigned
starttype
;
}
StartPhaseCompleted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
own_id
;
unsigned
president_id
;
unsigned
dynamic_id
;
}
CM_REGCONF
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
own_id
;
unsigned
other_id
;
unsigned
cause
;
}
CM_REGREF
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
own_id
;
unsigned
left_id
;
unsigned
right_id
;
unsigned
dynamic_id
;
}
FIND_NEIGHBOURS
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
stoptype
;
}
NDBStopStarted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
}
NDBStopAborted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
unsigned
keep_gci
;
unsigned
completed_gci
;
unsigned
restorable_gci
;
}
StartREDOLog
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
log_part
;
unsigned
start_mb
;
unsigned
stop_mb
;
unsigned
gci
;
}
StartLog
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
block
;
unsigned
data1
;
...
...
@@ -396,48 +420,70 @@ extern "C" {
}
UNDORecordsExecuted
;
/* NODERESTART */
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
}
NR_CopyDict
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
}
NR_CopyDistr
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
dest_node
;
}
NR_CopyFragsStarted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
dest_node
;
unsigned
table_id
;
unsigned
fragment_id
;
}
NR_CopyFragDone
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
dest_node
;
}
NR_CopyFragsCompleted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
block
;
/* 0 = all */
unsigned
failed_node
;
unsigned
completing_node
;
/* 0 = all */
}
NodeFailCompleted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
failed_node
;
unsigned
failure_state
;
}
NODE_FAILREP
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
code
;
/* code & state << 16 */
unsigned
arbit_node
;
unsigned
ticket_0
;
unsigned
ticket_1
;
/* TODO */
}
ArbitState
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
code
;
/* code & state << 16 */
unsigned
arbit_node
;
unsigned
ticket_0
;
unsigned
ticket_1
;
/* TODO */
}
ArbitResult
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
}
GCP_TakeoverStarted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
}
GCP_TakeoverCompleted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
}
LCP_TakeoverStarted
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
state
;
}
LCP_TakeoverCompleted
;
/* STATISTIC */
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
trans_count
;
unsigned
commit_count
;
...
...
@@ -450,23 +496,29 @@ extern "C" {
unsigned
scan_count
;
unsigned
range_scan_count
;
}
TransReportCounters
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
ops
;
}
OperationReportCounters
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
table_id
;
}
TableCreated
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
mean_loop_count
;
}
JobStatistic
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
to_node
;
unsigned
mean_sent_bytes
;
}
SendBytesStatistic
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
from_node
;
unsigned
mean_received_bytes
;
}
ReceiveBytesStatistic
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
int
gth
;
unsigned
page_size_kb
;
...
...
@@ -476,32 +528,40 @@ extern "C" {
}
MemoryUsage
;
/* ERROR */
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
to_node
;
unsigned
code
;
}
TransporterError
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
to_node
;
unsigned
code
;
}
TransporterWarning
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
unsigned
count
;
}
MissedHeartbeat
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
}
DeadDueToHeartbeat
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
/* TODO */
}
WarningEvent
;
/* INFO */
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
}
SentHeartbeat
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
unsigned
node
;
}
CreateLogBytes
;
/** Log event specific data for for corresponding NDB_LE_ log event */
struct
{
/* TODO */
}
InfoEvent
;
...
...
ndb/src/mgmapi/ndb_logevent.cpp
View file @
1a94812b
...
...
@@ -197,10 +197,16 @@ struct Ndb_logevent_body_row ndb_logevent_body[]= {
ROW
(
NODE_FAILREP
,
"failure_state"
,
2
,
failure_state
),
/* TODO */
// ROW( ArbitState),
ROW
(
ArbitState
,
"code"
,
1
,
code
),
ROW
(
ArbitState
,
"arbit_node"
,
2
,
arbit_node
),
ROW
(
ArbitState
,
"ticket_0"
,
3
,
ticket_0
),
ROW
(
ArbitState
,
"ticket_1"
,
4
,
ticket_1
),
/* TODO */
// ROW( ArbitResult),
ROW
(
ArbitResult
,
"code"
,
1
,
code
),
ROW
(
ArbitResult
,
"arbit_node"
,
2
,
arbit_node
),
ROW
(
ArbitResult
,
"ticket_0"
,
3
,
ticket_0
),
ROW
(
ArbitResult
,
"ticket_1"
,
4
,
ticket_1
),
// ROW( GCP_TakeoverStarted),
...
...
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