Addition of new mariadb10 events to diagnostics()
Addition of new mariadb10 events to diagnostics()
This commit is contained in:

committed by
Markus Makela

parent
05fad56853
commit
9728ec6169
@ -26,7 +26,8 @@
|
|||||||
*
|
*
|
||||||
* Date Who Description
|
* Date Who Description
|
||||||
* 02/04/14 Mark Riddoch Initial implementation
|
* 02/04/14 Mark Riddoch Initial implementation
|
||||||
* 11/05/15 Massimilaino Pinto Added mariadb10_compat to master and slave structs
|
* 11/05/15 Massimiliano Pinto Added mariadb10_compat to master and slave structs
|
||||||
|
* 12/06/15 Massimiliano Pinto Added mariadb10 new events
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -45,7 +46,77 @@
|
|||||||
|
|
||||||
#define BINLOG_EVENT_HDR_LEN 19
|
#define BINLOG_EVENT_HDR_LEN 19
|
||||||
|
|
||||||
/* How often to call the binlog status function (seconds) */
|
/**
|
||||||
|
* Binlog event types
|
||||||
|
*/
|
||||||
|
#define START_EVENT_V3 0x01
|
||||||
|
#define QUERY_EVENT 0x02
|
||||||
|
#define STOP_EVENT 0x03
|
||||||
|
#define ROTATE_EVENT 0x04
|
||||||
|
#define INTVAR_EVENT 0x05
|
||||||
|
#define LOAD_EVENT 0x06
|
||||||
|
#define SLAVE_EVENT 0x07
|
||||||
|
#define CREATE_FILE_EVENT 0x08
|
||||||
|
#define APPEND_BLOCK_EVENT 0x09
|
||||||
|
#define EXEC_LOAD_EVENT 0x0A
|
||||||
|
#define DELETE_FILE_EVENT 0x0B
|
||||||
|
#define NEW_LOAD_EVENT 0x0C
|
||||||
|
#define RAND_EVENT 0x0D
|
||||||
|
#define USER_VAR_EVENT 0x0E
|
||||||
|
#define FORMAT_DESCRIPTION_EVENT 0x0F
|
||||||
|
#define XID_EVENT 0x10
|
||||||
|
#define BEGIN_LOAD_QUERY_EVENT 0x11
|
||||||
|
#define EXECUTE_LOAD_QUERY_EVENT 0x12
|
||||||
|
#define TABLE_MAP_EVENT 0x13
|
||||||
|
#define WRITE_ROWS_EVENTv0 0x14
|
||||||
|
#define UPDATE_ROWS_EVENTv0 0x15
|
||||||
|
#define DELETE_ROWS_EVENTv0 0x16
|
||||||
|
#define WRITE_ROWS_EVENTv1 0x17
|
||||||
|
#define UPDATE_ROWS_EVENTv1 0x18
|
||||||
|
#define DELETE_ROWS_EVENTv1 0x19
|
||||||
|
#define INCIDENT_EVENT 0x1A
|
||||||
|
#define HEARTBEAT_EVENT 0x1B
|
||||||
|
#define IGNORABLE_EVENT 0x1C
|
||||||
|
#define ROWS_QUERY_EVENT 0x1D
|
||||||
|
#define WRITE_ROWS_EVENTv2 0x1E
|
||||||
|
#define UPDATE_ROWS_EVENTv2 0x1F
|
||||||
|
#define DELETE_ROWS_EVENTv2 0x20
|
||||||
|
#define GTID_EVENT 0x21
|
||||||
|
#define ANONYMOUS_GTID_EVENT 0x22
|
||||||
|
#define PREVIOUS_GTIDS_EVENT 0x23
|
||||||
|
|
||||||
|
#define MAX_EVENT_TYPE 0x23
|
||||||
|
|
||||||
|
/* New MariaDB event numbers start from 0xa0 */
|
||||||
|
#define MARIADB_NEW_EVENTS_BEGIN 0xa0
|
||||||
|
#define MARIADB_ANNOTATE_ROWS_EVENT 0xa0
|
||||||
|
/* New MariaDB 10 event numbers start from here */
|
||||||
|
#define MARIADB10_BINLOG_CHECKPOINT_EVENT 0xa1
|
||||||
|
#define MARIADB10_GTID_EVENT 0xa2
|
||||||
|
#define MARIADB10_GTID_GTID_LIST_EVENT 0xa3
|
||||||
|
|
||||||
|
#define MAX_EVENT_TYPE_MARIADB10 0xa3
|
||||||
|
|
||||||
|
/* Maximum event type so far */
|
||||||
|
#define MAX_EVENT_TYPE_END MAX_EVENT_TYPE_MARIADB10
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Binlog event flags
|
||||||
|
*/
|
||||||
|
#define LOG_EVENT_BINLOG_IN_USE_F 0x0001
|
||||||
|
#define LOG_EVENT_FORCED_ROTATE_F 0x0002
|
||||||
|
#define LOG_EVENT_THREAD_SPECIFIC_F 0x0004
|
||||||
|
#define LOG_EVENT_SUPPRESS_USE_F 0x0008
|
||||||
|
#define LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F 0x0010
|
||||||
|
#define LOG_EVENT_ARTIFICIAL_F 0x0020
|
||||||
|
#define LOG_EVENT_RELAY_LOG_F 0x0040
|
||||||
|
#define LOG_EVENT_IGNORABLE_F 0x0080
|
||||||
|
#define LOG_EVENT_NO_FILTER_F 0x0100
|
||||||
|
#define LOG_EVENT_MTS_ISOLATE_F 0x0200
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How often to call the binlog status function (seconds)
|
||||||
|
*/
|
||||||
#define BLR_STATS_FREQ 60
|
#define BLR_STATS_FREQ 60
|
||||||
#define BLR_NSTATS_MINUTES 30
|
#define BLR_NSTATS_MINUTES 30
|
||||||
|
|
||||||
@ -212,7 +283,7 @@ typedef struct {
|
|||||||
uint64_t n_fakeevents; /*< Fake events not written to disk */
|
uint64_t n_fakeevents; /*< Fake events not written to disk */
|
||||||
uint64_t n_artificial; /*< Artificial events not written to disk */
|
uint64_t n_artificial; /*< Artificial events not written to disk */
|
||||||
int n_badcrc; /*< No. of bad CRC's from master */
|
int n_badcrc; /*< No. of bad CRC's from master */
|
||||||
uint64_t events[0x24]; /*< Per event counters */
|
uint64_t events[MAX_EVENT_TYPE_END + 1]; /*< Per event counters */
|
||||||
uint64_t lastsample;
|
uint64_t lastsample;
|
||||||
int minno;
|
int minno;
|
||||||
int minavgs[BLR_NSTATS_MINUTES];
|
int minavgs[BLR_NSTATS_MINUTES];
|
||||||
@ -327,7 +398,7 @@ static char *blrm_states[] = { "Unconnected", "Connecting", "Authenticated", "Ti
|
|||||||
"binlog checksum rerieval", "GTID Mode retrieval", "Master UUID retrieval",
|
"binlog checksum rerieval", "GTID Mode retrieval", "Master UUID retrieval",
|
||||||
"Set Slave UUID", "Set Names latin1", "Set Names utf8", "select 1",
|
"Set Slave UUID", "Set Names latin1", "Set Names utf8", "select 1",
|
||||||
"select version()", "select @@version_comment", "select @@hostname",
|
"select version()", "select @@version_comment", "select @@hostname",
|
||||||
"select @@mx_allowed_packet", "Register slave", "Binlog Dump", "Set MariaDB slave capability" };
|
"select @@max_allowed_packet", "Register slave", "Binlog Dump", "Set MariaDB slave capability" };
|
||||||
|
|
||||||
#define BLRS_CREATED 0x0000
|
#define BLRS_CREATED 0x0000
|
||||||
#define BLRS_UNREGISTERED 0x0001
|
#define BLRS_UNREGISTERED 0x0001
|
||||||
@ -361,62 +432,6 @@ static char *blrs_states[] = { "Created", "Unregistered", "Registered",
|
|||||||
#define COM_REGISTER_SLAVE 0x15
|
#define COM_REGISTER_SLAVE 0x15
|
||||||
#define COM_BINLOG_DUMP 0x12
|
#define COM_BINLOG_DUMP 0x12
|
||||||
|
|
||||||
/**
|
|
||||||
* Binlog event types
|
|
||||||
*/
|
|
||||||
#define START_EVENT_V3 0x01
|
|
||||||
#define QUERY_EVENT 0x02
|
|
||||||
#define STOP_EVENT 0x03
|
|
||||||
#define ROTATE_EVENT 0x04
|
|
||||||
#define INTVAR_EVENT 0x05
|
|
||||||
#define LOAD_EVENT 0x06
|
|
||||||
#define SLAVE_EVENT 0x07
|
|
||||||
#define CREATE_FILE_EVENT 0x08
|
|
||||||
#define APPEND_BLOCK_EVENT 0x09
|
|
||||||
#define EXEC_LOAD_EVENT 0x0A
|
|
||||||
#define DELETE_FILE_EVENT 0x0B
|
|
||||||
#define NEW_LOAD_EVENT 0x0C
|
|
||||||
#define RAND_EVENT 0x0D
|
|
||||||
#define USER_VAR_EVENT 0x0E
|
|
||||||
#define FORMAT_DESCRIPTION_EVENT 0x0F
|
|
||||||
#define XID_EVENT 0x10
|
|
||||||
#define BEGIN_LOAD_QUERY_EVENT 0x11
|
|
||||||
#define EXECUTE_LOAD_QUERY_EVENT 0x12
|
|
||||||
#define TABLE_MAP_EVENT 0x13
|
|
||||||
#define WRITE_ROWS_EVENTv0 0x14
|
|
||||||
#define UPDATE_ROWS_EVENTv0 0x15
|
|
||||||
#define DELETE_ROWS_EVENTv0 0x16
|
|
||||||
#define WRITE_ROWS_EVENTv1 0x17
|
|
||||||
#define UPDATE_ROWS_EVENTv1 0x18
|
|
||||||
#define DELETE_ROWS_EVENTv1 0x19
|
|
||||||
#define INCIDENT_EVENT 0x1A
|
|
||||||
#define HEARTBEAT_EVENT 0x1B
|
|
||||||
#define IGNORABLE_EVENT 0x1C
|
|
||||||
#define ROWS_QUERY_EVENT 0x1D
|
|
||||||
#define WRITE_ROWS_EVENTv2 0x1E
|
|
||||||
#define UPDATE_ROWS_EVENTv2 0x1F
|
|
||||||
#define DELETE_ROWS_EVENTv2 0x20
|
|
||||||
#define GTID_EVENT 0x21
|
|
||||||
#define ANONYMOUS_GTID_EVENT 0x22
|
|
||||||
#define PREVIOUS_GTIDS_EVENT 0x23
|
|
||||||
|
|
||||||
#define MAX_EVENT_TYPE 0x23
|
|
||||||
#define MAX_EVENT_TYPE_MARIADB10 0xa3
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Binlog event flags
|
|
||||||
*/
|
|
||||||
#define LOG_EVENT_BINLOG_IN_USE_F 0x0001
|
|
||||||
#define LOG_EVENT_FORCED_ROTATE_F 0x0002
|
|
||||||
#define LOG_EVENT_THREAD_SPECIFIC_F 0x0004
|
|
||||||
#define LOG_EVENT_SUPPRESS_USE_F 0x0008
|
|
||||||
#define LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F 0x0010
|
|
||||||
#define LOG_EVENT_ARTIFICIAL_F 0x0020
|
|
||||||
#define LOG_EVENT_RELAY_LOG_F 0x0040
|
|
||||||
#define LOG_EVENT_IGNORABLE_F 0x0080
|
|
||||||
#define LOG_EVENT_NO_FILTER_F 0x0100
|
|
||||||
#define LOG_EVENT_MTS_ISOLATE_F 0x0200
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macros to extract common fields
|
* Macros to extract common fields
|
||||||
*/
|
*/
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
* 17/02/2015 Massimiliano Pinto Addition of slave port and username in diagnostics
|
* 17/02/2015 Massimiliano Pinto Addition of slave port and username in diagnostics
|
||||||
* 18/02/2015 Massimiliano Pinto Addition of dcb_close in closeSession
|
* 18/02/2015 Massimiliano Pinto Addition of dcb_close in closeSession
|
||||||
* 07/05/2015 Massimiliano Pinto Addition of MariaDB 10 compatibility support
|
* 07/05/2015 Massimiliano Pinto Addition of MariaDB 10 compatibility support
|
||||||
|
* 12/06/2015 Massimiliano Pinto Addition of MariaDB 10 events in diagnostics()
|
||||||
|
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
@ -682,6 +683,15 @@ static char *event_names[] = {
|
|||||||
"Anonymous GTID Event", "Previous GTIDS Event"
|
"Anonymous GTID Event", "Previous GTIDS Event"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* New MariaDB event numbers starts from 0xa0 */
|
||||||
|
static char *event_names_mariadb10[] = {
|
||||||
|
"Annotate Rows Event",
|
||||||
|
/* New MariaDB 10.x event numbers */
|
||||||
|
"Binlog Checkpoint Event",
|
||||||
|
"GTID Event",
|
||||||
|
"GTID List Event"
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display an entry from the spinlock statistics data
|
* Display an entry from the spinlock statistics data
|
||||||
*
|
*
|
||||||
@ -798,11 +808,28 @@ struct tm tm;
|
|||||||
buf);
|
buf);
|
||||||
dcb_printf(dcb, "\t (%d seconds ago)\n",
|
dcb_printf(dcb, "\t (%d seconds ago)\n",
|
||||||
time(0) - router_inst->stats.lastReply);
|
time(0) - router_inst->stats.lastReply);
|
||||||
dcb_printf(dcb, "\tLast event from master: 0x%x, %s",
|
|
||||||
|
if (!router_inst->mariadb10_compat) {
|
||||||
|
dcb_printf(dcb, "\tLast event from master: 0x%x, %s",
|
||||||
router_inst->lastEventReceived,
|
router_inst->lastEventReceived,
|
||||||
(router_inst->lastEventReceived >= 0 &&
|
(router_inst->lastEventReceived >= 0 &&
|
||||||
router_inst->lastEventReceived < 0x24) ?
|
router_inst->lastEventReceived <= MAX_EVENT_TYPE) ?
|
||||||
event_names[router_inst->lastEventReceived] : "unknown");
|
event_names[router_inst->lastEventReceived] : "unknown");
|
||||||
|
} else {
|
||||||
|
char *ptr = NULL;
|
||||||
|
if (router_inst->lastEventReceived >= 0 && router_inst->lastEventReceived <= MAX_EVENT_TYPE) {
|
||||||
|
ptr = event_names[router_inst->lastEventReceived];
|
||||||
|
} else {
|
||||||
|
/* Check MariaDB 10 new events */
|
||||||
|
if (router_inst->lastEventReceived >= MARIADB_NEW_EVENTS_BEGIN && router_inst->lastEventReceived <= MAX_EVENT_TYPE_MARIADB10) {
|
||||||
|
ptr = event_names_mariadb10[(router_inst->lastEventReceived - MARIADB_NEW_EVENTS_BEGIN)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dcb_printf(dcb, "\tLast event from master: 0x%x, %s",
|
||||||
|
router_inst->lastEventReceived, (ptr != NULL) ? ptr : "unknown");
|
||||||
|
}
|
||||||
|
|
||||||
if (router_inst->lastEventTimestamp)
|
if (router_inst->lastEventTimestamp)
|
||||||
{
|
{
|
||||||
localtime_r(&router_inst->lastEventTimestamp, &tm);
|
localtime_r(&router_inst->lastEventTimestamp, &tm);
|
||||||
@ -815,11 +842,17 @@ struct tm tm;
|
|||||||
if (router_inst->reconnect_pending)
|
if (router_inst->reconnect_pending)
|
||||||
dcb_printf(dcb, "\tRouter pending reconnect to master\n");
|
dcb_printf(dcb, "\tRouter pending reconnect to master\n");
|
||||||
dcb_printf(dcb, "\tEvents received:\n");
|
dcb_printf(dcb, "\tEvents received:\n");
|
||||||
for (i = 0; i < 0x24; i++)
|
for (i = 0; i <= MAX_EVENT_TYPE; i++)
|
||||||
{
|
{
|
||||||
dcb_printf(dcb, "\t\t%-38s %u\n", event_names[i], router_inst->stats.events[i]);
|
dcb_printf(dcb, "\t\t%-38s %u\n", event_names[i], router_inst->stats.events[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (router_inst->mariadb10_compat) {
|
||||||
|
/* Display MariaDB 10 new events */
|
||||||
|
for (i = MARIADB_NEW_EVENTS_BEGIN; i <= MAX_EVENT_TYPE_MARIADB10; i++)
|
||||||
|
dcb_printf(dcb, "\t\tMariaDB 10 %-38s %u\n", event_names_mariadb10[(i - MARIADB_NEW_EVENTS_BEGIN)], router_inst->stats.events[i]);
|
||||||
|
}
|
||||||
|
|
||||||
#if SPINLOCK_PROFILE
|
#if SPINLOCK_PROFILE
|
||||||
dcb_printf(dcb, "\tSpinlock statistics (instlock):\n");
|
dcb_printf(dcb, "\tSpinlock statistics (instlock):\n");
|
||||||
spinlock_stats(&instlock, spin_reporter, dcb);
|
spinlock_stats(&instlock, spin_reporter, dcb);
|
||||||
|
@ -917,6 +917,7 @@ static REP_HEADER phdr;
|
|||||||
phdr = hdr;
|
phdr = hdr;
|
||||||
if (hdr.ok == 0)
|
if (hdr.ok == 0)
|
||||||
{
|
{
|
||||||
|
int event_limit;
|
||||||
/*
|
/*
|
||||||
* First check that the checksum we calculate matches the
|
* First check that the checksum we calculate matches the
|
||||||
* checksum in the packet we received.
|
* checksum in the packet we received.
|
||||||
@ -957,8 +958,11 @@ static REP_HEADER phdr;
|
|||||||
#ifdef SHOW_EVENTS
|
#ifdef SHOW_EVENTS
|
||||||
printf("blr: event type 0x%02x, flags 0x%04x, event size %d", hdr.event_type, hdr.flags, hdr.event_size);
|
printf("blr: event type 0x%02x, flags 0x%04x, event size %d", hdr.event_type, hdr.flags, hdr.event_size);
|
||||||
#endif
|
#endif
|
||||||
if (hdr.event_type >= 0 && hdr.event_type < 0x24)
|
event_limit = router->mariadb10_compat ? MAX_EVENT_TYPE_MARIADB10 : MAX_EVENT_TYPE;
|
||||||
|
|
||||||
|
if (hdr.event_type >= 0 && hdr.event_type <= event_limit)
|
||||||
router->stats.events[hdr.event_type]++;
|
router->stats.events[hdr.event_type]++;
|
||||||
|
|
||||||
if (hdr.event_type == FORMAT_DESCRIPTION_EVENT && hdr.next_pos == 0)
|
if (hdr.event_type == FORMAT_DESCRIPTION_EVENT && hdr.next_pos == 0)
|
||||||
{
|
{
|
||||||
// Fake format description message
|
// Fake format description message
|
||||||
|
Reference in New Issue
Block a user