diff --git a/CMakeLists.txt b/CMakeLists.txt index ef21fa1d3..89066dcf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,6 +219,7 @@ endif() # Only do packaging if configured if(PACKAGE) + execute_process(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE) # Install the files copied by the postinst script into the share folder install(FILES ${CMAKE_BINARY_DIR}/maxscale DESTINATION ${MAXSCALE_SHAREDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) @@ -239,7 +240,7 @@ if(PACKAGE) set(CPACK_PACKAGE_VERSION_MINOR "${MAXSCALE_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${MAXSCALE_VERSION_PATCH}") set(CPACK_PACKAGE_CONTACT "MariaDB Corporation Ab") - set(CPACK_PACKAGE_FILE_NAME "maxscale-${MAXSCALE_VERSION}") + set(CPACK_PACKAGE_FILE_NAME "maxscale-${MAXSCALE_VERSION}-${CPACK_PACKAGE_ARCHITECTURE}-${DISTRIB_SUFFIX}") set(CPACK_PACKAGE_NAME "maxscale") set(CPACK_PACKAGE_VENDOR "MariaDB Corporation Ab") set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/etc/DESCRIPTION) @@ -253,7 +254,8 @@ if(PACKAGE) if(NOT ( ${RPMBUILD} STREQUAL "RPMBUILD-NOTFOUND" ) ) include(cmake/package_rpm.cmake) message(STATUS "Generating RPM packages") - elseif(NOT ( ${DEBBUILD} STREQUAL "DEBBUILD-NOTFOUND" ) ) + endif() + if(NOT ( ${DEBBUILD} STREQUAL "DEBBUILD-NOTFOUND" ) ) include(cmake/package_deb.cmake) message(STATUS "Generating DEB packages for ${DEB_ARCHITECTURE}") endif() @@ -269,7 +271,7 @@ add_custom_target(buildtests ) add_custom_target(testall - COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N -DMAXSCALE_VARDIR=${CMAKE_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N -DWITH_MAXSCALE_CNF=N -DMAXSCALE_VARDIR=${CMAKE_BINARY_DIR} COMMAND make install COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/testall.cmake COMMENT "Running full test suite..." VERBATIM) diff --git a/Documentation/Documentation-Contents.md b/Documentation/Documentation-Contents.md index fd13f3bf1..a7a92d999 100644 --- a/Documentation/Documentation-Contents.md +++ b/Documentation/Documentation-Contents.md @@ -13,7 +13,7 @@ ## Getting Started - - [Getting Started with MaxScale](Getting-Started/Getting-Started-With-MaxScale.md) + - [MariaDB MaxScale Installation Guide](Getting-Started/MariaDB-MaxScale-Installation-Guide.md) - [Building MaxScale from Source Code](Getting-Started/Building-MaxScale-from-Source-Code.md) - [Configuration Guide](Getting-Started/Configuration-Guide.md) diff --git a/Documentation/Getting-Started/Configuration-Guide.md b/Documentation/Getting-Started/Configuration-Guide.md index a83412290..8077791ff 100644 --- a/Documentation/Getting-Started/Configuration-Guide.md +++ b/Documentation/Getting-Started/Configuration-Guide.md @@ -1405,37 +1405,6 @@ count=10 In addition parameters may be added to define patterns to match against to either include or exclude particular SQL statements to be duplicated. You may also define that the filter is only active for connections from a particular source or when a particular user is connected. -## Encrypting Passwords - -Passwords stored in the maxscale.cnf file may optionally be encrypted for added security. This is done by creation of an encryption key on installation of MaxScale. Encryption keys may be created manually by executing the maxkeys utility with the argument of the filename to store the key. The default location MaxScale stores the keys is `/var/lib/maxscale`. - -``` - # Usage: maxkeys [PATH] -maxkeys /var/lib/maxscale/ -``` - -Changing the encryption key for MaxScale will invalidate any currently encrypted keys stored in the maxscale.cnf file. - -### Creating Encrypted Passwords - -Encrypted passwords are created by executing the maxpasswd command with the location of the .secrets file and the password you require to encrypt as an argument. - -``` -# Usage: maxpasswd PATH PASSWORD -maxpasswd /var/lib/maxscale/ MaxScalePw001 -61DD955512C39A4A8BC4BB1E5F116705 -``` - -The output of the maxpasswd command is a hexadecimal string, this should be inserted into the maxscale.cnf file in place of the ordinary, plain text, password. MaxScale will determine this as an encrypted password and automatically decrypt it before sending it the database server. - -``` -[Split Service] -type=service -router=readwritesplit -servers=server1,server2,server3,server4 -user=maxscale -password=61DD955512C39A4A8BC4BB1E5F116705 -``` ## Reloading Configuration diff --git a/Documentation/Getting-Started/Getting-Started-With-MaxScale.md b/Documentation/Getting-Started/MariaDB-MaxScale-Installation-Guide.md similarity index 74% rename from Documentation/Getting-Started/Getting-Started-With-MaxScale.md rename to Documentation/Getting-Started/MariaDB-MaxScale-Installation-Guide.md index 344ac500d..5bf239df8 100644 --- a/Documentation/Getting-Started/Getting-Started-With-MaxScale.md +++ b/Documentation/Getting-Started/MariaDB-MaxScale-Installation-Guide.md @@ -8,23 +8,31 @@ In this introduction to MaxScale the aim is to take the reader from the point of The simplest way to install MaxScale is to use one of the binary packages that are available for download from the MariaDB website. -* Simply go to [www.mariadb.com](http://www.mariadb.com) +* Simply go to [http://www.mariadb.com/my_portal/download](http://www.mariadb.com/my_portal/download) -* Select the Downloads option from the Resources menu +* Sign in to MariaDB.com -* Find and click on the button "Download MariaDB MaxScale Binaries" +* Follow the instructions at the top of the page. -* Find the section on that page entitled MariaDB MaxScale +![image alt text](images/getting_started.png) -* Select your operating system from the drop down box +If you want to install only MaxScale, futher down you will find the product specific download pages. Click on the MariaDB MaxScale link and follow the distribution specific instructions. -* Instructions that are specific for your operating system will then appear +![image alt text](images/getting_started2.png) -![image alt text](images/image_1.png) +After you have installed MaxScale, you can start it. -* Follow these instructions to install MaxScale on your machine +``` +systemctl start maxscale.service +``` -Upon successful completion of the installation process you have a version of MaxScale that is missing only a configuration file before it can be started. +If your system does not support systemd you can start MaxScale using the installed init.d script. + +``` +service maxscale start +``` + +An example configuration file is installed into the `/etc/` folder. This file should be changed according to your needs. ## Building MaxScale From Source Code @@ -34,6 +42,8 @@ Alternatively you may download the MaxScale source and build your own binaries. The first step in configuring your MaxScale is to determine what it is you want to achieve with your MaxScale and what environment it will run in. The later is probably the easiest starting point for choosing which configuration route you wish to take. There are two distinct database environments which the first GA release of MaxScale supports; MySQL Master/Slave Replication clusters and Galera Cluster. +For more details, refer to the [Configuration Guide](Configuration-Guide.md). + ### Master/Slave Replication Clusters There are two major configuration options available to use MaxScale with a MySQL Replication cluster; connection routing with separate read and write connections, or read/write splitting with a single connection. A separate tutorial is available for each of these configurations that describes how to build the configuration file for MaxScale that will work with your environment. @@ -54,6 +64,38 @@ It is also possible to use the Read/Write Splitter with Galera. Although it is n As well as the four major configuration choices outlined above there are also other configurations sub-options that may be mixed with those to provide a variety of different configuration and functionality. The MaxScale filter concept allows the basic configurations to be built upon in a large variety of ways. A separate filter tutorial is available that discusses the concept and gives some examples of ways to use filters. +## Encrypting Passwords + +Passwords stored in the maxscale.cnf file may optionally be encrypted for added security. This is done by creation of an encryption key on installation of MaxScale. Encryption keys may be created manually by executing the maxkeys utility with the argument of the filename to store the key. The default location MaxScale stores the keys is `/var/lib/maxscale`. + +``` + # Usage: maxkeys [PATH] +maxkeys /var/lib/maxscale/ +``` + +Changing the encryption key for MaxScale will invalidate any currently encrypted keys stored in the maxscale.cnf file. + +### Creating Encrypted Passwords + +Encrypted passwords are created by executing the maxpasswd command with the location of the .secrets file and the password you require to encrypt as an argument. + +``` +# Usage: maxpasswd PATH PASSWORD +maxpasswd /var/lib/maxscale/ MaxScalePw001 +61DD955512C39A4A8BC4BB1E5F116705 +``` + +The output of the maxpasswd command is a hexadecimal string, this should be inserted into the maxscale.cnf file in place of the ordinary, plain text, password. MaxScale will determine this as an encrypted password and automatically decrypt it before sending it the database server. + +``` +[Split Service] +type=service +router=readwritesplit +servers=server1,server2,server3,server4 +user=maxscale +password=61DD955512C39A4A8BC4BB1E5F116705 +``` + ## Running MaxScale MaxScale consists of a core executable and a number of modules that implement @@ -69,5 +111,4 @@ Configuration is read by default from the file /etc/maxscale.cnf. An example fil ## Administration Of MaxScale -There are various administration tasks that may be done with MaxScale, a client command, maxadmin, is available that will interact with a running MaxScale and allow the status of MaxScale to be monitored and give some control of the MaxScale functionality. There is a separate reference guide for the maxadmin utility and also a short administration tutorial that covers the common administration tasks that need to be done with MaxScale. - +There are various administration tasks that may be done with MaxScale, a client command, maxadmin, is available that will interact with a running MaxScale and allow the status of MaxScale to be monitored and give some control of the MaxScale functionality. There is [a separate reference guide](../Reference/MaxAdmin.md) for the maxadmin utility and also [a short administration tutorial](../Tutorials/Administration-Tutorial.md) that covers the common administration tasks that need to be done with MaxScale. diff --git a/Documentation/Getting-Started/images/getting_started.png b/Documentation/Getting-Started/images/getting_started.png new file mode 100644 index 000000000..d90c3a2dd Binary files /dev/null and b/Documentation/Getting-Started/images/getting_started.png differ diff --git a/Documentation/Getting-Started/images/getting_started2.png b/Documentation/Getting-Started/images/getting_started2.png new file mode 100644 index 000000000..bac4926a5 Binary files /dev/null and b/Documentation/Getting-Started/images/getting_started2.png differ diff --git a/cmake/package_rpm.cmake b/cmake/package_rpm.cmake index 0f65bcdd2..7f11587a7 100644 --- a/cmake/package_rpm.cmake +++ b/cmake/package_rpm.cmake @@ -1,15 +1,5 @@ # RPM specific CPack configuration parameters set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MaxScale") -set(CPACK_PACKAGE_VERSION_MAJOR "${MAXSCALE_VERSION_MAJOR}") -set(CPACK_PACKAGE_VERSION_MINOR "${MAXSCALE_VERSION_MINOR}") -set(CPACK_PACKAGE_VERSION_PATCH "${MAXSCALE_VERSION_PATCH}") -set(CPACK_PACKAGE_CONTACT "MariaDB Corporation Ab") -set(CPACK_PACKAGE_FILE_NAME "maxscale-${MAXSCALE_VERSION}") -set(CPACK_PACKAGE_NAME "maxscale") -set(CPACK_PACKAGE_VENDOR "MariaDB Corporation Ab") -set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/etc/DESCRIPTION) -set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") set(CPACK_RPM_PACKAGE_RELEASE ${MAXSCALE_BUILD_NUMBER}) set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_BINARY_DIR}/postinst) set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_BINARY_DIR}/postrm) diff --git a/server/core/dbusers.c b/server/core/dbusers.c index cfe2d2027..57594f63d 100644 --- a/server/core/dbusers.c +++ b/server/core/dbusers.c @@ -210,7 +210,7 @@ HASHTABLE *oldresources; oldusers = service->users; /* digest compare */ - if (oldusers && memcmp(oldusers->cksum, newusers->cksum, SHA_DIGEST_LENGTH) == 0) { + if (oldusers != NULL && memcmp(oldusers->cksum, newusers->cksum, SHA_DIGEST_LENGTH) == 0) { /* same data, nothing to do */ LOGIF(LD, (skygw_log_write_flush( LOGFILE_DEBUG, diff --git a/server/modules/include/blr.h b/server/modules/include/blr.h index 6f6d61fb6..5c1270633 100644 --- a/server/modules/include/blr.h +++ b/server/modules/include/blr.h @@ -26,7 +26,8 @@ * * Date Who Description * 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 */ @@ -45,7 +46,77 @@ #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_NSTATS_MINUTES 30 @@ -212,7 +283,7 @@ typedef struct { uint64_t n_fakeevents; /*< Fake 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 */ - uint64_t events[0x24]; /*< Per event counters */ + uint64_t events[MAX_EVENT_TYPE_END + 1]; /*< Per event counters */ uint64_t lastsample; int minno; 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", "Set Slave UUID", "Set Names latin1", "Set Names utf8", "select 1", "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_UNREGISTERED 0x0001 @@ -361,62 +432,6 @@ static char *blrs_states[] = { "Created", "Unregistered", "Registered", #define COM_REGISTER_SLAVE 0x15 #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 */ diff --git a/server/modules/routing/binlog/blr.c b/server/modules/routing/binlog/blr.c index 8dce5ea58..7eac9e739 100644 --- a/server/modules/routing/binlog/blr.c +++ b/server/modules/routing/binlog/blr.c @@ -36,6 +36,7 @@ * 17/02/2015 Massimiliano Pinto Addition of slave port and username in diagnostics * 18/02/2015 Massimiliano Pinto Addition of dcb_close in closeSession * 07/05/2015 Massimiliano Pinto Addition of MariaDB 10 compatibility support + * 12/06/2015 Massimiliano Pinto Addition of MariaDB 10 events in diagnostics() * * @endverbatim @@ -682,6 +683,15 @@ static char *event_names[] = { "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 * @@ -798,11 +808,28 @@ struct tm tm; buf); dcb_printf(dcb, "\t (%d seconds ago)\n", 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 >= 0 && - router_inst->lastEventReceived < 0x24) ? + router_inst->lastEventReceived <= MAX_EVENT_TYPE) ? 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) { localtime_r(&router_inst->lastEventTimestamp, &tm); @@ -815,11 +842,17 @@ struct tm tm; if (router_inst->reconnect_pending) dcb_printf(dcb, "\tRouter pending reconnect to master\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]); } + 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 dcb_printf(dcb, "\tSpinlock statistics (instlock):\n"); spinlock_stats(&instlock, spin_reporter, dcb); diff --git a/server/modules/routing/binlog/blr_master.c b/server/modules/routing/binlog/blr_master.c index 3a0519108..86bee0b6b 100644 --- a/server/modules/routing/binlog/blr_master.c +++ b/server/modules/routing/binlog/blr_master.c @@ -917,6 +917,7 @@ static REP_HEADER phdr; phdr = hdr; if (hdr.ok == 0) { + int event_limit; /* * First check that the checksum we calculate matches the * checksum in the packet we received. @@ -957,8 +958,11 @@ static REP_HEADER phdr; #ifdef SHOW_EVENTS printf("blr: event type 0x%02x, flags 0x%04x, event size %d", hdr.event_type, hdr.flags, hdr.event_size); #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]++; + if (hdr.event_type == FORMAT_DESCRIPTION_EVENT && hdr.next_pos == 0) { // Fake format description message