From d69a36b4dda1ebb0ce06a98ea89417acc37f93be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 24 Nov 2017 14:14:55 +0200 Subject: [PATCH 01/46] MXS-1476: Stop nodes instead of blocking them This should actually disrupt the Galera cluster instead of just temporarily disabling it. --- maxscale-system-test/mariadb_nodes.h | 2 +- maxscale-system-test/mxs1476.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/maxscale-system-test/mariadb_nodes.h b/maxscale-system-test/mariadb_nodes.h index c5d4d1ecf..cd4f8edb8 100644 --- a/maxscale-system-test/mariadb_nodes.h +++ b/maxscale-system-test/mariadb_nodes.h @@ -291,7 +291,7 @@ public: * @param param command line parameters for DB server start command * @return 0 if success */ - int start_node(int node, const char* param); + int start_node(int node, const char* param = ""); /** * @brief Check node via ssh and restart it if it is not resposible diff --git a/maxscale-system-test/mxs1476.cpp b/maxscale-system-test/mxs1476.cpp index 7cca5a558..65ae63121 100644 --- a/maxscale-system-test/mxs1476.cpp +++ b/maxscale-system-test/mxs1476.cpp @@ -13,25 +13,25 @@ void do_test(TestConnections& test, int master, int slave) test.try_query(test.conn_rwsplit, "CREATE TABLE test.t1 (id int)"); test.try_query(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)"); - test.tprintf("Block a slave node and perform an insert"); - test.galera->block_node(slave); + test.tprintf("Stop a slave node and perform an insert"); + test.galera->stop_node(slave); sleep(5); test.try_query(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)"); - test.tprintf("Unblock the slave node and perform another insert"); - test.galera->unblock_node(slave); + test.tprintf("Start the slave node and perform another insert"); + test.galera->start_node(slave); sleep(5); test.try_query(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)"); test.close_maxscale_connections(); - test.tprintf("Block the master node and perform an insert"); - test.galera->block_node(master); + test.tprintf("Stop the master node and perform an insert"); + test.galera->stop_node(master); sleep(5); test.connect_maxscale(); test.try_query(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)"); - test.tprintf("Unblock the master node and perform another insert (expecting failure)"); - test.galera->unblock_node(master); + test.tprintf("Start the master node and perform another insert (expecting failure)"); + test.galera->start_node(master); sleep(5); test.add_result(execute_query_silent(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)") == 0, "Query should fail"); test.close_maxscale_connections(); From 89f815e2f0c5a41ae521282af11abbdf2a354dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 24 Nov 2017 14:52:24 +0200 Subject: [PATCH 02/46] Add 2.1.12 release notes Added a note about binlogrouter router_options. --- .../MaxScale-2.1.12-Release-Notes.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md diff --git a/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md new file mode 100644 index 000000000..850f3cdc8 --- /dev/null +++ b/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md @@ -0,0 +1,52 @@ +# MariaDB MaxScale 2.1.12 Release Notes + +Release 2.1.12 is a GA release. + +This document describes the changes in release 2.1.12, when compared +to release [2.1.11](MaxScale-2.1.11-Release-Notes.md). + +If you are upgrading from release 2.0, please also read the following +release notes: + +* [2.1.11](./MaxScale-2.1.11-Release-Notes.md) +* [2.1.10](./MaxScale-2.1.10-Release-Notes.md) +* [2.1.9](./MaxScale-2.1.9-Release-Notes.md) +* [2.1.8](./MaxScale-2.1.8-Release-Notes.md) +* [2.1.7](./MaxScale-2.1.7-Release-Notes.md) +* [2.1.6](./MaxScale-2.1.6-Release-Notes.md) +* [2.1.5](./MaxScale-2.1.5-Release-Notes.md) +* [2.1.4](./MaxScale-2.1.4-Release-Notes.md) +* [2.1.3](./MaxScale-2.1.3-Release-Notes.md) +* [2.1.2](./MaxScale-2.1.2-Release-Notes.md) +* [2.1.1](./MaxScale-2.1.1-Release-Notes.md) +* [2.1.0](./MaxScale-2.1.0-Release-Notes.md) + +For any problems you encounter, please consider submitting a bug report at +[Jira](https://jira.mariadb.org). + +## Changed Features + +### Binlogrouter Mandatory Router Options + +It is no longer necessary to always define the `router_options` parameter for +the binlogrouter if no `router_options` are needed. This allows configurations +where only parameters are used with the binlogrouter. + +## Bug fixes + +[Here is a list of bugs fixed in MaxScale 2.1.12.](https://jira.mariadb.org/issues/?jql=project%20%3D%20MXS%20AND%20issuetype%20%3D%20Bug%20AND%20status%20%3D%20Closed%20AND%20fixVersion%20%3D%202.1.12) + +## Packaging + +RPM and Debian packages are provided for the Linux distributions supported by +MariaDB Enterprise. + +Packages can be downloaded [here](https://mariadb.com/resources/downloads). + +## Source Code + +The source code of MaxScale is tagged at GitHub with a tag, which is identical +with the version of MaxScale. For instance, the tag of version X.Y.Z of MaxScale +is maxscale-X.Y.Z. + +The source code is available [here](https://github.com/mariadb-corporation/MaxScale). From c44dd4a26c6d6c9dc817821adfdab8149658ee07 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Mon, 27 Nov 2017 18:42:38 +0100 Subject: [PATCH 03/46] MXS-1530: stop replication unsupported binlog events Stop replicating from master if unsupported binlog events are seen. Also report error message for unsupported events (blr_read_events_all_events) at maxscale start-up and with maxbinlogcheck utility --- .../modules/routing/binlogrouter/blr_file.c | 6 ++- .../modules/routing/binlogrouter/blr_master.c | 39 ++++++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/server/modules/routing/binlogrouter/blr_file.c b/server/modules/routing/binlogrouter/blr_file.c index 96c2a18f4..3950faf83 100644 --- a/server/modules/routing/binlogrouter/blr_file.c +++ b/server/modules/routing/binlogrouter/blr_file.c @@ -1563,10 +1563,12 @@ blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debug) router->current_pos = pos; MXS_WARNING("an error has been found in %s. " - "Setting safe pos to %lu, current pos %lu", + "Setting safe pos to %lu, current pos %lu. " + "ErrMsg [%s]", router->binlog_name, router->binlog_position, - router->current_pos); + router->current_pos, + errmsg); if (fix) { diff --git a/server/modules/routing/binlogrouter/blr_master.c b/server/modules/routing/binlogrouter/blr_master.c index ae0d1c352..54778cae7 100644 --- a/server/modules/routing/binlogrouter/blr_master.c +++ b/server/modules/routing/binlogrouter/blr_master.c @@ -1430,7 +1430,12 @@ blr_handle_binlog_record(ROUTER_INSTANCE *router, GWBUF *pkt) } } - /** Gather statistics about the replication event types */ + /** + * Check Event Type limit: + * If supported, gather statistics about + * the replication event types + * else stop replication from master + */ int event_limit = router->mariadb10_compat ? MAX_EVENT_TYPE_MARIADB10 : MAX_EVENT_TYPE; @@ -1438,6 +1443,38 @@ blr_handle_binlog_record(ROUTER_INSTANCE *router, GWBUF *pkt) { router->stats.events[hdr.event_type]++; } + else + { + char errmsg[BINLOG_ERROR_MSG_LEN + 1]; + sprintf(errmsg, + "Event type [%d] not supported yet. " + "Check master server configuration and " + "disable any new feature. " + "Replication from master has been stopped.", + hdr.event_type); + MXS_ERROR(errmsg); + gwbuf_free(pkt); + pkt = NULL; + + spinlock_acquire(&router->lock); + + /* Handle error messages */ + char* old_errmsg = router->m_errmsg; + router->m_errmsg = MXS_STRDUP_A(errmsg); + router->m_errno = 1235; + + /* Set state to stopped */ + router->master_state = BLRM_SLAVE_STOPPED; + router->stats.n_binlog_errors++; + + spinlock_release(&router->lock); + + MXS_FREE(old_errmsg); + + /* Stop replication */ + blr_master_close(router); + return; + } if (hdr.event_type == FORMAT_DESCRIPTION_EVENT && hdr.next_pos == 0) { From e16eee0cc3c6307f732c2e43d995d3c86cdd67a7 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Tue, 28 Nov 2017 13:24:35 +0100 Subject: [PATCH 04/46] MXS-1546: Don't check binlog read position when last event is HEARTBEAT_EVENT Don't check binlog read position when last event is HEARTBEAT_EVENT --- .../modules/routing/binlogrouter/blr_slave.c | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/server/modules/routing/binlogrouter/blr_slave.c b/server/modules/routing/binlogrouter/blr_slave.c index f2b34d80b..c30874867 100644 --- a/server/modules/routing/binlogrouter/blr_slave.c +++ b/server/modules/routing/binlogrouter/blr_slave.c @@ -2658,6 +2658,30 @@ blr_slave_catchup(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, bool large) /* force slave to read events via catchup routine */ poll_fake_write_event(slave->dcb); } + /** + * Handle Heartbeat: don't check anything else + * set CS_WAIT_DATA and return + */ + else if (hdr.ok == SLAVE_POS_READ_OK && + slave->lastEventReceived == HEARTBEAT_EVENT) + { +#ifndef BLFILE_IN_SLAVE + blr_close_binlog(router, file); +#endif + spinlock_acquire(&router->binlog_lock); + spinlock_acquire(&slave->catch_lock); + + /** + * Set the CS_WAIT_DATA that allows notification + * of new events after HEARTBEAT_EVENT + */ + slave->cstate |= CS_WAIT_DATA; + + spinlock_release(&slave->catch_lock); + spinlock_release(&router->binlog_lock); + + return 1; + } else if (slave->binlog_pos == router->binlog_position && strcmp(slave->binlogfile, router->binlog_name) == 0) { @@ -5607,10 +5631,13 @@ blr_send_slave_heartbeat(void *inst) sptr->serverid, sptr->heartbeat, (unsigned long)sptr->lastReply); - blr_slave_send_heartbeat(router, sptr); - - sptr->lastReply = t_now; - + if (blr_slave_send_heartbeat(router, sptr)) + { + /* Set last event */ + sptr->lastEventReceived = HEARTBEAT_EVENT; + /* Set last time */ + sptr->lastReply = t_now; + } } sptr = sptr->next; From a6e83f41f6f285b5608ef2b1d22401e89c014934 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 28 Nov 2017 14:31:57 +0200 Subject: [PATCH 05/46] Add missing "%s" format --- server/modules/routing/binlogrouter/blr_master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/modules/routing/binlogrouter/blr_master.c b/server/modules/routing/binlogrouter/blr_master.c index 54778cae7..8ab9fa7d6 100644 --- a/server/modules/routing/binlogrouter/blr_master.c +++ b/server/modules/routing/binlogrouter/blr_master.c @@ -1452,7 +1452,7 @@ blr_handle_binlog_record(ROUTER_INSTANCE *router, GWBUF *pkt) "disable any new feature. " "Replication from master has been stopped.", hdr.event_type); - MXS_ERROR(errmsg); + MXS_ERROR("%s", errmsg); gwbuf_free(pkt); pkt = NULL; From 6359b7983f4307da6d17766ecefc11453ddaa648 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 28 Nov 2017 15:28:12 +0200 Subject: [PATCH 06/46] MXS-1529 Prevent endless realloc loop If the provided config path refers to a directory it can still be opened and an attempt to read be made. However, as reading will fail but end-of-file not be reached, we can't rely upon 'feof()' for detecting when to bail out. As it is a user error to provide a directory as the config path, that will be detected and deemed an error in a subsequent commit. --- server/core/config.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/core/config.c b/server/core/config.c index 083a0ed3c..a15c20e4c 100644 --- a/server/core/config.c +++ b/server/core/config.c @@ -2448,7 +2448,7 @@ int maxscale_getline(char** dest, int* size, FILE* file) char* destptr = *dest; int offset = 0; - if (feof(file)) + if (feof(file) || ferror(file)) { return 0; } @@ -2471,11 +2471,18 @@ int maxscale_getline(char** dest, int* size, FILE* file) } } - if ((destptr[offset] = fgetc(file)) == '\n' || feof(file)) + int c = fgetc(file); + + if ((c == '\n') || (c == EOF)) { destptr[offset] = '\0'; break; } + else + { + destptr[offset] = c; + } + offset++; } From 5c9d8c53d9630bedbe03528d39f3e3ce8c853744 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 28 Nov 2017 15:40:59 +0200 Subject: [PATCH 07/46] MXS-1529 Rename file_is_[readable|writable] Rename file_is_[readable|writable] to path_is_[readable|writable] as it makes the check for both files and directories. --- server/core/gateway.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server/core/gateway.cc b/server/core/gateway.cc index b4cbd47b8..c86872550 100644 --- a/server/core/gateway.cc +++ b/server/core/gateway.cc @@ -156,8 +156,8 @@ static bool file_write_header(FILE* outfile); static bool file_write_footer(FILE* outfile); static void write_footer(void); static int ntfw_cb(const char*, const struct stat*, int, struct FTW*); -static bool file_is_readable(const char* absolute_pathname); -static bool file_is_writable(const char* absolute_pathname); +static bool path_is_readable(const char* absolute_pathname); +static bool path_is_writable(const char* absolute_pathname); bool handle_path_arg(char** dest, const char* path, const char* arg, bool rd, bool wr); static void set_log_augmentation(const char* value); static void usage(void); @@ -654,7 +654,7 @@ static bool resolve_maxscale_conf_fname(char** cnf_full_path, *cnf_full_path = get_expanded_pathname(NULL, home_dir, default_cnf_fname); } - return *cnf_full_path && file_is_readable(*cnf_full_path); + return *cnf_full_path && path_is_readable(*cnf_full_path); } /** @@ -683,7 +683,7 @@ static char* check_dir_access(char* dirname, bool rd, bool wr) goto retblock; } - if (rd && !file_is_readable(dirname)) + if (rd && !path_is_readable(dirname)) { snprintf(errbuf, PATH_MAX * 2 - 1, "MaxScale doesn't have read permission " "to '%s'.", dirname); @@ -692,7 +692,7 @@ static char* check_dir_access(char* dirname, bool rd, bool wr) goto retblock; } - if (wr && !file_is_writable(dirname)) + if (wr && !path_is_writable(dirname)) { snprintf(errbuf, PATH_MAX * 2 - 1, "MaxScale doesn't have write permission " "to '%s'.", dirname); @@ -755,7 +755,7 @@ static void print_log_n_stderr( * @param absolute_pathname Path of the file or directory to check * @return True if file is readable */ -static bool file_is_readable(const char* absolute_pathname) +static bool path_is_readable(const char* absolute_pathname) { bool succp = true; @@ -776,7 +776,7 @@ static bool file_is_readable(const char* absolute_pathname) * @param absolute_pathname Path of the file or directory to check * @return True if file is writable */ -static bool file_is_writable(const char* absolute_pathname) +static bool path_is_writable(const char* absolute_pathname) { bool succp = true; @@ -872,7 +872,7 @@ static char* get_expanded_pathname(char** output_path, } snprintf(cnf_file_buf, pathlen, "%s/%s", expanded_path, fname); - if (!file_is_readable(cnf_file_buf)) + if (!path_is_readable(cnf_file_buf)) { MXS_FREE(expanded_path); MXS_FREE(cnf_file_buf); @@ -887,7 +887,7 @@ static char* get_expanded_pathname(char** output_path, * If only directory was provided, check that it is * readable. */ - if (!file_is_readable(expanded_path)) + if (!path_is_readable(expanded_path)) { MXS_FREE(expanded_path); expanded_path = NULL; From 4ee9f54f5d8d3c5885e4e7167f46ff19248f3a69 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 28 Nov 2017 15:56:59 +0200 Subject: [PATCH 08/46] MXS-1529 Ensure that config file is a file If the provided configuration file argument does not refer to a regular file, MaxScale refuses to start. --- server/core/gateway.cc | 45 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/server/core/gateway.cc b/server/core/gateway.cc index c86872550..c9e006124 100644 --- a/server/core/gateway.cc +++ b/server/core/gateway.cc @@ -156,6 +156,7 @@ static bool file_write_header(FILE* outfile); static bool file_write_footer(FILE* outfile); static void write_footer(void); static int ntfw_cb(const char*, const struct stat*, int, struct FTW*); +static bool is_file_and_readable(const char* absolute_pathname); static bool path_is_readable(const char* absolute_pathname); static bool path_is_writable(const char* absolute_pathname); bool handle_path_arg(char** dest, const char* path, const char* arg, bool rd, bool wr); @@ -654,7 +655,7 @@ static bool resolve_maxscale_conf_fname(char** cnf_full_path, *cnf_full_path = get_expanded_pathname(NULL, home_dir, default_cnf_fname); } - return *cnf_full_path && path_is_readable(*cnf_full_path); + return *cnf_full_path && is_file_and_readable(*cnf_full_path); } /** @@ -750,6 +751,48 @@ static void print_log_n_stderr( } } +/** + * Check that a path refers to a readable file. + * + * @param absolute_pathname The path to check. + * @return True if the path refers to a readable file. is readable + */ +static bool is_file_and_readable(const char* absolute_pathname) +{ + bool rv = false; + + struct stat info; + + if (stat(absolute_pathname, &info) == 0) + { + if ((info.st_mode & S_IFMT) == S_IFREG) + { + // There is a race here as the file can be deleted and a directory + // created in its stead between the stat() call here and the access() + // call in file_is_readable(). + rv = path_is_readable(absolute_pathname); + } + else + { + const char FORMAT[] = "'%s' does not refer to a regular file."; + char buff[sizeof(FORMAT) + strlen(absolute_pathname)]; + snprintf(buff, sizeof(buff), FORMAT, absolute_pathname); + print_log_n_stderr(true, true, buff, buff, 0); + } + } + else + { + int eno = errno; + errno = 0; + const char FORMAT[] = "Could not access '%s'."; + char buff[sizeof(FORMAT) + strlen(absolute_pathname)]; + snprintf(buff, sizeof(buff), FORMAT, absolute_pathname); + print_log_n_stderr(true, true, buff, buff, eno); + } + + return rv; +} + /** * Check if the file or directory is readable * @param absolute_pathname Path of the file or directory to check From 2217091019c06ae69af108c566b389a92eee1e05 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Wed, 29 Nov 2017 18:22:05 +0100 Subject: [PATCH 09/46] MXS-1546: revert commit e16eee0cc3c6307f732c2e43d995d3c86cdd67a7 MXS-1546: revert commit e16eee0cc3c6307f732c2e43d995d3c86cdd67a7 This code is not necessary in MaxScale 2.1 --- .../modules/routing/binlogrouter/blr_slave.c | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/server/modules/routing/binlogrouter/blr_slave.c b/server/modules/routing/binlogrouter/blr_slave.c index c30874867..bd242c31e 100644 --- a/server/modules/routing/binlogrouter/blr_slave.c +++ b/server/modules/routing/binlogrouter/blr_slave.c @@ -2658,30 +2658,6 @@ blr_slave_catchup(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, bool large) /* force slave to read events via catchup routine */ poll_fake_write_event(slave->dcb); } - /** - * Handle Heartbeat: don't check anything else - * set CS_WAIT_DATA and return - */ - else if (hdr.ok == SLAVE_POS_READ_OK && - slave->lastEventReceived == HEARTBEAT_EVENT) - { -#ifndef BLFILE_IN_SLAVE - blr_close_binlog(router, file); -#endif - spinlock_acquire(&router->binlog_lock); - spinlock_acquire(&slave->catch_lock); - - /** - * Set the CS_WAIT_DATA that allows notification - * of new events after HEARTBEAT_EVENT - */ - slave->cstate |= CS_WAIT_DATA; - - spinlock_release(&slave->catch_lock); - spinlock_release(&router->binlog_lock); - - return 1; - } else if (slave->binlog_pos == router->binlog_position && strcmp(slave->binlogfile, router->binlog_name) == 0) { From 0ca04cb5d5f22184c926bb738f42d9162f84465b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 29 Nov 2017 07:33:13 +0200 Subject: [PATCH 10/46] MXS-1536: Fix crash in CREATE TABLE If a CREATE TABLE statement had a quoted keyword as the name of a field, the calculated column count and actual column counts would differ. In addition to this, oneline comments before the end of the statement would truncate the SQL due to the fact that the whitespace was squashed before the comment removal was done. --- server/core/utils.c | 4 +- server/modules/routing/avrorouter/avro_file.c | 2 +- .../modules/routing/avrorouter/avro_schema.c | 57 ++++++++++++------- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/server/core/utils.c b/server/core/utils.c index 9801c0feb..433e7dbe1 100644 --- a/server/core/utils.c +++ b/server/core/utils.c @@ -553,7 +553,9 @@ strip_escape_chars(char* val) #define BUFFER_GROWTH_RATE 2.0 static pcre2_code* remove_comments_re = NULL; static const PCRE2_SPTR remove_comments_pattern = (PCRE2_SPTR) - "(?:`[^`]*`\\K)|(\\/[*](?!(M?!)).*?[*]\\/)|(?:#.*|--[[:space:]].*)"; + "(?:`[^`]*`\\K)|" + "(\\/[*](?!(M?!)).*?[*]\\/)|" + "([[:space:]](?:#.*|--[[:space:]].*(\\n|\\r\\n)))"; /** * Remove SQL comments from the end of a string diff --git a/server/modules/routing/avrorouter/avro_file.c b/server/modules/routing/avrorouter/avro_file.c index b5dedd010..5c4330067 100644 --- a/server/modules/routing/avrorouter/avro_file.c +++ b/server/modules/routing/avrorouter/avro_file.c @@ -1008,13 +1008,13 @@ void handle_query_event(AVRO_INSTANCE *router, REP_HEADER *hdr, int *pending_tra memcpy(db, (char*) ptr + PHDR_OFF + vblklen, dblen); db[dblen] = 0; - unify_whitespace(sql, len); size_t sqlsz = len, tmpsz = len; char *tmp = MXS_MALLOC(len); MXS_ABORT_IF_NULL(tmp); remove_mysql_comments((const char**)&sql, &sqlsz, &tmp, &tmpsz); sql = tmp; len = tmpsz; + unify_whitespace(sql, len); if (is_create_table_statement(router, sql, len)) { diff --git a/server/modules/routing/avrorouter/avro_schema.c b/server/modules/routing/avrorouter/avro_schema.c index eabcac725..5aba768ba 100644 --- a/server/modules/routing/avrorouter/avro_schema.c +++ b/server/modules/routing/avrorouter/avro_schema.c @@ -321,11 +321,11 @@ void save_avro_schema(const char *path, const char* schema, TABLE_MAP *map) * @return Pointer to the start of the definition of NULL if the query is * malformed. */ -static const char* get_table_definition(const char *sql, int* size) +static const char* get_table_definition(const char *sql, int len, int* size) { const char *rval = NULL; const char *ptr = sql; - const char *end = strchr(sql, '\0'); + const char *end = sql + len; while (ptr < end && *ptr != '(') { ptr++; @@ -512,12 +512,16 @@ static const char *extract_field_name(const char* ptr, char* dest, size_t size) } } - if (strncasecmp(ptr, "constraint", 10) == 0 || strncasecmp(ptr, "index", 5) == 0 || - strncasecmp(ptr, "key", 3) == 0 || strncasecmp(ptr, "fulltext", 8) == 0 || - strncasecmp(ptr, "spatial", 7) == 0 || strncasecmp(ptr, "foreign", 7) == 0 || - strncasecmp(ptr, "unique", 6) == 0 || strncasecmp(ptr, "primary", 7) == 0) + if (!bt) { - return NULL; + if (strncasecmp(ptr, "constraint", 10) == 0 || strncasecmp(ptr, "index", 5) == 0 || + strncasecmp(ptr, "key", 3) == 0 || strncasecmp(ptr, "fulltext", 8) == 0 || + strncasecmp(ptr, "spatial", 7) == 0 || strncasecmp(ptr, "foreign", 7) == 0 || + strncasecmp(ptr, "unique", 6) == 0 || strncasecmp(ptr, "primary", 7) == 0) + { + // Found a keyword + return NULL; + } } const char *start = ptr; @@ -698,30 +702,39 @@ TABLE_CREATE* table_create_alloc(const char* sql, int len, const char* event_db) { /** Extract the table definition so we can get the column names from it */ int stmt_len = 0; - const char* statement_sql = get_table_definition(sql, &stmt_len); + const char* statement_sql = get_table_definition(sql, len, &stmt_len); ss_dassert(statement_sql); char table[MYSQL_TABLE_MAXLEN + 1]; char database[MYSQL_DATABASE_MAXLEN + 1]; - const char *db = event_db; - + const char* db = event_db; + const char* err = NULL; MXS_INFO("Create table: %.*s", len, sql); - if (!get_table_name(sql, table)) + if (!statement_sql) { - MXS_ERROR("Malformed CREATE TABLE statement, could not extract table name: %s", sql); - return NULL; + err = "table definition"; + } + else if (!get_table_name(sql, table)) + { + err = "table name"; + } + /** The CREATE statement contains the database name */ + else if (strlen(db) == 0) + { + if (get_database_name(sql, database)) + { + db = database; + } + else + { + err = "database name"; + } } - /** The CREATE statement contains the database name */ - if (strlen(db) == 0) + if (err) { - if (!get_database_name(sql, database)) - { - MXS_ERROR("Malformed CREATE TABLE statement, could not extract " - "database name: %s", sql); - return NULL; - } - db = database; + MXS_ERROR("Malformed CREATE TABLE statement, could not extract %s: %.*s", err, len, sql); + return NULL; } int* lengths = NULL; From 764863cb3faa126635779c2aca23accdabd75c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 29 Nov 2017 10:34:13 +0200 Subject: [PATCH 11/46] MXS-1536: Add Annotate_rows event processing The Annotate_rows events were not processed which caused the following table map event to be ignored. Also removed a false debug assertion. The byte count can be zero and the pointer is not guaranteed to point to anything valid. --- server/modules/routing/avrorouter/avro_file.c | 7 +++++++ server/modules/routing/avrorouter/avro_rbr.c | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/modules/routing/avrorouter/avro_file.c b/server/modules/routing/avrorouter/avro_file.c index 5c4330067..f902f52be 100644 --- a/server/modules/routing/avrorouter/avro_file.c +++ b/server/modules/routing/avrorouter/avro_file.c @@ -665,6 +665,13 @@ avro_binlog_end_t avro_read_all_events(AVRO_INSTANCE *router) snprintf(next_file, sizeof(next_file), BINLOG_NAMEFMT, router->fileroot, blr_file_get_next_binlogname(router->binlog_name)); } + else if (hdr.event_type == MARIADB_ANNOTATE_ROWS_EVENT) + { + MXS_INFO("Annotate_rows_event: %.*s", hdr.event_size - BINLOG_EVENT_HDR_LEN, ptr); + pos += original_size; + router->current_pos = pos; + continue; + } else if (hdr.event_type == TABLE_MAP_EVENT) { handle_table_map_event(router, &hdr, ptr); diff --git a/server/modules/routing/avrorouter/avro_rbr.c b/server/modules/routing/avrorouter/avro_rbr.c index 4ad688097..2df4a07c6 100644 --- a/server/modules/routing/avrorouter/avro_rbr.c +++ b/server/modules/routing/avrorouter/avro_rbr.c @@ -588,7 +588,6 @@ uint8_t* process_row_event_data(TABLE_MAP *map, TABLE_CREATE *create, avro_value } MXS_INFO("[%ld] CHAR: field: %d bytes, data: %d bytes", i, field_length, bytes); - ss_dassert(bytes || *ptr == '\0'); char str[bytes + 1]; memcpy(str, ptr, bytes); str[bytes] = '\0'; From a32789d4accf0a3bbeed03a2a20f04ea085190ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 29 Nov 2017 13:16:40 +0200 Subject: [PATCH 12/46] MXS-1536: Fix ALTER TABLE parsing The ALTER TABLE parsing didn't properly handle escaped values and it used the current database unconditionally. --- .../modules/routing/avrorouter/avro_schema.c | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/server/modules/routing/avrorouter/avro_schema.c b/server/modules/routing/avrorouter/avro_schema.c index 5aba768ba..d546b56bc 100644 --- a/server/modules/routing/avrorouter/avro_schema.c +++ b/server/modules/routing/avrorouter/avro_schema.c @@ -698,7 +698,7 @@ TABLE_CREATE* table_create_from_schema(const char* file, const char* db, * @param db Database where this query was executed * @return New CREATE_TABLE object or NULL if an error occurred */ -TABLE_CREATE* table_create_alloc(const char* sql, int len, const char* event_db) +TABLE_CREATE* table_create_alloc(const char* sql, int len, const char* db) { /** Extract the table definition so we can get the column names from it */ int stmt_len = 0; @@ -706,7 +706,6 @@ TABLE_CREATE* table_create_alloc(const char* sql, int len, const char* event_db) ss_dassert(statement_sql); char table[MYSQL_TABLE_MAXLEN + 1]; char database[MYSQL_DATABASE_MAXLEN + 1]; - const char* db = event_db; const char* err = NULL; MXS_INFO("Create table: %.*s", len, sql); @@ -719,16 +718,13 @@ TABLE_CREATE* table_create_alloc(const char* sql, int len, const char* event_db) err = "table name"; } /** The CREATE statement contains the database name */ - else if (strlen(db) == 0) + if (get_database_name(sql, database)) { - if (get_database_name(sql, database)) - { - db = database; - } - else - { - err = "database name"; - } + db = database; + } + else if (*db == '\0') + { + err = "database name"; } if (err) @@ -906,6 +902,27 @@ static void remove_extras(char* str) ss_dassert(strlen(str) == len); } + +static void remove_backticks(char* src) +{ + char* dest = src; + + while (*src) + { + if (*src != '`') + { + // Non-backtick character, keep it + *dest = *src; + dest++; + } + + src++; + } + + ss_dassert(dest == src || (*dest != '\0' && dest < src)); + *dest = '\0'; +} + /** * Extract both tables from a `CREATE TABLE t1 LIKE t2` statement */ @@ -1108,10 +1125,12 @@ static bool tok_eq(const char *a, const char *b, size_t len) void read_alter_identifier(const char *sql, const char *end, char *dest, int size) { int len = 0; - const char *tok = get_tok(sql, &len, end); - if (tok && (tok = get_tok(tok + len, &len, end)) && (tok = get_tok(tok + len, &len, end))) + const char *tok = get_tok(sql, &len, end); // ALTER + if (tok && (tok = get_tok(tok + len, &len, end)) // TABLE + && (tok = get_tok(tok + len, &len, end))) // Table identifier { snprintf(dest, size, "%.*s", len, tok); + remove_backticks(dest); } } From 38d5bc5679b1f0b0ef46b44776b9e1ee8160aee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 29 Nov 2017 22:18:20 +0200 Subject: [PATCH 13/46] MXS-1462: Update Connector-C to 2.3.4 The issues with TLS were fixed by upgrading the connector to the latest 2.3 version. --- cmake/BuildMariaDBConnector.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BuildMariaDBConnector.cmake b/cmake/BuildMariaDBConnector.cmake index 5ec1bb873..047e01f89 100644 --- a/cmake/BuildMariaDBConnector.cmake +++ b/cmake/BuildMariaDBConnector.cmake @@ -9,7 +9,7 @@ set(MARIADB_CONNECTOR_C_REPO "https://github.com/MariaDB/mariadb-connector-c.git CACHE STRING "MariaDB Connector-C Git repository") # Release 2.3.3 (preliminary) of the Connector-C -set(MARIADB_CONNECTOR_C_TAG "v2.3.3_pre" +set(MARIADB_CONNECTOR_C_TAG "v_2.3.4" CACHE STRING "MariaDB Connector-C Git tag") ExternalProject_Add(connector-c From 7c2a173a17d8b59aae992731fe810c262188dea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 30 Nov 2017 00:01:14 +0200 Subject: [PATCH 14/46] MXS-1536: Always recreate TABLE_MAP objects When a table map event is read after an alter table, the old TABLE_MAP object contains old information. Due to this, as well as the added benefit of making the code easier to read, the recycling of TABLE_MAP objects was removed. In practice, there were no benefits to re-mapping the tables to a different ID. --- server/modules/routing/avrorouter/avro_file.c | 2 + server/modules/routing/avrorouter/avro_rbr.c | 82 ++++++++----------- .../modules/routing/avrorouter/avro_schema.c | 54 ++++++------ .../modules/routing/avrorouter/avrorouter.h | 1 - 4 files changed, 59 insertions(+), 80 deletions(-) diff --git a/server/modules/routing/avrorouter/avro_file.c b/server/modules/routing/avrorouter/avro_file.c index f902f52be..71f54432a 100644 --- a/server/modules/routing/avrorouter/avro_file.c +++ b/server/modules/routing/avrorouter/avro_file.c @@ -971,6 +971,8 @@ bool save_and_replace_table_create(AVRO_INSTANCE *router, TABLE_CREATE *created) { if (strcmp(key, table_ident) == 0) { + TABLE_MAP* map = hashtable_fetch(router->table_maps, key); + router->active_maps[map->id % MAX_MAPPED_TABLES] = NULL; hashtable_delete(router->table_maps, key); } } diff --git a/server/modules/routing/avrorouter/avro_rbr.c b/server/modules/routing/avrorouter/avro_rbr.c index 2df4a07c6..f394bad66 100644 --- a/server/modules/routing/avrorouter/avro_rbr.c +++ b/server/modules/routing/avrorouter/avro_rbr.c @@ -88,70 +88,51 @@ bool handle_table_map_event(AVRO_INSTANCE *router, REP_HEADER *hdr, uint8_t *ptr { ss_dassert(create->columns > 0); TABLE_MAP *old = hashtable_fetch(router->table_maps, table_ident); + TABLE_MAP *map = table_map_alloc(ptr, ev_len, create); + MXS_ABORT_IF_NULL(map); // Fatal error at this point + char* json_schema = json_new_schema_from_table(map); - if (old == NULL || old->version != create->version) + if (json_schema) { - TABLE_MAP *map = table_map_alloc(ptr, ev_len, create); + char filepath[PATH_MAX + 1]; + snprintf(filepath, sizeof(filepath), "%s/%s.%06d.avro", + router->avrodir, table_ident, map->version); - if (map) + /** Close the file and open a new one */ + hashtable_delete(router->open_tables, table_ident); + AVRO_TABLE *avro_table = avro_table_alloc(filepath, json_schema, router->block_size); + + if (avro_table) { - char* json_schema = json_new_schema_from_table(map); + bool notify = old != NULL; - if (json_schema) + if (old) { - char filepath[PATH_MAX + 1]; - snprintf(filepath, sizeof(filepath), "%s/%s.%06d.avro", - router->avrodir, table_ident, map->version); - - /** Close the file and open a new one */ - hashtable_delete(router->open_tables, table_ident); - AVRO_TABLE *avro_table = avro_table_alloc(filepath, json_schema, router->block_size); - - if (avro_table) - { - bool notify = old != NULL; - - if (old) - { - router->active_maps[old->id % MAX_MAPPED_TABLES] = NULL; - } - hashtable_delete(router->table_maps, table_ident); - hashtable_add(router->table_maps, (void*) table_ident, map); - hashtable_add(router->open_tables, table_ident, avro_table); - save_avro_schema(router->avrodir, json_schema, map); - router->active_maps[map->id % MAX_MAPPED_TABLES] = map; - MXS_DEBUG("Table %s mapped to %lu", table_ident, map->id); - rval = true; - - if (notify) - { - notify_all_clients(router); - } - } - else - { - MXS_ERROR("Failed to open new Avro file for writing."); - } - MXS_FREE(json_schema); + router->active_maps[old->id % MAX_MAPPED_TABLES] = NULL; } - else + hashtable_delete(router->table_maps, table_ident); + hashtable_add(router->table_maps, (void*)table_ident, map); + hashtable_add(router->open_tables, table_ident, avro_table); + save_avro_schema(router->avrodir, json_schema, map); + router->active_maps[map->id % MAX_MAPPED_TABLES] = map; + ss_dassert(router->active_maps[id % MAX_MAPPED_TABLES] == map); + MXS_DEBUG("Table %s mapped to %lu", table_ident, map->id); + rval = true; + + if (notify) { - MXS_ERROR("Failed to create JSON schema."); + notify_all_clients(router); } } else { - MXS_ERROR("Failed to allocate new table map."); + MXS_ERROR("Failed to open new Avro file for writing."); } + MXS_FREE(json_schema); } else { - router->active_maps[old->id % MAX_MAPPED_TABLES] = NULL; - table_map_remap(ptr, ev_len, old); - router->active_maps[old->id % MAX_MAPPED_TABLES] = old; - MXS_DEBUG("Table %s re-mapped to %lu", table_ident, old->id); - /** No changes in the schema */ - rval = true; + MXS_ERROR("Failed to create JSON schema."); } } else @@ -345,8 +326,9 @@ bool handle_row_event(AVRO_INSTANCE *router, REP_HEADER *hdr, uint8_t *ptr) } else { - MXS_ERROR("Row event and table map event have different column counts." - " Only full row image is currently supported."); + MXS_ERROR("Row event and table map event have different column " + "counts for table %s.%s, only full row image is currently " + "supported.", map->database, map->table); } } else diff --git a/server/modules/routing/avrorouter/avro_schema.c b/server/modules/routing/avrorouter/avro_schema.c index d546b56bc..9949c9ebe 100644 --- a/server/modules/routing/avrorouter/avro_schema.c +++ b/server/modules/routing/avrorouter/avro_schema.c @@ -1206,20 +1206,33 @@ bool table_create_alter(TABLE_CREATE *create, const char *sql, const char *end) if (tok_eq(ptok, "add", plen) && tok_eq(tok, "column", len)) { tok = get_tok(tok + len, &len, end); - - create->column_names = MXS_REALLOC(create->column_names, sizeof(char*) * (create->columns + 1)); - create->column_types = MXS_REALLOC(create->column_types, sizeof(char*) * (create->columns + 1)); - create->column_lengths = MXS_REALLOC(create->column_lengths, sizeof(int) * (create->columns + 1)); - char avro_token[len + 1]; make_avro_token(avro_token, tok, len); - char field_type[200] = ""; // Enough to hold all types - int field_length = extract_type_length(tok + len, field_type); - create->column_names[create->columns] = MXS_STRDUP_A(avro_token); - create->column_types[create->columns] = MXS_STRDUP_A(field_type); - create->column_lengths[create->columns] = field_length; - create->columns++; - updates++; + bool is_new = true; + + for (uint64_t i = 0; i < create->columns; i++) + { + if (strcmp(avro_token, create->column_names[i]) == 0) + { + is_new = false; + break; + } + } + + if (is_new) + { + create->column_names = MXS_REALLOC(create->column_names, sizeof(char*) * (create->columns + 1)); + create->column_types = MXS_REALLOC(create->column_types, sizeof(char*) * (create->columns + 1)); + create->column_lengths = MXS_REALLOC(create->column_lengths, sizeof(int) * (create->columns + 1)); + + char field_type[200] = ""; // Enough to hold all types + int field_length = extract_type_length(tok + len, field_type); + create->column_names[create->columns] = MXS_STRDUP_A(avro_token); + create->column_types[create->columns] = MXS_STRDUP_A(field_type); + create->column_lengths[create->columns] = field_length; + create->columns++; + updates++; + } tok = get_next_def(tok, end); len = 0; } @@ -1425,20 +1438,3 @@ void table_map_free(TABLE_MAP *map) MXS_FREE(map); } } - -/** - * @brief Map a table to a different ID - * - * This updates the table ID that the @c TABLE_MAP object is assigned with - * - * @param ptr Pointer to the start of a table map event - * @param hdr_len Post-header length - * @param map Table map to remap - */ -void table_map_remap(uint8_t *ptr, uint8_t hdr_len, TABLE_MAP *map) -{ - uint64_t table_id = 0; - size_t id_size = hdr_len == 6 ? 4 : 6; - memcpy(&table_id, ptr, id_size); - map->id = table_id; -} diff --git a/server/modules/routing/avrorouter/avrorouter.h b/server/modules/routing/avrorouter/avrorouter.h index 1f91b31a2..9f4ebb1a5 100644 --- a/server/modules/routing/avrorouter/avrorouter.h +++ b/server/modules/routing/avrorouter/avrorouter.h @@ -319,7 +319,6 @@ extern char* json_new_schema_from_table(TABLE_MAP *map); extern void save_avro_schema(const char *path, const char* schema, TABLE_MAP *map); extern bool handle_table_map_event(AVRO_INSTANCE *router, REP_HEADER *hdr, uint8_t *ptr); extern bool handle_row_event(AVRO_INSTANCE *router, REP_HEADER *hdr, uint8_t *ptr); -extern void table_map_remap(uint8_t *ptr, uint8_t hdr_len, TABLE_MAP *map); enum avrorouter_file_op { From d5d41349aee235e12253df52c3ab9ee900719e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 20 Nov 2017 11:16:52 +0200 Subject: [PATCH 15/46] MXS-1509: Add `ignore_external_masters` parameter The new parameter allows ignoring of master servers that are external to the monitor configuration. This allows sub-trees of the actual replication tree to be used as fully fledged replication trees. --- Documentation/Monitors/MySQL-Monitor.md | 17 +++++++++++++++++ include/maxscale/server.h | 4 ++++ server/modules/monitor/mysqlmon.h | 1 + server/modules/monitor/mysqlmon/mysql_mon.c | 15 +++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/Documentation/Monitors/MySQL-Monitor.md b/Documentation/Monitors/MySQL-Monitor.md index e49459e59..6afe4dca6 100644 --- a/Documentation/Monitors/MySQL-Monitor.md +++ b/Documentation/Monitors/MySQL-Monitor.md @@ -120,6 +120,23 @@ This functionality is similar to the [Multi-Master Monitor](MM-Monitor.md) functionality. The only difference is that the MySQL monitor will also detect traditional Master-Slave topologies. +### `ignore_external_masters` + +Ignore any servers that are not monitored by this monitor but are a part of the +replication topology. This option was added in MaxScale 2.1.12 and is disabled +by default. + +MaxScale detects if a master server replicates from an external server. When +this is detected, the server is assigned the `Slave` and `Slave of External +Server` labels and will be treated as a slave server. Most of the time this +topology is used when MaxScale is used for read scale-out without master +servers, a Galera cluster with read replicas being a prime example of this +setup. Sometimes this is not the desired behavior and the external master server +should be ignored. Most of the time this is due to multi-source replication. + +When this option is enabled, all servers that have the `Master, Slave, Slave of +External Server, Running` labels will instead get the `Master, Running` labels. + ### `detect_standalone_master` Detect standalone master servers. This feature takes a boolean parameter and is diff --git a/include/maxscale/server.h b/include/maxscale/server.h index acbce95be..2fb6e4e77 100644 --- a/include/maxscale/server.h +++ b/include/maxscale/server.h @@ -192,6 +192,10 @@ enum (((server)->status & (SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE|SERVER_MAINT)) == \ (SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE)) +#define SERVER_IS_SLAVE_OF_EXTERNAL_MASTER(s) (((s)->status & \ + (SERVER_RUNNING|SERVER_SLAVE_OF_EXTERNAL_MASTER)) == \ + (SERVER_RUNNING|SERVER_SLAVE_OF_EXTERNAL_MASTER)) + /** * @brief Allocate a new server * diff --git a/server/modules/monitor/mysqlmon.h b/server/modules/monitor/mysqlmon.h index ae000150d..1ec15e505 100644 --- a/server/modules/monitor/mysqlmon.h +++ b/server/modules/monitor/mysqlmon.h @@ -66,6 +66,7 @@ typedef struct bool detectStaleMaster; /**< Monitor flag for MySQL replication Stale Master detection */ bool detectStaleSlave; /**< Monitor flag for MySQL replication Stale Master detection */ bool multimaster; /**< Detect and handle multi-master topologies */ + bool ignore_external_masters; /**< Ignore masters outside of the monitor configuration */ int disableMasterFailback; /**< Monitor flag for Galera Cluster Master failback */ int availableWhenDonor; /**< Monitor flag for Galera Cluster Donor availability */ int disableMasterRoleSetting; /**< Monitor flag to disable setting master role */ diff --git a/server/modules/monitor/mysqlmon/mysql_mon.c b/server/modules/monitor/mysqlmon/mysql_mon.c index 5abab0601..14226c14b 100644 --- a/server/modules/monitor/mysqlmon/mysql_mon.c +++ b/server/modules/monitor/mysqlmon/mysql_mon.c @@ -129,6 +129,7 @@ MXS_MODULE* MXS_CREATE_MODULE() {"detect_standalone_master", MXS_MODULE_PARAM_BOOL, "false"}, {"failcount", MXS_MODULE_PARAM_COUNT, "5"}, {"allow_cluster_recovery", MXS_MODULE_PARAM_BOOL, "true"}, + {"ignore_external_masters", MXS_MODULE_PARAM_BOOL, "false"}, { "script", MXS_MODULE_PARAM_PATH, @@ -280,6 +281,7 @@ startMonitor(MXS_MONITOR *monitor, const MXS_CONFIG_PARAMETER* params) handle->detectStaleSlave = config_get_bool(params, "detect_stale_slave"); handle->replicationHeartbeat = config_get_bool(params, "detect_replication_lag"); handle->multimaster = config_get_bool(params, "multimaster"); + handle->ignore_external_masters = config_get_bool(params, "ignore_external_masters"); handle->detect_standalone_master = config_get_bool(params, "detect_standalone_master"); handle->failcount = config_get_integer(params, "failcount"); handle->allow_cluster_recovery = config_get_bool(params, "allow_cluster_recovery"); @@ -1338,6 +1340,19 @@ monitorMain(void *arg) } } + /** + * Clear external slave status from master if configured to do so. + * This allows parts of a multi-tiered replication setup to be used + * in MaxScale. + */ + if (root_master && SERVER_IS_SLAVE_OF_EXTERNAL_MASTER(root_master->server) && + SERVER_IS_MASTER(root_master->server) && handle->ignore_external_masters) + { + monitor_clear_pending_status(root_master, + SERVER_SLAVE | SERVER_SLAVE_OF_EXTERNAL_MASTER); + server_clear_status_nolock(root_master->server, SERVER_SLAVE | SERVER_SLAVE_OF_EXTERNAL_MASTER); + } + /** * After updating the status of all servers, check if monitor events * need to be launched. From 016b0f69f751fb6e144778d24229a111f4161a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 23 Nov 2017 12:58:21 +0200 Subject: [PATCH 16/46] MXS-1509: Initial implementation of test case Added some code to detect server states in a consistent manner and created the test. The multi-source replication appeared to cause problems for the test system which needs to be resolved. Added --force flags to most direct `mysql` calls to prevent errors from stopping the processing of remaining commands. --- maxscale-system-test/CMakeLists.txt | 4 + maxscale-system-test/mariadb_nodes.cpp | 49 +++++++++--- maxscale-system-test/mxs1509.cpp | 95 ++++++++++++++++++++++++ maxscale-system-test/testconnections.cpp | 40 ++++++++++ maxscale-system-test/testconnections.h | 13 ++++ 5 files changed, 189 insertions(+), 12 deletions(-) create mode 100644 maxscale-system-test/mxs1509.cpp diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 6556007e7..3a77efc20 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -510,6 +510,10 @@ add_test_executable(mxs1468.cpp mxs1468 mxs1468 LABELS REPL_BACKEND) # https://jira.mariadb.org/browse/MXS-1476 add_test_executable(mxs1476.cpp mxs1476 mxs1476 LABELS GALERA_BACKEND) + # MXS-1509: Show correct server state for multisource replication + # https://jira.mariadb.org/browse/MXS-1509 +add_test_executable(mxs1509.cpp mxs1509 mxs1509 LABELS REPL_BACKEND) + # 'namedserverfilter' test add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND) diff --git a/maxscale-system-test/mariadb_nodes.cpp b/maxscale-system-test/mariadb_nodes.cpp index 1d45b99ce..ad66452b0 100644 --- a/maxscale-system-test/mariadb_nodes.cpp +++ b/maxscale-system-test/mariadb_nodes.cpp @@ -375,9 +375,8 @@ int Mariadb_nodes::stop_nodes() printf("Stopping node %d\n", i); fflush(stdout); local_result += execute_query(nodes[i], "stop slave;"); - fflush(stdout); local_result += stop_node(i); - fflush(stdout); + local_result += ssh_node(i, true, "rm -f /var/lib/mysql/*master*.info"); } return local_result; } @@ -428,12 +427,12 @@ int Mariadb_nodes::start_replication() { local_result += start_node(i, ""); ssh_node(i, true, - "mysql -u root %s -e \"STOP SLAVE; RESET SLAVE; RESET SLAVE ALL; RESET MASTER; SET GLOBAL read_only=OFF;\"", + "mysql --force -u root %s -e \"STOP SLAVE; STOP ALL SLAVES; RESET SLAVE; RESET SLAVE ALL; RESET MASTER; SET GLOBAL read_only=OFF;\"", socket_cmd[i]); ssh_node(i, true, "sudo rm -f /etc/my.cnf.d/kerb.cnf"); ssh_node(i, true, - "for i in `mysql -ss -u root %s -e \"SHOW DATABASES\"|grep -iv 'mysql\\|information_schema\\|performance_schema'`; " - "do mysql -u root %s -e \"DROP DATABASE $i\";" + "for i in `mysql -ss --force -u root %s -e \"SHOW DATABASES\"|grep -iv 'mysql\\|information_schema\\|performance_schema'`; " + "do mysql --force -u root %s -e \"DROP DATABASE $i\";" "done", socket_cmd[i], socket_cmd[i]); } @@ -444,7 +443,7 @@ int Mariadb_nodes::start_replication() user_name, password, access_homedir[0], socket_cmd[0]); // Create a database dump from the master and distribute it to the slaves - ssh_node(0, true, "mysql -u root %s -e \"CREATE DATABASE test\"; " + ssh_node(0, true, "mysql --force -u root %s -e \"CREATE DATABASE test\"; " "mysqldump --all-databases --add-drop-database --flush-privileges --master-data=1 --gtid %s > /tmp/master_backup.sql", socket_cmd[0], socket_cmd[0]); sprintf(str, "%s/master_backup.sql", test_dir); @@ -456,9 +455,9 @@ int Mariadb_nodes::start_replication() printf("Starting node %d\n", i); fflush(stdout); copy_to_node(str, "/tmp/master_backup.sql", i); - ssh_node(i, true, "mysql -u root %s < /tmp/master_backup.sql", + ssh_node(i, true, "mysql --force -u root %s < /tmp/master_backup.sql", socket_cmd[i]); - ssh_node(i, true, "mysql -u root %s -e \"CHANGE MASTER TO MASTER_HOST=\\\"%s\\\", MASTER_PORT=%d, " + ssh_node(i, true, "mysql --force -u root %s -e \"CHANGE MASTER TO MASTER_HOST=\\\"%s\\\", MASTER_PORT=%d, " "MASTER_USER=\\\"repl\\\", MASTER_PASSWORD=\\\"repl\\\";" "START SLAVE;\"", socket_cmd[i], IP_private[0], port[0]); } @@ -565,8 +564,11 @@ int Mariadb_nodes::unblock_all_nodes() int Mariadb_nodes::check_node_ssh(int node) { int res = 0; - printf("Checking node %d\n", node); - fflush(stdout); + if (verbose) + { + printf("Checking node %d\n", node); + fflush(stdout); + } if (ssh_node(0, false, "ls > /dev/null") != 0) { @@ -574,7 +576,7 @@ int Mariadb_nodes::check_node_ssh(int node) fflush(stdout); res = 1; } - else + else if (verbose) { printf("Node %d is OK\n", node); fflush(stdout); @@ -684,6 +686,28 @@ static bool bad_slave_thread_status(MYSQL *conn, const char *field, int node) return rval; } +static bool multi_source_replication(MYSQL *conn, int node) +{ + bool rval = true; + MYSQL_RES *res; + + if (mysql_query(conn, "SHOW ALL SLAVES STATUS") == 0 && + (res = mysql_store_result(conn))) + { + if (mysql_num_rows(res) == 1) + { + rval = false; + } + else + { + printf("Node %d: More than one configured slave\n", node); + fflush(stdout); + } + } + + return rval; +} + int Mariadb_nodes::check_replication() { int master = 0; @@ -713,7 +737,8 @@ int Mariadb_nodes::check_replication() } } else if (bad_slave_thread_status(nodes[i], "Slave_IO_Running", i) || - bad_slave_thread_status(nodes[i], "Slave_SQL_Running", i)) + bad_slave_thread_status(nodes[i], "Slave_SQL_Running", i) || + multi_source_replication(nodes[i], i)) { res = 1; } diff --git a/maxscale-system-test/mxs1509.cpp b/maxscale-system-test/mxs1509.cpp new file mode 100644 index 000000000..4ae7f61bb --- /dev/null +++ b/maxscale-system-test/mxs1509.cpp @@ -0,0 +1,95 @@ +/** + * MXS-1509: Show correct server state for multisource replication + * + * https://jira.mariadb.org/browse/MXS-1509 + */ + +#include "testconnections.h" +#include + +void change_master(TestConnections& test, int slave, int master, const char* name = NULL) +{ + std::string source; + + if (name) + { + source = "'"; + source += name; + source += "'"; + } + + execute_query(test.repl->nodes[slave], "STOP ALL SLAVES;CHANGE MASTER %s TO master_host='%s', master_port=3306, " + "master_user='%s', master_password='%s', master_use_gtid=slave_pos;START ALL SLAVES", + source.c_str(), test.repl->IP[master], test.repl->user_name, test.repl->password, source.c_str()); +} + +const char* dump_status(const StringSet& current, const StringSet& expected) +{ + std::stringstream ss; + ss << "Current status: ("; + + for (const auto& a: current) + { + ss << a << ","; + } + + ss << ") Expected status: ("; + + for (const auto& a: expected) + { + ss << a << ","; + } + + ss << ")"; + + static std::string res = ss.str(); + return res.c_str(); +} + +void check_status(TestConnections& test, const StringSet& expected_master, const StringSet& expected_slave) +{ + sleep(2); + StringSet master = test.get_server_status("server1"); + StringSet slave = test.get_server_status("server2"); + test.add_result(master != expected_master, "Master status is not what was expected: %s", + dump_status(master, expected_master)); + test.add_result(slave != expected_slave, "Slave status is not what was expected: %s", + dump_status(slave, expected_slave)); +} + +int main(int argc, char** argv) +{ + TestConnections test(argc, argv); + + // Stop replication on nodes three and four + test.repl->connect(); + execute_query(test.repl->nodes[2], "STOP ALL SLAVES; RESET SLAVE ALL;"); + execute_query(test.repl->nodes[3], "STOP ALL SLAVES; RESET SLAVE ALL;"); + + // Point the master to an external server + change_master(test, 1, 0); + change_master(test, 0, 2); + check_status(test, {"Master", "Running"}, {"Slave", "Running"}); + + // Resetting the slave on master should have no effect + execute_query(test.repl->nodes[0], "STOP ALL SLAVES; RESET SLAVE ALL;"); + check_status(test, {"Master", "Running"}, {"Slave", "Running"}); + + // Configure multi-source replication, check that master status is as expected + change_master(test, 0, 2, "extra-slave"); + change_master(test, 1, 2, "extra-slave"); + check_status(test, {"Master", "Running"}, {"Slave", "Running", "Slave of External Server"}); + + // Stopping multi-source replication on slave should remove the Slave of External Server status + execute_query(test.repl->nodes[1], "STOP SLAVE 'extra-slave'; RESET SLAVE 'extra-slave';"); + check_status(test, {"Master", "Running"}, {"Slave", "Running"}); + + // Doing the same on the master should have no effect + execute_query(test.repl->nodes[0], "STOP ALL SLAVES; RESET SLAVE ALL;"); + check_status(test, {"Master", "Running"}, {"Slave", "Running"}); + + // Cleanup + test.repl->execute_query_all_nodes( "STOP ALL SLAVES; RESET SLAVE ALL;"); + test.repl->fix_replication(); + return test.global_result; +} diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 8aee42d81..63972d346 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -1918,6 +1918,46 @@ int TestConnections::find_master_maxadmin(Mariadb_nodes * nodes) return master; } +StringSet TestConnections::get_server_status(const char* name) +{ + std::set rval; + char* res = ssh_maxscale_output(true, "maxadmin list servers|grep \'%s\'", name); + char* pipe = strrchr(res, '|'); + + if (res && pipe) + { + pipe++; + char* tok = strtok(pipe, ","); + + while (tok) + { + char* p = tok; + char *end = strchr(tok, '\n'); + if (!end) + end = strchr(tok, '\0'); + + // Trim leading whitespace + while (p < end && isspace(*p)) + { + p++; + } + + // Trim trailing whitespace + while (end > tok && isspace(*end)) + { + *end-- = '\0'; + } + + rval.insert(p); + tok = strtok(NULL, ",\n"); + } + + free(res); + } + + return rval; +} + int TestConnections::find_slave_maxadmin(Mariadb_nodes * nodes) { int slave = -1; diff --git a/maxscale-system-test/testconnections.h b/maxscale-system-test/testconnections.h index 6d41ec5d0..74fc6c519 100644 --- a/maxscale-system-test/testconnections.h +++ b/maxscale-system-test/testconnections.h @@ -6,6 +6,10 @@ #include #include #include +#include +#include + +typedef std::set StringSet; /** * @brief Class contains references to Master/Slave and Galera test setups @@ -657,6 +661,15 @@ public: void check_current_operations(int value); void check_current_connections(int value); + /** + * @brief Get the set of labels that are assigned to server @c name + * + * @param name The name of the server that must be present in the output `maxadmin list servers` + * + * @return A set of string labels assigned to this server + */ + StringSet get_server_status(const char* name); + /** * @brief check_maxscale_processes Check if number of running Maxscale processes is equal to 'expected' * @param expected expected number of Maxscale processes From f2a0cc8b31d890eb680738253aaa81f8f9135d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 30 Nov 2017 17:25:06 +0200 Subject: [PATCH 17/46] Don't send hangup error on connection close If the client has sent a COM_QUIT, the hangup error message should not be written. --- server/modules/protocol/MySQL/MySQLClient/mysql_client.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c index a646263c1..758a18505 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c @@ -1446,7 +1446,11 @@ static int gw_client_hangup_event(DCB *dcb) goto retblock; } - modutil_send_mysql_err_packet(dcb, 0, 0, 1927, "08S01", "Connection killed by MaxScale"); + if (!session_valid_for_pool(session)) + { + // The client did not send a COM_QUIT packet + modutil_send_mysql_err_packet(dcb, 0, 0, 1927, "08S01", "Connection killed by MaxScale"); + } dcb_close(dcb); retblock: From 8cce2b4b99234e841acbdd823f7a27ba90075f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 30 Nov 2017 18:03:45 +0200 Subject: [PATCH 18/46] Fix binlogrouter configuration example The configuration had a `servers=masterdb` line that was not supposed to be there. --- Documentation/Routers/Binlogrouter.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/Routers/Binlogrouter.md b/Documentation/Routers/Binlogrouter.md index ae603f146..851291974 100644 --- a/Documentation/Routers/Binlogrouter.md +++ b/Documentation/Routers/Binlogrouter.md @@ -285,7 +285,6 @@ follows. [Replication] type=service router=binlogrouter -servers=masterdb user=maxscale passwd=maxpwd server_id=3 From 96d9c47016a7f4d1629e36d8bdb7ade7730fb80f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 1 Dec 2017 03:50:57 +0200 Subject: [PATCH 19/46] MXS-1553: Enforce SSL usage for monitors If a server is configured to use SSL, then MaxScale should respect the configuration and refuse to use a connection that is not encrypted. --- include/maxscale/server.h | 4 ++++ server/core/mysql_utils.c | 13 +++++++++++++ server/core/server.c | 3 +++ 3 files changed, 20 insertions(+) diff --git a/include/maxscale/server.h b/include/maxscale/server.h index 2fb6e4e77..0ecdac470 100644 --- a/include/maxscale/server.h +++ b/include/maxscale/server.h @@ -96,6 +96,10 @@ typedef struct server uint8_t charset; /**< Default server character set */ bool is_active; /**< Server is active and has not been "destroyed" */ bool created_online; /**< Whether this server was created after startup */ + struct + { + bool ssl_not_enabled; /**< SSL not used for an SSL enabled server */ + } log_warning; /**< Whether a specific warning was logged */ #if defined(SS_DEBUG) skygw_chk_t server_chk_tail; #endif diff --git a/server/core/mysql_utils.c b/server/core/mysql_utils.c index c7a4b66b3..ac467d602 100644 --- a/server/core/mysql_utils.c +++ b/server/core/mysql_utils.c @@ -171,6 +171,19 @@ MYSQL *mxs_mysql_real_connect(MYSQL *con, SERVER *server, const char *user, cons MY_CHARSET_INFO cs_info; mysql_get_character_set_info(mysql, &cs_info); server->charset = cs_info.number; + + if (listener && mysql_get_ssl_cipher(con) == NULL) + { + if (server->log_warning.ssl_not_enabled) + { + server->log_warning.ssl_not_enabled = false; + MXS_ERROR("An encrypted connection to '%s' could not be created, " + "ensure that TLS is enabled on the target server.", + server->unique_name); + } + // Don't close the connection as it is closed elsewhere, just set to NULL + mysql = NULL; + } } return mysql; diff --git a/server/core/server.c b/server/core/server.c index 744e0d931..d6db003de 100644 --- a/server/core/server.c +++ b/server/core/server.c @@ -140,6 +140,9 @@ SERVER* server_alloc(const char *name, const char *address, unsigned short port, server->created_online = false; server->charset = SERVER_DEFAULT_CHARSET; + // Log all warnings once + memset(&server->log_warning, 1, sizeof(server->log_warning)); + spinlock_acquire(&server_spin); server->next = allServers; allServers = server; From 05066697389b5bc71a71b7299f6551f8e2276cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 1 Dec 2017 06:01:18 +0200 Subject: [PATCH 20/46] Only refresh users on failed authentication When backend authentication failed due to errors other than wrong credentials, the users were unconditionally reloaded. This caused a spike of activity whenever authentication failed for other reasons. Also fixed the test that checks for this to look for the correct error message. --- maxscale-system-test/crash_out_of_files.cpp | 2 +- .../MySQL/MySQLBackend/mysql_backend.c | 22 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/maxscale-system-test/crash_out_of_files.cpp b/maxscale-system-test/crash_out_of_files.cpp index 62bf8d8ec..e17938ede 100644 --- a/maxscale-system-test/crash_out_of_files.cpp +++ b/maxscale-system-test/crash_out_of_files.cpp @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) Test->repl->close_connections(); Test->stop_timeout(); - Test->check_log_err((char *) "refresh rate limit exceeded", false); + Test->check_log_err((char *) "Refresh rate limit exceeded", false); Test->check_maxscale_alive(); int rval = Test->global_result; delete Test; diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index 32c292301..e03761cf7 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -329,7 +329,7 @@ bool is_error_response(GWBUF *buffer) * @param dcb Backend DCB where authentication failed * @param buffer Buffer containing the response from the backend */ -void log_error_response(DCB *dcb, GWBUF *buffer) +static void handle_error_response(DCB *dcb, GWBUF *buffer) { uint8_t *data = (uint8_t*)GWBUF_DATA(buffer); size_t len = MYSQL_GET_PAYLOAD_LEN(data); @@ -354,6 +354,13 @@ void log_error_response(DCB *dcb, GWBUF *buffer) server_set_status(dcb->server, SERVER_MAINT); } + else if (errcode == ER_ACCESS_DENIED_ERROR || + errcode == ER_DBACCESS_DENIED_ERROR || + errcode == ER_ACCESS_DENIED_NO_PASSWORD_ERROR) + { + // Authentication failed, reload users + service_refresh_users(dcb->service); + } } /** @@ -474,7 +481,7 @@ gw_read_backend_event(DCB *dcb) { /** The server responded with an error */ proto->protocol_auth_state = MXS_AUTH_STATE_FAILED; - log_error_response(dcb, readbuf); + handle_error_response(dcb, readbuf); } if (proto->protocol_auth_state == MXS_AUTH_STATE_CONNECTED) @@ -541,15 +548,6 @@ gw_reply_on_error(DCB *dcb, mxs_auth_state_t state) MXS_SESSION *session = dcb->session; CHK_SESSION(session); - /* Only reload the users table if authentication failed and the - * client session is not stopping. It is possible that authentication - * fails because the client has closed the connection before all - * backends have done authentication. */ - if (state == MXS_AUTH_STATE_FAILED && session->state != SESSION_STATE_STOPPING) - { - service_refresh_users(session->service); - } - GWBUF* errbuf = mysql_create_custom_error(1, 0, "Authentication with backend " "failed. Session will be closed."); @@ -809,7 +807,7 @@ gw_read_and_write(DCB *dcb) { /** The COM_CHANGE USER failed, generate a fake hangup event to * close the DCB and send an error to the client. */ - log_error_response(dcb, reply); + handle_error_response(dcb, reply); } else { From 5664cb8bf61455c3c4c559da29e6c003a59e1a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 1 Dec 2017 11:15:05 +0200 Subject: [PATCH 21/46] Fix protocol command tracking The command byte was always read at an offset of 4 instead of the current offset plus 4. --- server/modules/protocol/MySQL/MySQLClient/mysql_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c index 758a18505..2582ad78b 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c @@ -853,11 +853,11 @@ static bool process_client_commands(DCB* dcb, int bytes_available, GWBUF** buffe * If we an empty packet or have at least 5 bytes of data, we can start * sending the data to the router. */ - if (pktlen && gwbuf_copy_data(queue, MYSQL_HEADER_LEN, 1, &cmd) != 1) + if (pktlen && gwbuf_copy_data(queue, offset + MYSQL_HEADER_LEN, 1, &cmd) != 1) { if ((queue = split_and_store(dcb, queue, offset)) == NULL) { - ss_dassert(bytes_available == MYSQL_HEADER_LEN); + ss_dassert(bytes_available - offset == MYSQL_HEADER_LEN); return false; } ss_dassert(offset > 0); From 9addf93a0811d8f1ef64ce90ae17fbf60f6af7bc Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 4 Dec 2017 11:43:14 +0200 Subject: [PATCH 22/46] Update 2.1 version number to 2.1.12 --- VERSION21.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION21.cmake b/VERSION21.cmake index 42ce2974e..e1964f9f7 100644 --- a/VERSION21.cmake +++ b/VERSION21.cmake @@ -5,7 +5,7 @@ set(MAXSCALE_VERSION_MAJOR "2" CACHE STRING "Major version") set(MAXSCALE_VERSION_MINOR "1" CACHE STRING "Minor version") -set(MAXSCALE_VERSION_PATCH "11" CACHE STRING "Patch version") +set(MAXSCALE_VERSION_PATCH "12" CACHE STRING "Patch version") # This should only be incremented if a package is rebuilt set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number") From 74e781a3c396dd925c514bc4d4013e2bdced2600 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 4 Dec 2017 11:50:17 +0200 Subject: [PATCH 23/46] Update 2.1.12 ChangeLog, Upgrading and Release Notes --- Documentation/Changelog.md | 1 + .../Release-Notes/MaxScale-2.1.12-Release-Notes.md | 6 ++++++ Documentation/Upgrading/Upgrading-To-MaxScale-2.1.md | 1 + 3 files changed, 8 insertions(+) diff --git a/Documentation/Changelog.md b/Documentation/Changelog.md index a73a4c261..225128ae3 100644 --- a/Documentation/Changelog.md +++ b/Documentation/Changelog.md @@ -21,6 +21,7 @@ * MaxScale now supports IPv6 For more details, please refer to: +* [MariaDB MaxScale 2.1.12 Release Notes](Release-Notes/MaxScale-2.1.12-Release-Notes.md) * [MariaDB MaxScale 2.1.11 Release Notes](Release-Notes/MaxScale-2.1.11-Release-Notes.md) * [MariaDB MaxScale 2.1.10 Release Notes](Release-Notes/MaxScale-2.1.10-Release-Notes.md) * [MariaDB MaxScale 2.1.9 Release Notes](Release-Notes/MaxScale-2.1.9-Release-Notes.md) diff --git a/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md index 850f3cdc8..4bab84120 100644 --- a/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md @@ -36,6 +36,12 @@ where only parameters are used with the binlogrouter. [Here is a list of bugs fixed in MaxScale 2.1.12.](https://jira.mariadb.org/issues/?jql=project%20%3D%20MXS%20AND%20issuetype%20%3D%20Bug%20AND%20status%20%3D%20Closed%20AND%20fixVersion%20%3D%202.1.12) +* [MXS-1553](https://jira.mariadb.org/browse/MXS-1553) GaleraMon ignores server's SSL configuration +* [MXS-1540](https://jira.mariadb.org/browse/MXS-1540) Race conditions in Galeramon server parameter handling +* [MXS-1536](https://jira.mariadb.org/browse/MXS-1536) Fatal: MaxScale 2.1.10 received fatal signal 11. Attempting backtrace. Commit ID: 96c3f0dda3b5a9640c4995f46ac8efec77686269 System name: Linux Release string: NAME=CentOS Linux +* [MXS-1529](https://jira.mariadb.org/browse/MXS-1529) OOM: mxs_realloc can be repeated this way +* [MXS-1509](https://jira.mariadb.org/browse/MXS-1509) Show correct server state for multisource replication + ## Packaging RPM and Debian packages are provided for the Linux distributions supported by diff --git a/Documentation/Upgrading/Upgrading-To-MaxScale-2.1.md b/Documentation/Upgrading/Upgrading-To-MaxScale-2.1.md index 91ae243db..5c1955a8b 100644 --- a/Documentation/Upgrading/Upgrading-To-MaxScale-2.1.md +++ b/Documentation/Upgrading/Upgrading-To-MaxScale-2.1.md @@ -7,6 +7,7 @@ For more information about MariaDB MaxScale 2.1, please refer to the [ChangeLog](../Changelog.md). For a complete list of changes in MaxScale 2.1, refer to the +* [MaxScale 2.1.12 Release Notes](../Release-Notes/MaxScale-2.1.12-Release-Notes.md) * [MaxScale 2.1.11 Release Notes](../Release-Notes/MaxScale-2.1.11-Release-Notes.md) * [MaxScale 2.1.10 Release Notes](../Release-Notes/MaxScale-2.1.10-Release-Notes.md) * [MaxScale 2.1.9 Release Notes](../Release-Notes/MaxScale-2.1.9-Release-Notes.md). From 277ece53d0bd4c5c5f287f43b16da3084928c67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 4 Dec 2017 10:12:50 +0200 Subject: [PATCH 24/46] Add assertion function to TestConnections The TestConnections::assert behaves much like the normal assert function by simply inverting the check for add_result. --- maxscale-system-test/testconnections.cpp | 36 +++++++++++++++++------- maxscale-system-test/testconnections.h | 8 +++++- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 63972d346..335e6996f 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -322,28 +322,44 @@ TestConnections::~TestConnections() } } -void TestConnections::add_result(int result, const char *format, ...) +void TestConnections::report_result(const char *format, va_list argp) { timeval t2; gettimeofday(&t2, NULL); double elapsedTime = (t2.tv_sec - start_time.tv_sec); elapsedTime += (double) (t2.tv_usec - start_time.tv_usec) / 1000000.0; - if (result != 0) + global_result += 1; + + printf("%04f: TEST_FAILED! ", elapsedTime); + + vprintf(format, argp); + + if (format[strlen(format) - 1] != '\n') { - global_result += result; - - printf("%04f: TEST_FAILED! ", elapsedTime); + printf("\n"); + } +} +void TestConnections::add_result(bool result, const char *format, ...) +{ + if (result) + { va_list argp; va_start(argp, format); - vprintf(format, argp); + report_result(format, argp); va_end(argp); + } +} - if (format[strlen(format) - 1] != '\n') - { - printf("\n"); - } +void TestConnections::assert(bool result, const char *format, ...) +{ + if (!result) + { + va_list argp; + va_start(argp, format); + report_result(format, argp); + va_end(argp); } } diff --git a/maxscale-system-test/testconnections.h b/maxscale-system-test/testconnections.h index 74fc6c519..ed03e87eb 100644 --- a/maxscale-system-test/testconnections.h +++ b/maxscale-system-test/testconnections.h @@ -322,7 +322,10 @@ public: * @param result 0 if step PASSED * @param format ... message to pring if result is not 0 */ - void add_result(int result, const char *format, ...); + void add_result(bool result, const char *format, ...); + + /** Same as add_result() but inverted */ + void assert(bool result, const char *format, ...); /** * @brief ReadEnv Reads all Maxscale and Master/Slave and Galera setups info from environmental variables @@ -716,6 +719,9 @@ public: * @param dest Destination file name for actual configuration file */ void process_template(const char *src, const char *dest = "/etc/maxscale.cnf"); + +private: + void report_result(const char *format, va_list argp); }; /** From c8b6838bcec1697aba2adee27350a6c53273dbaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 4 Dec 2017 13:16:51 +0200 Subject: [PATCH 25/46] MXS-1555: Fix statement tracking for readwritesplit The statement tracking was given the same buffer multiple times when a large packet was spread across multiple buffers when a router with RCAP_TYPE_STMT_INPUT was present. The command tracking packet processing is redundant for routers that require RCAP_TYPE_STMT as the same processing is done later when the buffer is split into packets and routed. By using the split packets, the protocol module can simplify the command tracking by a great deal for most routers. --- .../protocol/MySQL/MySQLClient/mysql_client.c | 79 ++++++++----------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c index 2582ad78b..f735c9a6c 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c @@ -818,51 +818,31 @@ static bool process_client_commands(DCB* dcb, int bytes_available, GWBUF** buffe int pktlen; uint8_t cmd = (uint8_t)MYSQL_COM_QUERY; // Treat empty packets as COM_QUERY - /** - * Buffer has at least 5 bytes, the packet is in contiguous memory - * and it's the first packet in the buffer. - */ - if (offset == 0 && GWBUF_LENGTH(queue) >= MYSQL_HEADER_LEN + 1) + uint8_t packet_header[MYSQL_HEADER_LEN]; + + if (gwbuf_copy_data(queue, offset, MYSQL_HEADER_LEN, packet_header) != MYSQL_HEADER_LEN) { - uint8_t *data = (uint8_t*)GWBUF_DATA(queue); - pktlen = gw_mysql_get_byte3(data); - if (pktlen) - { - cmd = *(data + MYSQL_HEADER_LEN); - } + ss_dassert(offset > 0); + queue = split_and_store(dcb, queue, offset); + break; } + + pktlen = gw_mysql_get_byte3(packet_header); + /** - * We have more than one packet in the buffer or the first 5 bytes - * of a packet are split across two buffers. + * Check if the packet is empty, and if not, if we have the command byte. + * If we an empty packet or have at least 5 bytes of data, we can start + * sending the data to the router. */ - else + if (pktlen && gwbuf_copy_data(queue, offset + MYSQL_HEADER_LEN, 1, &cmd) != 1) { - uint8_t packet_header[MYSQL_HEADER_LEN]; - - if (gwbuf_copy_data(queue, offset, MYSQL_HEADER_LEN, packet_header) != MYSQL_HEADER_LEN) + if ((queue = split_and_store(dcb, queue, offset)) == NULL) { - ss_dassert(offset > 0); - queue = split_and_store(dcb, queue, offset); - break; - } - - pktlen = gw_mysql_get_byte3(packet_header); - - /** - * Check if the packet is empty, and if not, if we have the command byte. - * If we an empty packet or have at least 5 bytes of data, we can start - * sending the data to the router. - */ - if (pktlen && gwbuf_copy_data(queue, offset + MYSQL_HEADER_LEN, 1, &cmd) != 1) - { - if ((queue = split_and_store(dcb, queue, offset)) == NULL) - { - ss_dassert(bytes_available - offset == MYSQL_HEADER_LEN); - return false; - } - ss_dassert(offset > 0); - break; + ss_dassert(bytes_available - offset == MYSQL_HEADER_LEN); + return false; } + ss_dassert(offset > 0); + break; } MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol; @@ -931,14 +911,9 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read) /** Ask what type of input the router/filter chain expects */ capabilities = service_get_capabilities(session->service); - /** Update the current protocol command being executed */ - if (!process_client_commands(dcb, nbytes_read, &read_buffer)) - { - return 0; - } - - /** If the router requires statement input or we are still authenticating - * we need to make sure that a complete SQL packet is read before continuing */ + /** If the router requires statement input we need to make sure that + * a complete SQL packet is read before continuing. The current command + * that is tracked by the protocol module is updated in route_by_statement() */ if (rcap_type_required(capabilities, RCAP_TYPE_STMT_INPUT)) { if (nbytes_read < 3 || nbytes_read < @@ -951,6 +926,11 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read) } gwbuf_set_type(read_buffer, GWBUF_TYPE_MYSQL); } + /** Update the current protocol command being executed */ + else if (!process_client_commands(dcb, nbytes_read, &read_buffer)) + { + return 0; + } /** * Handle COM_SET_OPTION. This seems to be only used by some versions of PHP. @@ -1516,6 +1496,13 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF */ gwbuf_set_type(packetbuf, GWBUF_TYPE_SINGLE_STMT); + /** As we are routing packets, we can extract the command byte here. + * Empty packets are treated as COM_QUERY packets by default. */ + uint8_t cmd = (uint8_t)MYSQL_COM_QUERY; + gwbuf_copy_data(packetbuf, MYSQL_HEADER_LEN, 1, &cmd); + MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol; + proto->current_command = cmd; + if (rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_INPUT)) { if (!GWBUF_IS_CONTIGUOUS(packetbuf)) From f45a011dbe639a48e43f38cd3c6a0f20a9378898 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Tue, 5 Dec 2017 00:30:30 +0200 Subject: [PATCH 26/46] add MDBCI test scripts (#145) --- maxscale-system-test/mdbci/add_core_cnf.sh | 23 ++ .../mdbci/backend/create_repl_user.sql | 4 + .../mdbci/backend/create_skysql_user.sql | 18 ++ .../mdbci/backend/galera/setup_galera.sh | 18 ++ .../mdbci/backend/setup_repl.sh | 61 +++++ .../mdbci/cnf/galera_server1.cnf | 130 ++++++++++ .../mdbci/cnf/galera_server2.cnf | 130 ++++++++++ .../mdbci/cnf/galera_server3.cnf | 130 ++++++++++ .../mdbci/cnf/galera_server4.cnf | 130 ++++++++++ .../mdbci/cnf/mysql56/galera_server1.cnf | 135 +++++++++++ .../mdbci/cnf/mysql56/galera_server2.cnf | 135 +++++++++++ .../mdbci/cnf/mysql56/galera_server3.cnf | 135 +++++++++++ .../mdbci/cnf/mysql56/galera_server4.cnf | 135 +++++++++++ .../mdbci/cnf/mysql56/server1.cnf | 39 +++ .../mdbci/cnf/mysql56/server10.cnf | 36 +++ .../mdbci/cnf/mysql56/server11.cnf | 36 +++ .../mdbci/cnf/mysql56/server12.cnf | 36 +++ .../mdbci/cnf/mysql56/server13.cnf | 36 +++ .../mdbci/cnf/mysql56/server14.cnf | 36 +++ .../mdbci/cnf/mysql56/server15.cnf | 36 +++ .../mdbci/cnf/mysql56/server2.cnf | 39 +++ .../mdbci/cnf/mysql56/server3.cnf | 39 +++ .../mdbci/cnf/mysql56/server4.cnf | 39 +++ .../mdbci/cnf/mysql56/server5.cnf | 36 +++ .../mdbci/cnf/mysql56/server6.cnf | 36 +++ .../mdbci/cnf/mysql56/server7.cnf | 36 +++ .../mdbci/cnf/mysql56/server8.cnf | 36 +++ .../mdbci/cnf/mysql56/server9.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server1.cnf | 39 +++ maxscale-system-test/mdbci/cnf/server10.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server11.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server12.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server13.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server14.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server15.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server2.cnf | 39 +++ maxscale-system-test/mdbci/cnf/server3.cnf | 39 +++ maxscale-system-test/mdbci/cnf/server4.cnf | 39 +++ maxscale-system-test/mdbci/cnf/server5.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server6.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server7.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server8.cnf | 36 +++ maxscale-system-test/mdbci/cnf/server9.cnf | 36 +++ .../mdbci/configure_backend.sh | 9 + maxscale-system-test/mdbci/configure_core.sh | 11 + .../mdbci/configure_log_dir.sh | 15 ++ maxscale-system-test/mdbci/copy_logs.sh | 5 + maxscale-system-test/mdbci/create_config.sh | 59 +++++ maxscale-system-test/mdbci/destroy.sh | 10 + maxscale-system-test/mdbci/revert_snapshot.sh | 5 + maxscale-system-test/mdbci/run_test.sh | 103 ++++++++ .../mdbci/run_test_snapshot.sh | 91 +++++++ maxscale-system-test/mdbci/set_env.sh | 97 ++++++++ .../mdbci/set_run_test_variables.sh | 32 +++ maxscale-system-test/mdbci/take_snapshot.sh | 5 + .../mdbci/templates/big.json.template | 152 ++++++++++++ .../mdbci/templates/big15.json.template | 229 ++++++++++++++++++ .../mdbci/templates/default.json.template | 117 +++++++++ .../mdbci/templates/performance.json.template | 67 +++++ 59 files changed, 3295 insertions(+) create mode 100755 maxscale-system-test/mdbci/add_core_cnf.sh create mode 100644 maxscale-system-test/mdbci/backend/create_repl_user.sql create mode 100644 maxscale-system-test/mdbci/backend/create_skysql_user.sql create mode 100755 maxscale-system-test/mdbci/backend/galera/setup_galera.sh create mode 100755 maxscale-system-test/mdbci/backend/setup_repl.sh create mode 100644 maxscale-system-test/mdbci/cnf/galera_server1.cnf create mode 100644 maxscale-system-test/mdbci/cnf/galera_server2.cnf create mode 100644 maxscale-system-test/mdbci/cnf/galera_server3.cnf create mode 100644 maxscale-system-test/mdbci/cnf/galera_server4.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/galera_server1.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/galera_server2.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/galera_server3.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/galera_server4.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server1.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server10.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server11.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server12.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server13.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server14.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server15.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server2.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server3.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server4.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server5.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server6.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server7.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server8.cnf create mode 100644 maxscale-system-test/mdbci/cnf/mysql56/server9.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server1.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server10.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server11.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server12.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server13.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server14.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server15.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server2.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server3.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server4.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server5.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server6.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server7.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server8.cnf create mode 100644 maxscale-system-test/mdbci/cnf/server9.cnf create mode 100644 maxscale-system-test/mdbci/configure_backend.sh create mode 100755 maxscale-system-test/mdbci/configure_core.sh create mode 100644 maxscale-system-test/mdbci/configure_log_dir.sh create mode 100755 maxscale-system-test/mdbci/copy_logs.sh create mode 100755 maxscale-system-test/mdbci/create_config.sh create mode 100755 maxscale-system-test/mdbci/destroy.sh create mode 100755 maxscale-system-test/mdbci/revert_snapshot.sh create mode 100755 maxscale-system-test/mdbci/run_test.sh create mode 100755 maxscale-system-test/mdbci/run_test_snapshot.sh create mode 100644 maxscale-system-test/mdbci/set_env.sh create mode 100644 maxscale-system-test/mdbci/set_run_test_variables.sh create mode 100755 maxscale-system-test/mdbci/take_snapshot.sh create mode 100644 maxscale-system-test/mdbci/templates/big.json.template create mode 100644 maxscale-system-test/mdbci/templates/big15.json.template create mode 100644 maxscale-system-test/mdbci/templates/default.json.template create mode 100644 maxscale-system-test/mdbci/templates/performance.json.template diff --git a/maxscale-system-test/mdbci/add_core_cnf.sh b/maxscale-system-test/mdbci/add_core_cnf.sh new file mode 100755 index 000000000..aa5db1828 --- /dev/null +++ b/maxscale-system-test/mdbci/add_core_cnf.sh @@ -0,0 +1,23 @@ +set -x +chmod 777 /tmp/ +echo 2 > /proc/sys/fs/suid_dumpable +sed -i "s/start() {/start() { \n export DAEMON_COREFILE_LIMIT='unlimited'; ulimit -c unlimited; /" /etc/init.d/maxscale +sed -i "s/log_daemon_msg \"Starting MaxScale\"/export DAEMON_COREFILE_LIMIT='unlimited'; ulimit -c unlimited; log_daemon_msg \"Starting MaxScale\" /" /etc/init.d/maxscale +echo /tmp/core-%e-%s-%u-%g-%p-%t > /proc/sys/kernel/core_pattern + +echo "kernel.core_pattern = /tmp/core-%e-sig%s-user%u-group%g-pid%p-time%t" >> /etc/sysctl.d/core.conf +echo "kernel.core_uses_pid = 1" >> /etc/sysctl.d/core.conf +echo "fs.suid_dumpable = 2" >> /etc/sysctl.d/core.conf + +echo "DefaultLimitCORE=infinity" >> /etc/systemd/system.conf + +echo "* hard core unlimited" >> /etc/security/limits.d/core.conf +echo "* soft core unlimited" >> /etc/security/limits.d/core.conf +echo "* soft nofile 65536" >> /etc/security/limits.d/core.conf +echo "* hard nofile 65536" >> /etc/security/limits.d/core.conf + + +echo "fs.file-max = 65536" >> /etc/sysctl.conf + +systemctl daemon-reexec +sysctl -p diff --git a/maxscale-system-test/mdbci/backend/create_repl_user.sql b/maxscale-system-test/mdbci/backend/create_repl_user.sql new file mode 100644 index 000000000..98431e94e --- /dev/null +++ b/maxscale-system-test/mdbci/backend/create_repl_user.sql @@ -0,0 +1,4 @@ +#create user repl@'%' identified by 'repl'; +grant replication slave on *.* to repl@'%' identified by 'repl'; + +FLUSH PRIVILEGES; diff --git a/maxscale-system-test/mdbci/backend/create_skysql_user.sql b/maxscale-system-test/mdbci/backend/create_skysql_user.sql new file mode 100644 index 000000000..668190d4f --- /dev/null +++ b/maxscale-system-test/mdbci/backend/create_skysql_user.sql @@ -0,0 +1,18 @@ +create user skysql@'%' identified by 'skysql'; +create user skysql@'localhost' identified by 'skysql'; +GRANT ALL PRIVILEGES ON *.* TO skysql@'%' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON *.* TO skysql@'localhost' WITH GRANT OPTION; + +create user maxuser@'%' identified by 'maxpwd'; +create user maxuser@'localhost' identified by 'maxpwd'; +GRANT ALL PRIVILEGES ON *.* TO maxuser@'%' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON *.* TO maxuser@'localhost' WITH GRANT OPTION; + +create user maxskysql@'%' identified by 'skysql'; +create user maxskysql@'localhost' identified by 'skysql'; +GRANT ALL PRIVILEGES ON *.* TO maxskysql@'%' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON *.* TO maxskysql@'localhost' WITH GRANT OPTION; + + +FLUSH PRIVILEGES; +CREATE DATABASE IF NOT EXISTS test; diff --git a/maxscale-system-test/mdbci/backend/galera/setup_galera.sh b/maxscale-system-test/mdbci/backend/galera/setup_galera.sh new file mode 100755 index 000000000..c7e2e182d --- /dev/null +++ b/maxscale-system-test/mdbci/backend/galera/setup_galera.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +N=$galera_N + +x=`expr $N - 1` +for i in $(seq 0 $x) +do + num=`printf "%03d" $i` + sshkey_var=galera_"$num"_keyfile + user_var=galera_"$num"_whoami + IP_var=galera_"$num"_network + + sshkey=${!sshkey_var} + user=${!user_var} + IP=${!IP_var} + + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo mysql_install_db; sudo chown -R mysql:mysql /var/lib/mysql" +done diff --git a/maxscale-system-test/mdbci/backend/setup_repl.sh b/maxscale-system-test/mdbci/backend/setup_repl.sh new file mode 100755 index 000000000..ffa2f2251 --- /dev/null +++ b/maxscale-system-test/mdbci/backend/setup_repl.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +set -x + +x=`expr $node_N - 1` +for i in $(seq 0 $x) +do + num=`printf "%03d" $i` + sshkey_var=node_"$num"_keyfile + user_var=node_"$num"_whoami + IP_var=node_"$num"_network + start_cmd_var=node_"$num"_start_db_command + stop_cmd_var=node_"$num"_stop_db_command + + sshkey=${!sshkey_var} + user=${!user_var} + IP=${!IP_var} + start_cmd=${!start_cmd_var} + stop_cmd=${!stop_cmd_var} + + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo $stop_cmd" + sleep 5 + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP 'sudo sed -i "s/bind-address/#bind-address/g" /etc/mysql/my.cnf' + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP 'sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/usr.sbin.mysqld; sudo service apparmor restart' + + mysql_version=`ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP 'mysql --version'` + echo $mysql_version | grep "5\." + if [ $? == 0 ] ; then + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo sed -i \"s/binlog_row_image=full//\" /etc/my.cnf.d/*.cnf" + fi + + echo $mysql_version | grep "5\.7" + if [ $? == 0 ] ; then +# ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo sed -i \"s/## x001/validate-password=OFF/\" /etc/my.cnf.d/*.cnf" + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo mysqld --initialize; sudo chown -R mysql:mysql /var/lib/mysql" + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo $start_cmd" + + mysql_root_password=`ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo cat /var/log/mysqld.log | grep \"temporary password\" | sed -n -e 's/^.*: //p'"` + + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo mysqladmin -uroot -p'$mysql_root_password' password '$mysql_root_password'" + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "echo \"UNINSTALL PLUGIN validate_password\" | sudo mysql -uroot -p'$mysql_root_password' " + + + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo $stop_cmd" +# ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo sed -i \"s/## x001/validate-password=OFF/\" /etc/my.cnf.d/*.cnf" + + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo $start_cmd" + +# mysql_root_password=`ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo cat /var/log/mysqld.log | grep \"temporary password\" | sed -n -e 's/^.*: //p'"` + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "echo \"show plugins\" | sudo mysql -uroot -p'$mysql_root_password' " + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo mysqladmin -uroot -p'$mysql_root_password' password ''" +# ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo $start_cmd" + else + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo mysql_install_db; sudo chown -R mysql:mysql /var/lib/mysql" + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo $start_cmd" + fi + sleep 15 + scp -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${script_dir}/create_*_user.sql $user@$IP://home/$user/ + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo mysql < /home/$user/create_repl_user.sql" + ssh -i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$IP "sudo mysql < /home/$user/create_skysql_user.sql" +done diff --git a/maxscale-system-test/mdbci/cnf/galera_server1.cnf b/maxscale-system-test/mdbci/cnf/galera_server1.cnf new file mode 100644 index 000000000..03b37157b --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/galera_server1.cnf @@ -0,0 +1,130 @@ +[mysqld] +expire_logs_days=7 +user=mysql +server_id=1 +wsrep_on=ON + +# Row binary log format is required by Galera +binlog_format=ROW + +log-bin + +# InnoDB is currently the only storage engine supported by Galera +default-storage-engine=innodb +innodb_file_per_table + +# To avoid issues with 'bulk mode inserts' using autoincrement fields +innodb_autoinc_lock_mode=2 + +# Required to prevent deadlocks on parallel transaction execution +innodb_locks_unsafe_for_binlog=1 + +# Query Cache is not supported by Galera wsrep replication +query_cache_size=0 +query_cache_type=0 + +# INITIAL SETUP +# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST +# it will have (most likely) disastrous consequences on donor node +bind-address=###NODE-ADDRESS### + +## +## WSREP options +## + +# INITIAL SETUP +# For the initial setup, wsrep should be disabled +wsrep_provider=none +# After initial setup, parameter should have full path to wsrep provider library +wsrep_provider=###GALERA-LIB-PATH### + +# Provider specific configuration options +wsrep_provider_options = "evs.keepalive_period = PT3S; evs.inactive_check_period = PT10S; evs.suspect_timeout = PT30S; evs.inactive_timeout = PT1M; evs.install_timeout = PT1M" + +# Logical cluster name. Should be the same for all nodes in the same cluster. +wsrep_cluster_name=skycluster + +# INITIAL SETUP +# Group communication system handle: for the first node to be launched, the value should be "gcomm://", indicating creation of a new cluster; +# for the other nodes joining the cluster, the value should be "gcomm://xxx.xxx.xxx.xxx:4567", where xxx.xxx.xxx.xxx should be the ip of a node +# already on the cluster (usually the first one) +# DEPRECATED +# wsrep_cluster_address=gcomm:// + +# Human-readable node name (non-unique). Hostname by default. +#wsrep_node_name=###NODE-NAME### +wsrep_node_name=galera000 + +# INITIAL SETUP +# Base replication [:port] of the node. +# The values supplied will be used as defaults for state transfer receiving, +# listening ports and so on. Default: address of the first network interface. +wsrep_node_address=###NODE-ADDRESS### + +# INITIAL SETUP +# Address for incoming client connections. Autodetect by default. +wsrep_node_incoming_address=###NODE-ADDRESS### + +# Number of threads that will process writesets from other nodes +wsrep_slave_threads=1 + +# Generate fake primary keys for non-PK tables (required for multi-master +# and parallel applying operation) +wsrep_certify_nonPK=1 + +# Debug level logging (1 = enabled) +wsrep_debug=1 + +# Convert locking sessions into transactions +wsrep_convert_LOCK_to_trx=0 + +# Number of retries for deadlocked autocommits +wsrep_retry_autocommit=1 + +# Change auto_increment_increment and auto_increment_offset automatically +wsrep_auto_increment_control=1 + +# Retry autoinc insert, when the insert failed for "duplicate key error" +wsrep_drupal_282555_workaround=0 + +# Enable "strictly synchronous" semantics for read operations +wsrep_causal_reads=1 + +# Command to call when node status or cluster membership changes. +# Will be passed all or some of the following options: +# --status - new status of this node +# --uuid - UUID of the cluster +# --primary - whether the component is primary or not ("yes"/"no") +# --members - comma-separated list of members +# --index - index of this node in the list +wsrep_notify_cmd= + +## +## WSREP State Transfer options +## + +# State Snapshot Transfer method +#wsrep_sst_method=mysqldump +#wsrep_sst_method=xtrabackup +wsrep_sst_method=rsync + +# INITIAL SETUP +# Address which donor should send State Snapshot to. +# Should be the address of the CURRENT node. DON'T SET IT TO DONOR ADDRESS!!! +# (SST method dependent. Defaults to the first IP of the first interface) +wsrep_sst_receive_address=###NODE-ADDRESS### + +# INITIAL SETUP +# SST authentication string. This will be used to send SST to joining nodes. +# Depends on SST method. For mysqldump method it is root: +#wsrep_sst_auth=###REP-USERNAME###:###REP-PASSWORD### +wsrep_sst_auth=repl:repl + +# Desired SST donor name. +#wsrep_sst_donor= + +# Reject client queries when donating SST (false) +#wsrep_sst_donor_rejects_queries=0 + +# Protocol version to use +# wsrep_protocol_version= diff --git a/maxscale-system-test/mdbci/cnf/galera_server2.cnf b/maxscale-system-test/mdbci/cnf/galera_server2.cnf new file mode 100644 index 000000000..79454a443 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/galera_server2.cnf @@ -0,0 +1,130 @@ +[mysqld] +expire_logs_days=7 +user=mysql +server_id=2 +wsrep_on=ON + +# Row binary log format is required by Galera +binlog_format=ROW + +log-bin + +# InnoDB is currently the only storage engine supported by Galera +default-storage-engine=innodb +innodb_file_per_table + +# To avoid issues with 'bulk mode inserts' using autoincrement fields +innodb_autoinc_lock_mode=2 + +# Required to prevent deadlocks on parallel transaction execution +innodb_locks_unsafe_for_binlog=1 + +# Query Cache is not supported by Galera wsrep replication +query_cache_size=0 +query_cache_type=0 + +# INITIAL SETUP +# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST +# it will have (most likely) disastrous consequences on donor node +bind-address=###NODE-ADDRESS### + +## +## WSREP options +## + +# INITIAL SETUP +# For the initial setup, wsrep should be disabled +wsrep_provider=none +# After initial setup, parameter should have full path to wsrep provider library +wsrep_provider=###GALERA-LIB-PATH### + +# Provider specific configuration options +wsrep_provider_options = "evs.keepalive_period = PT3S; evs.inactive_check_period = PT10S; evs.suspect_timeout = PT30S; evs.inactive_timeout = PT1M; evs.install_timeout = PT1M" + +# Logical cluster name. Should be the same for all nodes in the same cluster. +wsrep_cluster_name=skycluster + +# INITIAL SETUP +# Group communication system handle: for the first node to be launched, the value should be "gcomm://", indicating creation of a new cluster; +# for the other nodes joining the cluster, the value should be "gcomm://xxx.xxx.xxx.xxx:4567", where xxx.xxx.xxx.xxx should be the ip of a node +# already on the cluster (usually the first one) +# DEPRECATED +# wsrep_cluster_address=gcomm:// + +# Human-readable node name (non-unique). Hostname by default. +#wsrep_node_name=###NODE-NAME### +wsrep_node_name=galera001 + +# INITIAL SETUP +# Base replication [:port] of the node. +# The values supplied will be used as defaults for state transfer receiving, +# listening ports and so on. Default: address of the first network interface. +wsrep_node_address=###NODE-ADDRESS### + +# INITIAL SETUP +# Address for incoming client connections. Autodetect by default. +wsrep_node_incoming_address=###NODE-ADDRESS### + +# Number of threads that will process writesets from other nodes +wsrep_slave_threads=1 + +# Generate fake primary keys for non-PK tables (required for multi-master +# and parallel applying operation) +wsrep_certify_nonPK=1 + +# Debug level logging (1 = enabled) +wsrep_debug=1 + +# Convert locking sessions into transactions +wsrep_convert_LOCK_to_trx=0 + +# Number of retries for deadlocked autocommits +wsrep_retry_autocommit=1 + +# Change auto_increment_increment and auto_increment_offset automatically +wsrep_auto_increment_control=1 + +# Retry autoinc insert, when the insert failed for "duplicate key error" +wsrep_drupal_282555_workaround=0 + +# Enable "strictly synchronous" semantics for read operations +wsrep_causal_reads=1 + +# Command to call when node status or cluster membership changes. +# Will be passed all or some of the following options: +# --status - new status of this node +# --uuid - UUID of the cluster +# --primary - whether the component is primary or not ("yes"/"no") +# --members - comma-separated list of members +# --index - index of this node in the list +wsrep_notify_cmd= + +## +## WSREP State Transfer options +## + +# State Snapshot Transfer method +#wsrep_sst_method=mysqldump +#wsrep_sst_method=xtrabackup +wsrep_sst_method=rsync + +# INITIAL SETUP +# Address which donor should send State Snapshot to. +# Should be the address of the CURRENT node. DON'T SET IT TO DONOR ADDRESS!!! +# (SST method dependent. Defaults to the first IP of the first interface) +wsrep_sst_receive_address=###NODE-ADDRESS### + +# INITIAL SETUP +# SST authentication string. This will be used to send SST to joining nodes. +# Depends on SST method. For mysqldump method it is root: +#wsrep_sst_auth=###REP-USERNAME###:###REP-PASSWORD### +wsrep_sst_auth=repl:repl + +# Desired SST donor name. +#wsrep_sst_donor= + +# Reject client queries when donating SST (false) +#wsrep_sst_donor_rejects_queries=0 + +# Protocol version to use +# wsrep_protocol_version= diff --git a/maxscale-system-test/mdbci/cnf/galera_server3.cnf b/maxscale-system-test/mdbci/cnf/galera_server3.cnf new file mode 100644 index 000000000..9f77a5687 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/galera_server3.cnf @@ -0,0 +1,130 @@ +[mysqld] +expire_logs_days=7 +user=mysql +server_id=3 +wsrep_on=ON + +# Row binary log format is required by Galera +binlog_format=ROW + +log-bin + +# InnoDB is currently the only storage engine supported by Galera +default-storage-engine=innodb +innodb_file_per_table + +# To avoid issues with 'bulk mode inserts' using autoincrement fields +innodb_autoinc_lock_mode=2 + +# Required to prevent deadlocks on parallel transaction execution +innodb_locks_unsafe_for_binlog=1 + +# Query Cache is not supported by Galera wsrep replication +query_cache_size=0 +query_cache_type=0 + +# INITIAL SETUP +# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST +# it will have (most likely) disastrous consequences on donor node +bind-address=###NODE-ADDRESS### + +## +## WSREP options +## + +# INITIAL SETUP +# For the initial setup, wsrep should be disabled +wsrep_provider=none +# After initial setup, parameter should have full path to wsrep provider library +wsrep_provider=###GALERA-LIB-PATH### + +# Provider specific configuration options +wsrep_provider_options = "evs.keepalive_period = PT3S; evs.inactive_check_period = PT10S; evs.suspect_timeout = PT30S; evs.inactive_timeout = PT1M; evs.install_timeout = PT1M" + +# Logical cluster name. Should be the same for all nodes in the same cluster. +wsrep_cluster_name=skycluster + +# INITIAL SETUP +# Group communication system handle: for the first node to be launched, the value should be "gcomm://", indicating creation of a new cluster; +# for the other nodes joining the cluster, the value should be "gcomm://xxx.xxx.xxx.xxx:4567", where xxx.xxx.xxx.xxx should be the ip of a node +# already on the cluster (usually the first one) +# DEPRECATED +# wsrep_cluster_address=gcomm:// + +# Human-readable node name (non-unique). Hostname by default. +#wsrep_node_name=###NODE-NAME### +wsrep_node_name=galera002 + +# INITIAL SETUP +# Base replication [:port] of the node. +# The values supplied will be used as defaults for state transfer receiving, +# listening ports and so on. Default: address of the first network interface. +wsrep_node_address=###NODE-ADDRESS### + +# INITIAL SETUP +# Address for incoming client connections. Autodetect by default. +wsrep_node_incoming_address=###NODE-ADDRESS### + +# Number of threads that will process writesets from other nodes +wsrep_slave_threads=1 + +# Generate fake primary keys for non-PK tables (required for multi-master +# and parallel applying operation) +wsrep_certify_nonPK=1 + +# Debug level logging (1 = enabled) +wsrep_debug=1 + +# Convert locking sessions into transactions +wsrep_convert_LOCK_to_trx=0 + +# Number of retries for deadlocked autocommits +wsrep_retry_autocommit=1 + +# Change auto_increment_increment and auto_increment_offset automatically +wsrep_auto_increment_control=1 + +# Retry autoinc insert, when the insert failed for "duplicate key error" +wsrep_drupal_282555_workaround=0 + +# Enable "strictly synchronous" semantics for read operations +wsrep_causal_reads=1 + +# Command to call when node status or cluster membership changes. +# Will be passed all or some of the following options: +# --status - new status of this node +# --uuid - UUID of the cluster +# --primary - whether the component is primary or not ("yes"/"no") +# --members - comma-separated list of members +# --index - index of this node in the list +wsrep_notify_cmd= + +## +## WSREP State Transfer options +## + +# State Snapshot Transfer method +#wsrep_sst_method=mysqldump +#wsrep_sst_method=xtrabackup +wsrep_sst_method=rsync + +# INITIAL SETUP +# Address which donor should send State Snapshot to. +# Should be the address of the CURRENT node. DON'T SET IT TO DONOR ADDRESS!!! +# (SST method dependent. Defaults to the first IP of the first interface) +wsrep_sst_receive_address=###NODE-ADDRESS### + +# INITIAL SETUP +# SST authentication string. This will be used to send SST to joining nodes. +# Depends on SST method. For mysqldump method it is root: +#wsrep_sst_auth=###REP-USERNAME###:###REP-PASSWORD### +wsrep_sst_auth=repl:repl + +# Desired SST donor name. +#wsrep_sst_donor= + +# Reject client queries when donating SST (false) +#wsrep_sst_donor_rejects_queries=0 + +# Protocol version to use +# wsrep_protocol_version= diff --git a/maxscale-system-test/mdbci/cnf/galera_server4.cnf b/maxscale-system-test/mdbci/cnf/galera_server4.cnf new file mode 100644 index 000000000..a589a690e --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/galera_server4.cnf @@ -0,0 +1,130 @@ +[mysqld] +expire_logs_days=7 +user=mysql +server_id=4 +wsrep_on=ON + +# Row binary log format is required by Galera +binlog_format=ROW + +log-bin + +# InnoDB is currently the only storage engine supported by Galera +default-storage-engine=innodb +innodb_file_per_table + +# To avoid issues with 'bulk mode inserts' using autoincrement fields +innodb_autoinc_lock_mode=2 + +# Required to prevent deadlocks on parallel transaction execution +innodb_locks_unsafe_for_binlog=1 + +# Query Cache is not supported by Galera wsrep replication +query_cache_size=0 +query_cache_type=0 + +# INITIAL SETUP +# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST +# it will have (most likely) disastrous consequences on donor node +bind-address=###NODE-ADDRESS### + +## +## WSREP options +## + +# INITIAL SETUP +# For the initial setup, wsrep should be disabled +wsrep_provider=none +# After initial setup, parameter should have full path to wsrep provider library +wsrep_provider=###GALERA-LIB-PATH### + +# Provider specific configuration options +wsrep_provider_options = "evs.keepalive_period = PT3S; evs.inactive_check_period = PT10S; evs.suspect_timeout = PT30S; evs.inactive_timeout = PT1M; evs.install_timeout = PT1M" + +# Logical cluster name. Should be the same for all nodes in the same cluster. +wsrep_cluster_name=skycluster + +# INITIAL SETUP +# Group communication system handle: for the first node to be launched, the value should be "gcomm://", indicating creation of a new cluster; +# for the other nodes joining the cluster, the value should be "gcomm://xxx.xxx.xxx.xxx:4567", where xxx.xxx.xxx.xxx should be the ip of a node +# already on the cluster (usually the first one) +# DEPRECATED +# wsrep_cluster_address=gcomm:// + +# Human-readable node name (non-unique). Hostname by default. +#wsrep_node_name=###NODE-NAME### +wsrep_node_name=galera003 + +# INITIAL SETUP +# Base replication [:port] of the node. +# The values supplied will be used as defaults for state transfer receiving, +# listening ports and so on. Default: address of the first network interface. +wsrep_node_address=###NODE-ADDRESS### + +# INITIAL SETUP +# Address for incoming client connections. Autodetect by default. +wsrep_node_incoming_address=###NODE-ADDRESS### + +# Number of threads that will process writesets from other nodes +wsrep_slave_threads=1 + +# Generate fake primary keys for non-PK tables (required for multi-master +# and parallel applying operation) +wsrep_certify_nonPK=1 + +# Debug level logging (1 = enabled) +wsrep_debug=1 + +# Convert locking sessions into transactions +wsrep_convert_LOCK_to_trx=0 + +# Number of retries for deadlocked autocommits +wsrep_retry_autocommit=1 + +# Change auto_increment_increment and auto_increment_offset automatically +wsrep_auto_increment_control=1 + +# Retry autoinc insert, when the insert failed for "duplicate key error" +wsrep_drupal_282555_workaround=0 + +# Enable "strictly synchronous" semantics for read operations +wsrep_causal_reads=1 + +# Command to call when node status or cluster membership changes. +# Will be passed all or some of the following options: +# --status - new status of this node +# --uuid - UUID of the cluster +# --primary - whether the component is primary or not ("yes"/"no") +# --members - comma-separated list of members +# --index - index of this node in the list +wsrep_notify_cmd= + +## +## WSREP State Transfer options +## + +# State Snapshot Transfer method +#wsrep_sst_method=mysqldump +#wsrep_sst_method=xtrabackup +wsrep_sst_method=rsync + +# INITIAL SETUP +# Address which donor should send State Snapshot to. +# Should be the address of the CURRENT node. DON'T SET IT TO DONOR ADDRESS!!! +# (SST method dependent. Defaults to the first IP of the first interface) +wsrep_sst_receive_address=###NODE-ADDRESS### + +# INITIAL SETUP +# SST authentication string. This will be used to send SST to joining nodes. +# Depends on SST method. For mysqldump method it is root: +#wsrep_sst_auth=###REP-USERNAME###:###REP-PASSWORD### +wsrep_sst_auth=repl:repl + +# Desired SST donor name. +#wsrep_sst_donor= + +# Reject client queries when donating SST (false) +#wsrep_sst_donor_rejects_queries=0 + +# Protocol version to use +# wsrep_protocol_version= diff --git a/maxscale-system-test/mdbci/cnf/mysql56/galera_server1.cnf b/maxscale-system-test/mdbci/cnf/mysql56/galera_server1.cnf new file mode 100644 index 000000000..0e646cb3b --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/galera_server1.cnf @@ -0,0 +1,135 @@ +[mysqld] +expire_logs_days=7 +user=mysql +server_id=1 + +# Row binary log format is required by Galera +binlog_format=ROW + +log-bin + +# InnoDB is currently the only storage engine supported by Galera +default-storage-engine=innodb +innodb_file_per_table + +# To avoid issues with 'bulk mode inserts' using autoincrement fields +innodb_autoinc_lock_mode=2 + +# Required to prevent deadlocks on parallel transaction execution +innodb_locks_unsafe_for_binlog=1 + +# Query Cache is not supported by Galera wsrep replication +query_cache_size=0 +query_cache_type=0 + +# INITIAL SETUP +# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST +# it will have (most likely) disastrous consequences on donor node +bind-address=###NODE-ADDRESS### + +## +## WSREP options +## + +# INITIAL SETUP +# For the initial setup, wsrep should be disabled +wsrep_provider=none +# After initial setup, parameter should have full path to wsrep provider library +wsrep_provider=###GALERA-LIB-PATH### + +# Provider specific configuration options +wsrep_provider_options = "evs.keepalive_period = PT3S; evs.inactive_check_period = PT10S; evs.suspect_timeout = PT30S; evs.inactive_timeout = PT1M; evs.install_timeout = PT1M" + +# Logical cluster name. Should be the same for all nodes in the same cluster. +wsrep_cluster_name=skycluster + +# INITIAL SETUP +# Group communication system handle: for the first node to be launched, the value should be "gcomm://", indicating creation of a new cluster; +# for the other nodes joining the cluster, the value should be "gcomm://xxx.xxx.xxx.xxx:4567", where xxx.xxx.xxx.xxx should be the ip of a node +# already on the cluster (usually the first one) +# DEPRECATED +# wsrep_cluster_address=gcomm:// + +# Human-readable node name (non-unique). Hostname by default. +#wsrep_node_name=###NODE-NAME### +wsrep_node_name=galera000 + +# INITIAL SETUP +# Base replication [:port] of the node. +# The values supplied will be used as defaults for state transfer receiving, +# listening ports and so on. Default: address of the first network interface. +wsrep_node_address=###NODE-ADDRESS### + +# INITIAL SETUP +# Address for incoming client connections. Autodetect by default. +wsrep_node_incoming_address=###NODE-ADDRESS### + +# Number of threads that will process writesets from other nodes +wsrep_slave_threads=1 + +# Generate fake primary keys for non-PK tables (required for multi-master +# and parallel applying operation) +wsrep_certify_nonPK=1 + +# Maximum number of rows in write set +wsrep_max_ws_rows=131072 + +# Maximum size of write set +wsrep_max_ws_size=1073741824 + +# Debug level logging (1 = enabled) +wsrep_debug=1 + +# Convert locking sessions into transactions +wsrep_convert_LOCK_to_trx=0 + +# Number of retries for deadlocked autocommits +wsrep_retry_autocommit=1 + +# Change auto_increment_increment and auto_increment_offset automatically +wsrep_auto_increment_control=1 + +# Retry autoinc insert, when the insert failed for "duplicate key error" +wsrep_drupal_282555_workaround=0 + +# Enable "strictly synchronous" semantics for read operations +wsrep_causal_reads=0 + +# Command to call when node status or cluster membership changes. +# Will be passed all or some of the following options: +# --status - new status of this node +# --uuid - UUID of the cluster +# --primary - whether the component is primary or not ("yes"/"no") +# --members - comma-separated list of members +# --index - index of this node in the list +wsrep_notify_cmd= + +## +## WSREP State Transfer options +## + +# State Snapshot Transfer method +#wsrep_sst_method=mysqldump +#wsrep_sst_method=xtrabackup +wsrep_sst_method=rsync + +# INITIAL SETUP +# Address which donor should send State Snapshot to. +# Should be the address of the CURRENT node. DON'T SET IT TO DONOR ADDRESS!!! +# (SST method dependent. Defaults to the first IP of the first interface) +wsrep_sst_receive_address=###NODE-ADDRESS### + +# INITIAL SETUP +# SST authentication string. This will be used to send SST to joining nodes. +# Depends on SST method. For mysqldump method it is root: +#wsrep_sst_auth=###REP-USERNAME###:###REP-PASSWORD### +wsrep_sst_auth=repl:repl + +# Desired SST donor name. +#wsrep_sst_donor= + +# Reject client queries when donating SST (false) +#wsrep_sst_donor_rejects_queries=0 + +# Protocol version to use +# wsrep_protocol_version= diff --git a/maxscale-system-test/mdbci/cnf/mysql56/galera_server2.cnf b/maxscale-system-test/mdbci/cnf/mysql56/galera_server2.cnf new file mode 100644 index 000000000..c459d80ad --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/galera_server2.cnf @@ -0,0 +1,135 @@ +[mysqld] +expire_logs_days=7 +user=mysql +server_id=2 + +# Row binary log format is required by Galera +binlog_format=ROW + +log-bin + +# InnoDB is currently the only storage engine supported by Galera +default-storage-engine=innodb +innodb_file_per_table + +# To avoid issues with 'bulk mode inserts' using autoincrement fields +innodb_autoinc_lock_mode=2 + +# Required to prevent deadlocks on parallel transaction execution +innodb_locks_unsafe_for_binlog=1 + +# Query Cache is not supported by Galera wsrep replication +query_cache_size=0 +query_cache_type=0 + +# INITIAL SETUP +# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST +# it will have (most likely) disastrous consequences on donor node +bind-address=###NODE-ADDRESS### + +## +## WSREP options +## + +# INITIAL SETUP +# For the initial setup, wsrep should be disabled +wsrep_provider=none +# After initial setup, parameter should have full path to wsrep provider library +wsrep_provider=###GALERA-LIB-PATH### + +# Provider specific configuration options +wsrep_provider_options = "evs.keepalive_period = PT3S; evs.inactive_check_period = PT10S; evs.suspect_timeout = PT30S; evs.inactive_timeout = PT1M; evs.install_timeout = PT1M" + +# Logical cluster name. Should be the same for all nodes in the same cluster. +wsrep_cluster_name=skycluster + +# INITIAL SETUP +# Group communication system handle: for the first node to be launched, the value should be "gcomm://", indicating creation of a new cluster; +# for the other nodes joining the cluster, the value should be "gcomm://xxx.xxx.xxx.xxx:4567", where xxx.xxx.xxx.xxx should be the ip of a node +# already on the cluster (usually the first one) +# DEPRECATED +# wsrep_cluster_address=gcomm:// + +# Human-readable node name (non-unique). Hostname by default. +#wsrep_node_name=###NODE-NAME### +wsrep_node_name=galera001 + +# INITIAL SETUP +# Base replication [:port] of the node. +# The values supplied will be used as defaults for state transfer receiving, +# listening ports and so on. Default: address of the first network interface. +wsrep_node_address=###NODE-ADDRESS### + +# INITIAL SETUP +# Address for incoming client connections. Autodetect by default. +wsrep_node_incoming_address=###NODE-ADDRESS### + +# Number of threads that will process writesets from other nodes +wsrep_slave_threads=1 + +# Generate fake primary keys for non-PK tables (required for multi-master +# and parallel applying operation) +wsrep_certify_nonPK=1 + +# Maximum number of rows in write set +wsrep_max_ws_rows=131072 + +# Maximum size of write set +wsrep_max_ws_size=1073741824 + +# Debug level logging (1 = enabled) +wsrep_debug=1 + +# Convert locking sessions into transactions +wsrep_convert_LOCK_to_trx=0 + +# Number of retries for deadlocked autocommits +wsrep_retry_autocommit=1 + +# Change auto_increment_increment and auto_increment_offset automatically +wsrep_auto_increment_control=1 + +# Retry autoinc insert, when the insert failed for "duplicate key error" +wsrep_drupal_282555_workaround=0 + +# Enable "strictly synchronous" semantics for read operations +wsrep_causal_reads=0 + +# Command to call when node status or cluster membership changes. +# Will be passed all or some of the following options: +# --status - new status of this node +# --uuid - UUID of the cluster +# --primary - whether the component is primary or not ("yes"/"no") +# --members - comma-separated list of members +# --index - index of this node in the list +wsrep_notify_cmd= + +## +## WSREP State Transfer options +## + +# State Snapshot Transfer method +#wsrep_sst_method=mysqldump +#wsrep_sst_method=xtrabackup +wsrep_sst_method=rsync + +# INITIAL SETUP +# Address which donor should send State Snapshot to. +# Should be the address of the CURRENT node. DON'T SET IT TO DONOR ADDRESS!!! +# (SST method dependent. Defaults to the first IP of the first interface) +wsrep_sst_receive_address=###NODE-ADDRESS### + +# INITIAL SETUP +# SST authentication string. This will be used to send SST to joining nodes. +# Depends on SST method. For mysqldump method it is root: +#wsrep_sst_auth=###REP-USERNAME###:###REP-PASSWORD### +wsrep_sst_auth=repl:repl + +# Desired SST donor name. +#wsrep_sst_donor= + +# Reject client queries when donating SST (false) +#wsrep_sst_donor_rejects_queries=0 + +# Protocol version to use +# wsrep_protocol_version= diff --git a/maxscale-system-test/mdbci/cnf/mysql56/galera_server3.cnf b/maxscale-system-test/mdbci/cnf/mysql56/galera_server3.cnf new file mode 100644 index 000000000..0bdaafd42 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/galera_server3.cnf @@ -0,0 +1,135 @@ +[mysqld] +expire_logs_days=7 +user=mysql +server_id=3 + +# Row binary log format is required by Galera +binlog_format=ROW + +log-bin + +# InnoDB is currently the only storage engine supported by Galera +default-storage-engine=innodb +innodb_file_per_table + +# To avoid issues with 'bulk mode inserts' using autoincrement fields +innodb_autoinc_lock_mode=2 + +# Required to prevent deadlocks on parallel transaction execution +innodb_locks_unsafe_for_binlog=1 + +# Query Cache is not supported by Galera wsrep replication +query_cache_size=0 +query_cache_type=0 + +# INITIAL SETUP +# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST +# it will have (most likely) disastrous consequences on donor node +bind-address=###NODE-ADDRESS### + +## +## WSREP options +## + +# INITIAL SETUP +# For the initial setup, wsrep should be disabled +wsrep_provider=none +# After initial setup, parameter should have full path to wsrep provider library +wsrep_provider=###GALERA-LIB-PATH### + +# Provider specific configuration options +wsrep_provider_options = "evs.keepalive_period = PT3S; evs.inactive_check_period = PT10S; evs.suspect_timeout = PT30S; evs.inactive_timeout = PT1M; evs.install_timeout = PT1M" + +# Logical cluster name. Should be the same for all nodes in the same cluster. +wsrep_cluster_name=skycluster + +# INITIAL SETUP +# Group communication system handle: for the first node to be launched, the value should be "gcomm://", indicating creation of a new cluster; +# for the other nodes joining the cluster, the value should be "gcomm://xxx.xxx.xxx.xxx:4567", where xxx.xxx.xxx.xxx should be the ip of a node +# already on the cluster (usually the first one) +# DEPRECATED +# wsrep_cluster_address=gcomm:// + +# Human-readable node name (non-unique). Hostname by default. +#wsrep_node_name=###NODE-NAME### +wsrep_node_name=galera002 + +# INITIAL SETUP +# Base replication [:port] of the node. +# The values supplied will be used as defaults for state transfer receiving, +# listening ports and so on. Default: address of the first network interface. +wsrep_node_address=###NODE-ADDRESS### + +# INITIAL SETUP +# Address for incoming client connections. Autodetect by default. +wsrep_node_incoming_address=###NODE-ADDRESS### + +# Number of threads that will process writesets from other nodes +wsrep_slave_threads=1 + +# Generate fake primary keys for non-PK tables (required for multi-master +# and parallel applying operation) +wsrep_certify_nonPK=1 + +# Maximum number of rows in write set +wsrep_max_ws_rows=131072 + +# Maximum size of write set +wsrep_max_ws_size=1073741824 + +# Debug level logging (1 = enabled) +wsrep_debug=1 + +# Convert locking sessions into transactions +wsrep_convert_LOCK_to_trx=0 + +# Number of retries for deadlocked autocommits +wsrep_retry_autocommit=1 + +# Change auto_increment_increment and auto_increment_offset automatically +wsrep_auto_increment_control=1 + +# Retry autoinc insert, when the insert failed for "duplicate key error" +wsrep_drupal_282555_workaround=0 + +# Enable "strictly synchronous" semantics for read operations +wsrep_causal_reads=0 + +# Command to call when node status or cluster membership changes. +# Will be passed all or some of the following options: +# --status - new status of this node +# --uuid - UUID of the cluster +# --primary - whether the component is primary or not ("yes"/"no") +# --members - comma-separated list of members +# --index - index of this node in the list +wsrep_notify_cmd= + +## +## WSREP State Transfer options +## + +# State Snapshot Transfer method +#wsrep_sst_method=mysqldump +#wsrep_sst_method=xtrabackup +wsrep_sst_method=rsync + +# INITIAL SETUP +# Address which donor should send State Snapshot to. +# Should be the address of the CURRENT node. DON'T SET IT TO DONOR ADDRESS!!! +# (SST method dependent. Defaults to the first IP of the first interface) +wsrep_sst_receive_address=###NODE-ADDRESS### + +# INITIAL SETUP +# SST authentication string. This will be used to send SST to joining nodes. +# Depends on SST method. For mysqldump method it is root: +#wsrep_sst_auth=###REP-USERNAME###:###REP-PASSWORD### +wsrep_sst_auth=repl:repl + +# Desired SST donor name. +#wsrep_sst_donor= + +# Reject client queries when donating SST (false) +#wsrep_sst_donor_rejects_queries=0 + +# Protocol version to use +# wsrep_protocol_version= diff --git a/maxscale-system-test/mdbci/cnf/mysql56/galera_server4.cnf b/maxscale-system-test/mdbci/cnf/mysql56/galera_server4.cnf new file mode 100644 index 000000000..78d510da9 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/galera_server4.cnf @@ -0,0 +1,135 @@ +[mysqld] +expire_logs_days=7 +user=mysql +server_id=4 + +# Row binary log format is required by Galera +binlog_format=ROW + +log-bin + +# InnoDB is currently the only storage engine supported by Galera +default-storage-engine=innodb +innodb_file_per_table + +# To avoid issues with 'bulk mode inserts' using autoincrement fields +innodb_autoinc_lock_mode=2 + +# Required to prevent deadlocks on parallel transaction execution +innodb_locks_unsafe_for_binlog=1 + +# Query Cache is not supported by Galera wsrep replication +query_cache_size=0 +query_cache_type=0 + +# INITIAL SETUP +# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST +# it will have (most likely) disastrous consequences on donor node +bind-address=###NODE-ADDRESS### + +## +## WSREP options +## + +# INITIAL SETUP +# For the initial setup, wsrep should be disabled +wsrep_provider=none +# After initial setup, parameter should have full path to wsrep provider library +wsrep_provider=###GALERA-LIB-PATH### + +# Provider specific configuration options +wsrep_provider_options = "evs.keepalive_period = PT3S; evs.inactive_check_period = PT10S; evs.suspect_timeout = PT30S; evs.inactive_timeout = PT1M; evs.install_timeout = PT1M" + +# Logical cluster name. Should be the same for all nodes in the same cluster. +wsrep_cluster_name=skycluster + +# INITIAL SETUP +# Group communication system handle: for the first node to be launched, the value should be "gcomm://", indicating creation of a new cluster; +# for the other nodes joining the cluster, the value should be "gcomm://xxx.xxx.xxx.xxx:4567", where xxx.xxx.xxx.xxx should be the ip of a node +# already on the cluster (usually the first one) +# DEPRECATED +# wsrep_cluster_address=gcomm:// + +# Human-readable node name (non-unique). Hostname by default. +#wsrep_node_name=###NODE-NAME### +wsrep_node_name=galera003 + +# INITIAL SETUP +# Base replication [:port] of the node. +# The values supplied will be used as defaults for state transfer receiving, +# listening ports and so on. Default: address of the first network interface. +wsrep_node_address=###NODE-ADDRESS### + +# INITIAL SETUP +# Address for incoming client connections. Autodetect by default. +wsrep_node_incoming_address=###NODE-ADDRESS### + +# Number of threads that will process writesets from other nodes +wsrep_slave_threads=1 + +# Generate fake primary keys for non-PK tables (required for multi-master +# and parallel applying operation) +wsrep_certify_nonPK=1 + +# Maximum number of rows in write set +wsrep_max_ws_rows=131072 + +# Maximum size of write set +wsrep_max_ws_size=1073741824 + +# Debug level logging (1 = enabled) +wsrep_debug=1 + +# Convert locking sessions into transactions +wsrep_convert_LOCK_to_trx=0 + +# Number of retries for deadlocked autocommits +wsrep_retry_autocommit=1 + +# Change auto_increment_increment and auto_increment_offset automatically +wsrep_auto_increment_control=1 + +# Retry autoinc insert, when the insert failed for "duplicate key error" +wsrep_drupal_282555_workaround=0 + +# Enable "strictly synchronous" semantics for read operations +wsrep_causal_reads=0 + +# Command to call when node status or cluster membership changes. +# Will be passed all or some of the following options: +# --status - new status of this node +# --uuid - UUID of the cluster +# --primary - whether the component is primary or not ("yes"/"no") +# --members - comma-separated list of members +# --index - index of this node in the list +wsrep_notify_cmd= + +## +## WSREP State Transfer options +## + +# State Snapshot Transfer method +#wsrep_sst_method=mysqldump +#wsrep_sst_method=xtrabackup +wsrep_sst_method=rsync + +# INITIAL SETUP +# Address which donor should send State Snapshot to. +# Should be the address of the CURRENT node. DON'T SET IT TO DONOR ADDRESS!!! +# (SST method dependent. Defaults to the first IP of the first interface) +wsrep_sst_receive_address=###NODE-ADDRESS### + +# INITIAL SETUP +# SST authentication string. This will be used to send SST to joining nodes. +# Depends on SST method. For mysqldump method it is root: +#wsrep_sst_auth=###REP-USERNAME###:###REP-PASSWORD### +wsrep_sst_auth=repl:repl + +# Desired SST donor name. +#wsrep_sst_donor= + +# Reject client queries when donating SST (false) +#wsrep_sst_donor_rejects_queries=0 + +# Protocol version to use +# wsrep_protocol_version= diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server1.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server1.cnf new file mode 100644 index 000000000..38d8d2c8a --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server1.cnf @@ -0,0 +1,39 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=1 +#slave_parallel_threads=2 +user=mysql +## x001 +#max_long_data_size=1000000000 +#innodb_log_file_size=2000000000 + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server10.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server10.cnf new file mode 100644 index 000000000..7c704b7de --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server10.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=10 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server11.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server11.cnf new file mode 100644 index 000000000..815a54f4d --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server11.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=11 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server12.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server12.cnf new file mode 100644 index 000000000..e3af6c8f8 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server12.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=12 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server13.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server13.cnf new file mode 100644 index 000000000..67dade68a --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server13.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=13 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server14.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server14.cnf new file mode 100644 index 000000000..dd237e89d --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server14.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=14 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server15.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server15.cnf new file mode 100644 index 000000000..944cfcf50 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server15.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=15 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server2.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server2.cnf new file mode 100644 index 000000000..321ebf9c4 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server2.cnf @@ -0,0 +1,39 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=2 +#slave_parallel_threads=2 +user=mysql +## x001 +#max_long_data_size=1000000000 +#innodb_log_file_size=2000000000 + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server3.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server3.cnf new file mode 100644 index 000000000..0d3694f79 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server3.cnf @@ -0,0 +1,39 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=3 +#slave_parallel_threads=2 +user=mysql +## x001 +#max_long_data_size=1000000000 +#innodb_log_file_size=2000000000 + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server4.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server4.cnf new file mode 100644 index 000000000..2cf00b9bb --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server4.cnf @@ -0,0 +1,39 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=4 +#slave_parallel_threads=2 +user=mysql +## x001 +#max_long_data_size=1000000000 +#innodb_log_file_size=2000000000 + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server5.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server5.cnf new file mode 100644 index 000000000..9dfd4e786 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server5.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=5 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server6.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server6.cnf new file mode 100644 index 000000000..5007ec9f8 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server6.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=6 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server7.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server7.cnf new file mode 100644 index 000000000..de3f8d470 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server7.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=7 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server8.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server8.cnf new file mode 100644 index 000000000..5ab8c1f83 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server8.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=8 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/mysql56/server9.cnf b/maxscale-system-test/mdbci/cnf/mysql56/server9.cnf new file mode 100644 index 000000000..0cc2cf435 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/mysql56/server9.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +#log-basename=mar +log-bin=mar-bin +#binlog-format=row +binlog-format=STATEMENT +server_id=9 +#slave_parallel_threads=2 +user=mysql + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server1.cnf b/maxscale-system-test/mdbci/cnf/server1.cnf new file mode 100644 index 000000000..3c3367b8f --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server1.cnf @@ -0,0 +1,39 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=row +binlog_row_image=full +server_id=1 +user=mysql +## x001 +max_long_data_size=1000000000 +innodb_log_file_size=2000000000 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server10.cnf b/maxscale-system-test/mdbci/cnf/server10.cnf new file mode 100644 index 000000000..9d7e48b92 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server10.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=10 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server11.cnf b/maxscale-system-test/mdbci/cnf/server11.cnf new file mode 100644 index 000000000..8733cfede --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server11.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=11 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server12.cnf b/maxscale-system-test/mdbci/cnf/server12.cnf new file mode 100644 index 000000000..d01d176cf --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server12.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=12 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server13.cnf b/maxscale-system-test/mdbci/cnf/server13.cnf new file mode 100644 index 000000000..27ccd9ed5 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server13.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=13 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server14.cnf b/maxscale-system-test/mdbci/cnf/server14.cnf new file mode 100644 index 000000000..e5d2fc2b0 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server14.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=14 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server15.cnf b/maxscale-system-test/mdbci/cnf/server15.cnf new file mode 100644 index 000000000..776376b2b --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server15.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=15 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server2.cnf b/maxscale-system-test/mdbci/cnf/server2.cnf new file mode 100644 index 000000000..ae6b3df84 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server2.cnf @@ -0,0 +1,39 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=row +binlog_row_image=full +server_id=2 +user=mysql +## x001 +max_long_data_size=1000000000 +innodb_log_file_size=2000000000 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server3.cnf b/maxscale-system-test/mdbci/cnf/server3.cnf new file mode 100644 index 000000000..24b0eaee4 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server3.cnf @@ -0,0 +1,39 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=row +binlog_row_image=full +server_id=3 +user=mysql +## x001 +max_long_data_size=1000000000 +innodb_log_file_size=2000000000 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server4.cnf b/maxscale-system-test/mdbci/cnf/server4.cnf new file mode 100644 index 000000000..c291692db --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server4.cnf @@ -0,0 +1,39 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=row +binlog_row_image=full +server_id=4 +user=mysql +## x001 +max_long_data_size=1000000000 +innodb_log_file_size=2000000000 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server5.cnf b/maxscale-system-test/mdbci/cnf/server5.cnf new file mode 100644 index 000000000..0abd4dc70 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server5.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=5 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server6.cnf b/maxscale-system-test/mdbci/cnf/server6.cnf new file mode 100644 index 000000000..5297a2b95 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server6.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=6 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server7.cnf b/maxscale-system-test/mdbci/cnf/server7.cnf new file mode 100644 index 000000000..6698ca27c --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server7.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=7 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server8.cnf b/maxscale-system-test/mdbci/cnf/server8.cnf new file mode 100644 index 000000000..a33cf1fb2 --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server8.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=8 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/cnf/server9.cnf b/maxscale-system-test/mdbci/cnf/server9.cnf new file mode 100644 index 000000000..f00a3454c --- /dev/null +++ b/maxscale-system-test/mdbci/cnf/server9.cnf @@ -0,0 +1,36 @@ + +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see +# +# See the examples of server my.cnf files in /usr/share/mysql/ +# + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] +log-slave-updates +log-bin=mar-bin +binlog-format=STATEMENT +server_id=9 +user=mysql +## x001 +slave-skip-errors=all + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB-5.5 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mysqld-5.5] + +# These two groups are only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +[mariadb-5.5] + diff --git a/maxscale-system-test/mdbci/configure_backend.sh b/maxscale-system-test/mdbci/configure_backend.sh new file mode 100644 index 000000000..c05f697f8 --- /dev/null +++ b/maxscale-system-test/mdbci/configure_backend.sh @@ -0,0 +1,9 @@ +. ${script_dir}/set_env.sh $name + +${script_dir}/backend/setup_repl.sh +${script_dir}/backend/galera/setup_galera.sh + +${script_dir}/configure_core.sh + +rm ~/vagrant_lock + diff --git a/maxscale-system-test/mdbci/configure_core.sh b/maxscale-system-test/mdbci/configure_core.sh new file mode 100755 index 000000000..2c72b5ac9 --- /dev/null +++ b/maxscale-system-test/mdbci/configure_core.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -x + +ssh -i $maxscale_sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $maxscale_access_user@$maxscale_IP '$maxscale_access_sudo service iptables stop' + +ssh -i $maxscale_sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $maxscale_access_user@$maxscale_IP "$maxscale_access_sudo mkdir ccore; $maxscale_access_sudo chown $maxscale_access_user ccore" + +scp -i $maxscale_sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${script_dir}/add_core_cnf.sh $maxscale_access_user@$maxscale_IP:./ccore/ +ssh -i $maxscale_sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $maxscale_access_user@$maxscale_IP "$maxscale_access_sudo /home/$maxscale_access_user/ccore/add_core_cnf.sh" + +set +x diff --git a/maxscale-system-test/mdbci/configure_log_dir.sh b/maxscale-system-test/mdbci/configure_log_dir.sh new file mode 100644 index 000000000..568c298b7 --- /dev/null +++ b/maxscale-system-test/mdbci/configure_log_dir.sh @@ -0,0 +1,15 @@ +set -x +LOGS_DIR=${logs_dir:-$HOME/LOGS} +echo $JOB_NAME | grep "/" +if [ $? == 0 ] ; then + export job_name_buildID=`echo $JOB_NAME | sed "s|/|-$BUILD_NUMBER/|"` + export logs_publish_dir="${LOGS_DIR}/${job_name_buildID}/" +else + export logs_publish_dir="${LOGS_DIR}/${JOB_NAME}-${BUILD_NUMBER}" +fi + +export job_name_buildID=`echo ${JOB_NAME} | sed "s|/|-${BUILD_NUMBER}/|"` +export logs_publish_dir="${LOGS_DIR}/${job_name_buildID}-${BUILD_NUMBER}" +echo "Logs go to ${logs_publish_dir}" +mkdir -p ${logs_publish_dir} + diff --git a/maxscale-system-test/mdbci/copy_logs.sh b/maxscale-system-test/mdbci/copy_logs.sh new file mode 100755 index 000000000..a3a9ba3db --- /dev/null +++ b/maxscale-system-test/mdbci/copy_logs.sh @@ -0,0 +1,5 @@ +set -x +rsync -a --no-o --no-g LOGS ${logs_publish_dir} +chmod a+r ${logs_publish_dir}/* +cp -r ${MDBCI_VM_PATH}/$name ${logs_publish_dir} +cp ${MDBCI_VM_PATH}/${name}.json ${logs_publish_dir} diff --git a/maxscale-system-test/mdbci/create_config.sh b/maxscale-system-test/mdbci/create_config.sh new file mode 100755 index 000000000..ed449330f --- /dev/null +++ b/maxscale-system-test/mdbci/create_config.sh @@ -0,0 +1,59 @@ +#!/bin/bash +set -x +export dir=`pwd` + +# read the name of build scripts directory +export script_dir="$(dirname $(readlink -f $0))" + +. ${script_dir}/set_run_test_variables.sh + +${mdbci_dir}/repository-config/generate_all.sh repo.d +${mdbci_dir}/repository-config/maxscale-ci.sh $target repo.d + + +export repo_dir=$dir/repo.d/ + +export provider=`${mdbci_dir}/mdbci show provider $box --silent 2> /dev/null` +export backend_box=${backend_box:-"centos_7_"$provider} + +if [ "$product" == "mysql" ] ; then + export cnf_path=${script_dir}/cnf/mysql56 +fi + +mkdir -p ${MDBCI_VM_PATH}/$name +cd ${MDBCI_VM_PATH}/$name +vagrant destroy -f +cd $dir + +mkdir ${MDBCI_VM_PATH}/$name/cnf +cp -r ${cnf_path}/* ${MDBCI_VM_PATH}/$name/cnf/ +export cnd_path="${MDBCI_VM_PATH}/$name/cnf/" + + eval "cat < /dev/null > ${MDBCI_VM_PATH}/${name}.json + +${mdbci_dir}/mdbci --override --template ${MDBCI_VM_PATH}/${name}.json --repo-dir ${repo_dir} generate $name + +while [ -f ~/vagrant_lock ] +do + echo "vagrant is locked, waiting ..." + sleep 5 +done +touch ~/vagrant_lock +echo ${JOB_NAME}-${BUILD_NUMBER} >> ~/vagrant_lock + +echo "running vagrant up $provider" + +${mdbci_dir}/mdbci up $name --attempts 3 +if [ $? != 0 ]; then + echo "Error creating configuration" + rm ~/vagrant_lock + exit 1 +fi + +cp ~/build-scripts/team_keys . +${mdbci_dir}/mdbci public_keys --key ${team_keys} $name + +rm ~/vagrant_lock +exit 0 diff --git a/maxscale-system-test/mdbci/destroy.sh b/maxscale-system-test/mdbci/destroy.sh new file mode 100755 index 000000000..d12ec0764 --- /dev/null +++ b/maxscale-system-test/mdbci/destroy.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +dir=`pwd` +cd ${MDBCI_VM_PATH}/${name} +vagrant destroy -f +cd $dir + +rm -rf ${MDBCI_VM_PATH}/${name} +rm -rf ${MDBCI_VM_PATH}/${name}.json +rm -rf ${MDBCI_VM_PATH}/${name}_network_config diff --git a/maxscale-system-test/mdbci/revert_snapshot.sh b/maxscale-system-test/mdbci/revert_snapshot.sh new file mode 100755 index 000000000..360bfdab7 --- /dev/null +++ b/maxscale-system-test/mdbci/revert_snapshot.sh @@ -0,0 +1,5 @@ +export curr_dir=`pwd` +cd $HOME/mdbci +$HOME/mdbci/mdbci snapshot revert --path-to-nodes $1 --snapshot-name $2 +cd $curr_dir + diff --git a/maxscale-system-test/mdbci/run_test.sh b/maxscale-system-test/mdbci/run_test.sh new file mode 100755 index 000000000..4def80585 --- /dev/null +++ b/maxscale-system-test/mdbci/run_test.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +# see set_run_test_variables.sh for default values of all variables + +# $box - Name of Vagrant box for Maxscale machine +# see lists of supported boxes +# https://github.com/mariadb-corporation/mdbci/tree/integration/BOXES + +# $template - name of MDBCI json template file +# Template file have to be in ./templates/, file name +# have to be '$template.json.template +# Template file can contain references to any variables - +# all ${variable_name} will be replaced with values + +# $name - name of test run. It can be any string of leytters or digits +# If it is not defined, name will be automatically genereted +# using $box and current date and time + +# $ci_url - URL to Maxscale CI repository +# (default "http://max-tst-01.mariadb.com/ci-repository/") +# if build is done also locally and binaries are not uploaded to +# max-tst-01.mariadb.com $ci_url should toint to local web server +# e.g. http://192.168.122.1/repository (IP should be a host IP in the +# virtual network (not 127.0.0.1)) + +# $product - 'mariadb' or 'mysql' + +# $version - version of backend DB (e.g. '10.1', '10.2') + +# $galera_version - version of Galera backend DB +# same as $version by default + +# $target - name of binary repository +# (name of subdirectroy http://max-tst-01.mariadb.com/ci-repository/) + +# $team_keys - path to the file with open ssh keys to be +# installed on all VMs (default ${HOME}/team_keys) + +# $don_not_destroy_vm - if 'yes' VM won't be destored afther the test + +# $test_set - parameters to be send to 'ctest' (e.g. '-I 1,100', +# '-LE UNSTABLE' + +export vm_memory=${vm_memory:-"2048"} +export dir=`pwd` + +ulimit -n + +# read the name of build scripts directory +export script_dir="$(dirname $(readlink -f $0))" + +. ${script_dir}/set_run_test_variables.sh + +rm -rf LOGS + +export target=`echo $target | sed "s/?//g"` +export name=`echo $name | sed "s/?//g"` + +. ${script_dir}/configure_log_dir.sh + +cd maxscale-system-test + +cmake . -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug +make + +${script_dir}/create_config.sh +res=$? + +if [ $res == 0 ] ; then + . ${script_dir}/configure_backend.sh + ${mdbci_dir}/mdbci snapshot take --path-to-nodes $name --snapshot-name clean + + if [ -z "${named_test}" ] ; then + ./${named_test} + else + ./check_backend + if [ $? != 0 ]; then + echo "Backend broken!" + if [ "${do_not_destroy_vm}" != "yes" ] ; then + ${script_dir}/destroy.sh + fi + rm ~/vagrant_lock + exit 1 + fi + ctest -VV -D Nightly ${test_set} + fi + + cd $dir + ${script_dir}/copy_logs.sh +else + echo "Failed to create VMs, exiting" + if [ "${do_not_destroy_vm}" != "yes" ] ; then + ${script_dir}/destroy.sh + fi + rm ~/vagrant_lock + exit 1 +fi + +if [ "${do_not_destroy_vm}" != "yes" ] ; then + ${script_dir}/destroy.sh + echo "clean up done!" +fi + diff --git a/maxscale-system-test/mdbci/run_test_snapshot.sh b/maxscale-system-test/mdbci/run_test_snapshot.sh new file mode 100755 index 000000000..d12df309a --- /dev/null +++ b/maxscale-system-test/mdbci/run_test_snapshot.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +function checkExitStatus { + returnCode=$1 + errorMessage=$2 + lockFilePath=$3 + if [ "$returnCode" != 0 ]; then + echo "$errorMesage" + rm $lockFilePath + echo "Snapshot lock file was deleted due to an error" + exit 1 + fi +} + +set -x +export dir=`pwd` + +# read the name of build scripts directory +export script_dir="$(dirname $(readlink -f $0))" + +. ${script_dir}/set_run_test_variables.sh +export name="$box-$product-$version-permanent" + +export snapshot_name=${snapshot_name:-"clean"} + +rm -rf LOGS + +export target=`echo $target | sed "s/?//g"` +export name=`echo $name | sed "s/?//g"` + +. ${script_dir}/configure_log_dir.sh + +# Setting snapshot_lock +export snapshot_lock_file=${MDBCI_VM_PATH}/${name}_snapshot_lock +if [ -f ${snapshot_lock_file} ]; then + echo "Snapshot is locked, waiting ..." +fi +while [ -f ${snapshot_lock_file} ] +do + sleep 5 +done + +touch ${snapshot_lock_file} +echo $JOB_NAME-$BUILD_NUMBER >> ${snapshot_lock_file} + +export repo_dir=$dir/repo.d/ + +${mdbci_dir}/mdbci snapshot revert --path-to-nodes $name --snapshot-name $snapshot_name + +if [ $? != 0 ]; then + ${script_dir}/destroy.sh + ${MDBCI_VM_PATH}/scripts/clean_vms.sh $name + + ${script_dir}/create_config.sh + checkExitStatus $? "Error creating configuration" $snapshot_lock_file + . ${script_dir}/configure_backend.sh + + echo "Creating snapshot from new config" + $HOME/mdbci/mdbci snapshot take --path-to-nodes $name --snapshot-name $snapshot_name +fi + +. ${script_dir}/set_env.sh "$name" + +${mdbci_dir}/repository-config/maxscale-ci.sh $target repo.d + + +${mdbci_dir}/mdbci sudo --command 'yum remove maxscale -y' $name/maxscale +${mdbci_dir}/mdbci sudo --command 'yum clean all' $name/maxscale + +${mdbci_dir}/mdbci setup_repo --product maxscale $name/maxscale --repo-dir $repo_dir +${mdbci_dir}/mdbci install_product --product maxscale $name/maxscale --repo-dir $repo_dir + +checkExitStatus $? "Error installing Maxscale" $snapshot_lock_file + +cd ${script_dir}/.. + +cmake . -DBUILDNAME=$JOB_NAME-$BUILD_NUMBER-$target +make + +./check_backend --restart-galera + +checkExitStatus $? "Failed to check backends" $snapshot_lock_file + +ctest $test_set -VV -D Nightly + +cd $dir +${script_dir}/copy_logs.sh + +# Removing snapshot_lock +rm ${snapshot_lock_file} + diff --git a/maxscale-system-test/mdbci/set_env.sh b/maxscale-system-test/mdbci/set_env.sh new file mode 100644 index 000000000..732d15ba9 --- /dev/null +++ b/maxscale-system-test/mdbci/set_env.sh @@ -0,0 +1,97 @@ +set -x +echo $* +export MDBCI_VM_PATH=${MDBCI_VM_PATH:-$HOME/vms} +export mdbci_dir=${mdbci_dir:-"$HOME/mdbci/"} +export script_dir="$(dirname $(readlink -f $0))" + +export config_name="$1" +if [ -z $1 ] ; then + config_name="test1" +fi + +export curr_dir=`pwd` + +export maxscale_binlog_dir="/var/lib/maxscale/Binlog_Service" +export maxdir="/usr/bin/" +export maxdir_bin="/usr/bin/" +export maxscale_cnf="/etc/maxscale.cnf" +export maxscale_log_dir="/var/log/maxscale/" + +# Number of nodes +export galera_N=`cat "$MDBCI_VM_PATH/$config_name"_network_config | grep galera | grep network | wc -l` +export node_N=`cat "$MDBCI_VM_PATH/$config_name"_network_config | grep node | grep network | wc -l` +sed "s/^/export /g" "$MDBCI_VM_PATH/$config_name"_network_config > "$curr_dir"/"$config_name"_network_config_export +source "$curr_dir"/"$config_name"_network_config_export + +# IP Of MaxScale machine +export maxscale_IP=$maxscale_network +export maxscale_sshkey=$maxscale_keyfile + +# User name and Password for Master/Slave replication setup (should have all PRIVILEGES) +export node_user="skysql" +export node_password="skysql" + +# User name and Password for Galera setup (should have all PRIVILEGES) +export galera_user="skysql" +export galera_password="skysql" + +export maxscale_user="skysql" +export maxscale_password="skysql" + +export maxadmin_password="mariadb" + +for prefix in "node" "galera" +do + N_var="$prefix"_N + Nx=${!N_var} + N=`expr $Nx - 1` + for i in $(seq 0 $N) + do + num=`printf "%03d" $i` + eval 'export "$prefix"_"$num"_port=3306' + eval 'export "$prefix"_"$num"_access_sudo=sudo' + + start_cmd_var="$prefix"_"$num"_start_db_command + stop_cmd_var="$prefix"_"$num"_stop_db_command + mysql_exe=`${mdbci_dir}/mdbci ssh --command 'ls /etc/init.d/mysql* 2> /dev/null | tr -cd "[:print:]"' $config_name/node_$num --silent 2> /dev/null` + echo $mysql_exe | grep -i "mysql" + if [ $? != 0 ] ; then + service_name=`${mdbci_dir}/mdbci ssh --command 'systemctl list-unit-files | grep mysql' $config_name/node_$num --silent` + echo $service_name | grep mysql + if [ $? == 0 ] ; then + echo $service_name | grep mysqld + if [ $? == 0 ] ; then + eval 'export $start_cmd_var="service mysqld start "' + eval 'export $stop_cmd_var="service mysqld stop "' + else + eval 'export $start_cmd_var="service mysql start "' + eval 'export $stop_cmd_var="service mysql stop "' + fi + else + ${mdbci_dir}/mdbci ssh --command 'echo \"/usr/sbin/mysqld \$* 2> stderr.log > stdout.log &\" > mysql_start.sh; echo \"sleep 20\" >> mysql_start.sh; echo \"disown\" >> mysql_start.sh; chmod a+x mysql_start.sh' $config_name/node_$num --silent + eval 'export $start_cmd_var="/home/$au/mysql_start.sh "' + eval 'export $start_cmd_var="killall mysqld "' + fi + else + eval 'export $start_cmd_var="$mysql_exe start "' + eval 'export $stop_cmd_var="$mysql_exe stop "' + fi + + eval 'export "$prefix"_"$num"_start_vm_command="cd $mdbci_dir/$config_name;vagrant up node_$num --provider=$provider; cd $curr_dir"' + eval 'export "$prefix"_"$num"_kill_vm_command="cd $mdbci_dir/$config_name;vagrant halt node_$num --provider=$provider; cd $curr_dir"' + done +done + +export maxscale_access_user=$maxscale_whoami +export maxscale_access_sudo="sudo " + +# Sysbench directory (should be sysbench >= 0.5) +export sysbench_dir=${sysbench_dir:-"$HOME/sysbench_deb7/sysbench/"} + +export ssl=true + +export take_snapshot_command="${script_dir}/take_snapshot.sh $config_name" +export revert_snapshot_command="${script_dir}/revert_snapshot.sh $config_name" +#export use_snapshots=yes + +set +x diff --git a/maxscale-system-test/mdbci/set_run_test_variables.sh b/maxscale-system-test/mdbci/set_run_test_variables.sh new file mode 100644 index 000000000..27bd17382 --- /dev/null +++ b/maxscale-system-test/mdbci/set_run_test_variables.sh @@ -0,0 +1,32 @@ +#!/bin/bash + + +export MDBCI_VM_PATH=${MDBCI_VM_PATH:-$HOME/vms} +mkdir -p $MDBCI_VM_PATH +echo "MDBCI_VM_PATH=$MDBCI_VM_PATH" + +export box=${box:-"centos_7_libvirt"} +echo "box=$box" + +export template=${template:-"default"} + +export curr_date=`date '+%Y-%m-%d_%H-%M'` + +export name=${name:-$box-${curr_date}} + +export mdbci_dir=${mdbci_dir:-"$HOME/mdbci/"} +export ci_url=${ci_url:-"http://max-tst-01.mariadb.com/ci-repository/"} + +export product=${product:-"mariadb"} +export version=${version:-"10.2"} +export target=${target:-"develop"} +export vm_memory=${vm_memory:-"2048"} +export cnf_path=${script_dir}/cnf +export JOB_NAME=${JOB_NAME:-"local_test"} +export BUILD_NUMBER=${BUILD_NUMBER:-`date '+%Y%m%d%H%M'`} +export BUILD_TAG=${BUILD_TAG:-jenkins-${JOB_NAME}-${BUILD_NUMBER}} +export team_keys=${team_keys:-${HOME}/team_keys} +export galera_version=${galera_version:-$version} +export do_not_destroy_vm=${do_not_destroy_vm:-"no"} +#export test_set=${test_set:-"-LE UNSTABLE"} +export test_set=${test_set:-"-I 1,5"} diff --git a/maxscale-system-test/mdbci/take_snapshot.sh b/maxscale-system-test/mdbci/take_snapshot.sh new file mode 100755 index 000000000..4f8cf002b --- /dev/null +++ b/maxscale-system-test/mdbci/take_snapshot.sh @@ -0,0 +1,5 @@ +export curr_dir=`pwd` +cd $HOME/mdbci +$HOME/mdbci/mdbci snapshot take --path-to-nodes $1 --snapshot-name $2 +cd $curr_dir + diff --git a/maxscale-system-test/mdbci/templates/big.json.template b/maxscale-system-test/mdbci/templates/big.json.template new file mode 100644 index 000000000..9592c5647 --- /dev/null +++ b/maxscale-system-test/mdbci/templates/big.json.template @@ -0,0 +1,152 @@ +{ + "node_000" : + { + "hostname" : "node000", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server1.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + + }, + + "node_001" : + { + "hostname" : "node001", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server2.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "node_002" : + { + "hostname" : "node002", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server3.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "node_003" : + { + "hostname" : "node003", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server4.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_004" : + { + "hostname" : "node004", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server5.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_005" : + { + "hostname" : "node005", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server6.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_006" : + { + "hostname" : "node006", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server7.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_007" : + { + "hostname" : "node007", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server8.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_000" : + { + "hostname" : "galera000", + "box" : "centos_7_aws", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server1.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_001" : + { + "hostname" : "galera001", + "box" : "centos_7_aws", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server2.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_002" : + { + "hostname" : "galera002", + "box" : "centos_7_aws", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server3.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_003" : + { + "hostname" : "galera003", + "box" : "centos_7_aws", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server4.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "maxscale" : + { + "hostname" : "maxscale", + "box" : "centos_7_aws_large", + "product" : { + "name": "maxscale" + } + + } +} diff --git a/maxscale-system-test/mdbci/templates/big15.json.template b/maxscale-system-test/mdbci/templates/big15.json.template new file mode 100644 index 000000000..5d50432d7 --- /dev/null +++ b/maxscale-system-test/mdbci/templates/big15.json.template @@ -0,0 +1,229 @@ +{ + "node_000" : + { + "hostname" : "node_000", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server1.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + + }, + + "node_001" : + { + "hostname" : "node_001", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server2.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "node_002" : + { + "hostname" : "node_002", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server3.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "node_003" : + { + "hostname" : "node_003", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server4.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_004" : + { + "hostname" : "node_004", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server5.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_005" : + { + "hostname" : "node_005", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server6.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_006" : + { + "hostname" : "node_006", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server7.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_007" : + { + "hostname" : "node_007", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server8.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_008" : + { + "hostname" : "node_008", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server9.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_009" : + { + "hostname" : "node_009", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server10.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_0010" : + { + "hostname" : "node_0010", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server11.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_0011" : + { + "hostname" : "node_0011", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server12.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_0012" : + { + "hostname" : "node_0012", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server13.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_0013" : + { + "hostname" : "node_0013", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server14.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + "node_0014" : + { + "hostname" : "node_0014", + "box" : "centos_7_aws_large", + "product" : { + "name": "###product###", + "version": "###version###", + "cnf_template" : "server15.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_000" : + { + "hostname" : "galera_000", + "box" : "centos_7_aws", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server1.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_001" : + { + "hostname" : "galera_001", + "box" : "centos_7_aws", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server2.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_002" : + { + "hostname" : "galera_002", + "box" : "centos_7_aws", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server3.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_003" : + { + "hostname" : "galera_003", + "box" : "centos_7_aws", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server4.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "maxscale" : + { + "hostname" : "maxscale", + "box" : "centos_7_aws_large", + "product" : { + "name": "maxscale" + } + + } +} diff --git a/maxscale-system-test/mdbci/templates/default.json.template b/maxscale-system-test/mdbci/templates/default.json.template new file mode 100644 index 000000000..2376e46a7 --- /dev/null +++ b/maxscale-system-test/mdbci/templates/default.json.template @@ -0,0 +1,117 @@ +{ + "node_000" : + { + "hostname" : "node000", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "${product}", + "version": "${version}", + "cnf_template" : "server1.cnf", + "cnf_template_path": "${cnf_path}" + } + + }, + + "node_001" : + { + "hostname" : "node001", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "${product}", + "version": "${version}", + "cnf_template" : "server2.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "node_002" : + { + "hostname" : "node002", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "${product}", + "version": "${version}", + "cnf_template" : "server3.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "node_003" : + { + "hostname" : "node003", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "${product}", + "version": "${version}", + "cnf_template" : "server4.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "galera_000" : + { + "hostname" : "galera000", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "galera", + "version": "${galera_version}", + "cnf_template" : "galera_server1.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "galera_001" : + { + "hostname" : "galera001", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "galera", + "version": "${galera_version}", + "cnf_template" : "galera_server2.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "galera_002" : + { + "hostname" : "galera002", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "galera", + "version": "${galera_version}", + "cnf_template" : "galera_server3.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "galera_003" : + { + "hostname" : "galera003", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "galera", + "version": "${galera_version}", + "cnf_template" : "galera_server4.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "maxscale" : + { + "hostname" : "maxscale", + "box" : "${box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "maxscale" + } + + } +} diff --git a/maxscale-system-test/mdbci/templates/performance.json.template b/maxscale-system-test/mdbci/templates/performance.json.template new file mode 100644 index 000000000..a767f9fc2 --- /dev/null +++ b/maxscale-system-test/mdbci/templates/performance.json.template @@ -0,0 +1,67 @@ +{ + +###nodes### + + "galera_000" : + { + "hostname" : "galera000", + "box" : "centos_7_libvirt", + "memory_size" : "2048", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server1.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_001" : + { + "hostname" : "galera001", + "box" : "centos_7_libvirt", + "memory_size" : "2048", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server2.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_002" : + { + "hostname" : "galera002", + "box" : "centos_7_libvirt", + "memory_size" : "2048", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server3.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "galera_003" : + { + "hostname" : "galera003", + "box" : "centos_7_libvirt", + "memory_size" : "2048", + "product" : { + "name": "galera", + "version": "###galera_version###", + "cnf_template" : "galera_server4.cnf", + "cnf_template_path": "~/build-scripts/test-setup-scripts/cnf" + } + }, + + "maxscale" : + { + "hostname" : "maxscale", + "box" : "###box###", + "memory_size" : "2048", + "product" : { + "name": "maxscale" + } + + } +} From 6f185ff5db9fb1d7e34bc2fe10a6a82f39485c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 5 Dec 2017 08:48:10 +0200 Subject: [PATCH 27/46] MXS-1555: Fix persistent pool qualification When packets were routed individually, the qualification for the persistent pool was done before the current command was updated. In addition to this, the previous commit doesn't seem like it can even build. --- .../protocol/MySQL/MySQLClient/mysql_client.c | 82 +++++++++++++------ 1 file changed, 57 insertions(+), 25 deletions(-) diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c index f735c9a6c..a691b7a1a 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c @@ -957,6 +957,30 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read) return gw_read_finish_processing(dcb, read_buffer, capabilities); } +/** + * Check if a connection qualifies to be added into the persistent connection pool + * + * @param dcb The client DCB to check + */ +void check_pool_candidate(DCB* dcb) +{ + MXS_SESSION *session = dcb->session; + MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol; + + if (proto->current_command == MYSQL_COM_QUIT) + { + /** The client is closing the connection. We know that this will be the + * last command the client sends so the backend connections are very likely + * to be in an idle state. + * + * If the client is pipelining the queries (i.e. sending N request as + * a batch and then expecting N responses) then it is possible that + * the backend connections are not idle when the COM_QUIT is received. + * In most cases we can assume that the connections are idle. */ + session_qualify_for_pool(session); + } +} + /** * @brief Client read event, common processing after single statement handling * @@ -977,25 +1001,10 @@ gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities) /** Reset error handler when routing of the new query begins */ dcb->dcb_errhandle_called = false; - if (proto->current_command == MYSQL_COM_QUIT) - { - /** The client is closing the connection. We know that this will be the - * last command the client sends so the backend connections are very likely - * to be in an idle state. - * - * If the client is pipelining the queries (i.e. sending N request as - * a batch and then expecting N responses) then it is possible that - * the backend connections are not idle when the COM_QUIT is received. - * In most cases we can assume that the connections are idle. */ - session_qualify_for_pool(session); - } - if (rcap_type_required(capabilities, RCAP_TYPE_STMT_INPUT)) { /** - * Feed each statement completely and separately - * to router. The routing functions return 1 for - * success or 0 for failure. + * Feed each statement completely and separately to router. */ return_code = route_by_statement(session, capabilities, &read_buffer) ? 0 : 1; @@ -1010,9 +1019,10 @@ gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities) } else if (NULL != session->router_session || (rcap_type_required(capabilities, RCAP_TYPE_NO_RSESSION))) { - /** Feed whole packet to router, which will free it - * and return 1 for success, 0 for failure - */ + /** Check if this connection qualifies for the connection pool */ + check_pool_candidate(dcb); + + /** Feed the whole buffer to the router */ return_code = MXS_SESSION_ROUTE_QUERY(session, read_buffer) ? 0 : 1; } /* else return_code is still 0 from when it was originally set */ @@ -1437,6 +1447,30 @@ retblock: return 1; } +/** + * Update protocol tracking information for an individual statement + * + * @param dcb Client DCB + * @param buffer Buffer containing a single packet + */ +void update_current_command(DCB* dcb, GWBUF* buffer) +{ + MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol; + uint8_t cmd = (uint8_t)MYSQL_COM_QUERY; + + /** + * As we are routing individual packets, we can extract the command byte here. + * Empty packets are treated as COM_QUERY packets by default. + */ + gwbuf_copy_data(buffer, MYSQL_HEADER_LEN, 1, &cmd); + proto->current_command = cmd; + + /** + * Now that we have the current command, we can check if this connection + * can be a candidate for the connection pool. + */ + check_pool_candidate(dcb); +} /** * Detect if buffer includes partial mysql packet or multiple packets. @@ -1496,12 +1530,10 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF */ gwbuf_set_type(packetbuf, GWBUF_TYPE_SINGLE_STMT); - /** As we are routing packets, we can extract the command byte here. - * Empty packets are treated as COM_QUERY packets by default. */ - uint8_t cmd = (uint8_t)MYSQL_COM_QUERY; - gwbuf_copy_data(packetbuf, MYSQL_HEADER_LEN, 1, &cmd); - MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol; - proto->current_command = cmd; + /** + * Update the currently command being executed. + */ + update_current_command(session->client_dcb, packetbuf); if (rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_INPUT)) { From 97d41e6ca01d4539e857a6c53d654b7fa80b4b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 5 Dec 2017 09:24:31 +0200 Subject: [PATCH 28/46] MXS-1555: Never explicitly assign the readqueue The readqueue should never be explicitly assigned and should only ever be appended to. This guarantees that the packets are read and processed in the correct order. Also removed an unused function that deals with the readqueue manipulation. --- .../protocol/MySQL/MySQLClient/mysql_client.c | 58 ++----------------- 1 file changed, 6 insertions(+), 52 deletions(-) diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c index a691b7a1a..4c2b076e3 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c @@ -916,12 +916,13 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read) * that is tracked by the protocol module is updated in route_by_statement() */ if (rcap_type_required(capabilities, RCAP_TYPE_STMT_INPUT)) { - if (nbytes_read < 3 || nbytes_read < - (MYSQL_GET_PAYLOAD_LEN((uint8_t *) GWBUF_DATA(read_buffer)) + 4)) + uint8_t pktlen[MYSQL_HEADER_LEN]; + size_t n_copied = gwbuf_copy_data(read_buffer, 0, MYSQL_HEADER_LEN, pktlen); + + if (n_copied != sizeof(pktlen) || + nbytes_read < MYSQL_GET_PAYLOAD_LEN(pktlen) + MYSQL_HEADER_LEN) { - - dcb->dcb_readqueue = read_buffer; - + dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer); return 0; } gwbuf_set_type(read_buffer, GWBUF_TYPE_MYSQL); @@ -1624,50 +1625,3 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF return_rc: return rc; } - -/** - * if read queue existed appent read to it. if length of read buffer is less - * than 3 or less than mysql packet then return. else copy mysql packets to - * separate buffers from read buffer and continue. else if read queue didn't - * exist, length of read is less than 3 or less than mysql packet then - * create read queue and append to it and return. if length read is less than - * mysql packet length append to read queue append to it and return. - * else (complete packet was read) continue. - * - * @return True if we have a complete packet, otherwise false - */ -static bool ensure_complete_packet(DCB *dcb, GWBUF **read_buffer, int nbytes_read) -{ - if (dcb->dcb_readqueue) - { - dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, *read_buffer); - nbytes_read = gwbuf_length(dcb->dcb_readqueue); - int plen = MYSQL_GET_PAYLOAD_LEN((uint8_t *) GWBUF_DATA(dcb->dcb_readqueue)); - - if (nbytes_read < 3 || nbytes_read < plen + 4) - { - return false; - } - else - { - /** - * There is at least one complete mysql packet in - * read_buffer. - */ - *read_buffer = dcb->dcb_readqueue; - dcb->dcb_readqueue = NULL; - } - } - else - { - uint8_t* data = (uint8_t *) GWBUF_DATA(*read_buffer); - - if (nbytes_read < 3 || nbytes_read < MYSQL_GET_PAYLOAD_LEN(data) + 4) - { - dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, *read_buffer); - return false; - } - } - - return true; -} From 55f6930e5f9f168c189f1ce5b8fd4a72262f33c6 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Tue, 5 Dec 2017 11:19:17 +0100 Subject: [PATCH 29/46] MXS-1530: documentation update MXS-1530: documentation update for send_slave_heartbeat and new binlog events in 10.2 --- .../Replication-Proxy-Binlog-Router-Tutorial.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md b/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md index f89c716b1..5aaef9552 100644 --- a/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md +++ b/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md @@ -372,6 +372,11 @@ Examples with SSL options: Binlog Router Plugin is compatible with MariaDB 5.5, 10.0, 10.1 and 10.2 as well as MySQL 5.6 and 5.7. +Note: When using MariaDB 10.2 or MySQL 5.7 the `send_slave_heartbeat` option +must be set to On as the slave servers request the hearbeat to MaxScale. +As an alternative use `CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=0` in +the slave server in order to disable the heartbeat request. + ## Enabling MariaDB 10 compatibility MariaDB 10 has different slave registration phase so an extra option is required: @@ -396,6 +401,11 @@ with MySQL 5.7 slaves the `send_slave_heartbeat` option must be set to on. Binlog Router currently does not work for MySQL 5.5 due to missing *@@global.binlog_checksum* variable. +## MariaDB Limitations +Starting from version 10.2 there are new replication events related +to binlog event compression: these new events are not supported yet. +Be sure that `log_bin_compress` is not set in any MariaDB 10.2 server. + # MariaDB MaxScale Replication Diagnostics The binlog router module of MariaDB MaxScale produces diagnostic output that can From e1d774f9b3f49e44a779d19c4989f36bb1345105 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Tue, 5 Dec 2017 13:22:40 +0200 Subject: [PATCH 30/46] fix set_env.sh --- maxscale-system-test/mdbci/set_env.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maxscale-system-test/mdbci/set_env.sh b/maxscale-system-test/mdbci/set_env.sh index 732d15ba9..bc113dc23 100644 --- a/maxscale-system-test/mdbci/set_env.sh +++ b/maxscale-system-test/mdbci/set_env.sh @@ -1,8 +1,10 @@ +#!/bin/bash set -x echo $* export MDBCI_VM_PATH=${MDBCI_VM_PATH:-$HOME/vms} export mdbci_dir=${mdbci_dir:-"$HOME/mdbci/"} -export script_dir="$(dirname $(readlink -f $0))" +export script_dir="$(dirname `readlink -f -- $0`)" + export config_name="$1" if [ -z $1 ] ; then From 50ae8b38264e917f1e6231ccff58c18a2250da1a Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Tue, 5 Dec 2017 15:07:58 +0200 Subject: [PATCH 31/46] remove scrit_dir definition from set_env.sh --- maxscale-system-test/mdbci/set_env.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/maxscale-system-test/mdbci/set_env.sh b/maxscale-system-test/mdbci/set_env.sh index bc113dc23..37a12d799 100644 --- a/maxscale-system-test/mdbci/set_env.sh +++ b/maxscale-system-test/mdbci/set_env.sh @@ -3,8 +3,6 @@ set -x echo $* export MDBCI_VM_PATH=${MDBCI_VM_PATH:-$HOME/vms} export mdbci_dir=${mdbci_dir:-"$HOME/mdbci/"} -export script_dir="$(dirname `readlink -f -- $0`)" - export config_name="$1" if [ -z $1 ] ; then From 8ddd16186e5c7ef7b4ad7e033a5a55c45ec2d575 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 2 Nov 2017 11:51:32 +0200 Subject: [PATCH 32/46] Add .gitignore to maxscale-system-test --- maxscale-system-test/.gitignore | 196 ++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 maxscale-system-test/.gitignore diff --git a/maxscale-system-test/.gitignore b/maxscale-system-test/.gitignore new file mode 100644 index 000000000..78424a324 --- /dev/null +++ b/maxscale-system-test/.gitignore @@ -0,0 +1,196 @@ +CMakeCache.txt +CTestTestfile.cmake +DartConfiguration.tcl +avro +avro_alter +avro_long +backend_auth_fail +bin/ +binary_ps +binary_ps_cursor +binlog_big_transaction +binlog_change_master +binlog_change_master_gtid +binlog_incompl +binlog_semisync +bug143 +bug422 +bug448 +bug469 +bug471 +bug473 +bug475 +bug488 +bug507 +bug509 +bug519 +bug529 +bug547 +bug565 +bug571 +bug572 +bug587 +bug592 +bug601 +bug620 +bug626 +bug634 +bug643 +bug645 +bug645_1 +bug649 +bug650 +bug653 +bug654 +bug657 +bug658 +bug662 +bug664 +bug670 +bug673 +bug676 +bug681 +bug694 +bug699 +bug705 +bug711 +bug729 +bug730 +bulk_insert +ccrfilter +cdc_client +cdc_connector-prefix/ +cdc_connector/include/ +cdc_datatypes/CTestTestfile.cmake +cdc_datatypes/cdc_datatypes +cdc_datatypes/cmake_install.cmake +cdc_datatypes/templates +change_master_during_session +change_user +check_backend +cmake_install.cmake +config_test +connect_to_nonexisting_db +connection_limit +connector-c-prefix/ +crash_out_of_files +crash_out_of_files_galera +create_rds +delete_rds +different_size_binlog +different_size_rwsplit +encrypted_passwords +failover_mysqlmon +false_monitor_state_change +fwf +fwf_actions +fwf_com_ping +fwf_duplicate_rules +fwf_logging +fwf_prepared_stmt +fwf_reload +fwf_syntax +galera_priority +include/ +kerberos_setup +kill_master +large_insert_hang +load_balancing +load_balancing_galera +long_sysbench +longblob +lots_of_rows +max_connections +maxscale_process_user +mm +mm_mysqlmon +mxs1045 +mxs1071_maxrows +mxs1110_16mb +mxs1123 +mxs118 +mxs127 +mxs1295_sp_call +mxs1310_implicit_db +mxs1319 +mxs1323_retry_read +mxs1323_stress +mxs1418 +mxs1451_skip_auth +mxs1457_ignore_deleted +mxs1468 +mxs244_prepared_stmt_loop +mxs280_select_outfile +mxs314 +mxs321 +mxs365 +mxs37_table_privilege +mxs431 +mxs47 +mxs501_tee_usedb +mxs548_short_session_change_user +mxs559_block_master +mxs564_big_dump +mxs621_unreadable_cnf +mxs657_restart +mxs657_restart_service +mxs682_cyrillic +mxs716 +mxs722 +mxs729_maxadmin +mxs781_binlog_wrong_passwrd +mxs812_1 +mxs812_2 +mxs813_long_hostname +mxs822_maxpasswd +mxs827_write_timeout +mxs874_slave_recovery +mxs922_bad_server +mxs922_double_listener +mxs922_listener_ssl +mxs922_monitor +mxs922_restart +mxs922_scaling +mxs922_server +mxs951_utfmb4 +mxs957 +namedserverfilter +no_password +non_native_setup +open_close_connections +pers_01 +pers_02 +prepared_statement +readconnrouter_master +readconnrouter_slave +regexfilter1 +replication_manager +rw_select_insert +rwsplit_conn_num +rwsplit_connect +rwsplit_multi_stmt +rwsplit_read_only_trx +rwsplit_readonly +rwsplit_readonly_stress +schemarouter_duplicate_db +script +server_weight +ses_bigmem +session_limits +setup_binlog +setup_binlog_gtid +sharding +sharding_load_data +short_sessions +show_monitor_crash +slave_failover +sql_queries +stale_slaves +sysbench_example +sysbench_kill_slave +t +templates +templates.h +temporal_tables +test_hints +test_maxctrl From a6a37969e90ba88190c83a6a1df3d6e1ae09568a Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Thu, 7 Dec 2017 11:57:11 +0200 Subject: [PATCH 33/46] fix condition for named test (#146) --- maxscale-system-test/mdbci/revert_snapshot.sh | 5 ----- maxscale-system-test/mdbci/run_test.sh | 2 +- maxscale-system-test/mdbci/set_env.sh | 4 ++-- maxscale-system-test/mdbci/take_snapshot.sh | 5 ----- 4 files changed, 3 insertions(+), 13 deletions(-) delete mode 100755 maxscale-system-test/mdbci/revert_snapshot.sh delete mode 100755 maxscale-system-test/mdbci/take_snapshot.sh diff --git a/maxscale-system-test/mdbci/revert_snapshot.sh b/maxscale-system-test/mdbci/revert_snapshot.sh deleted file mode 100755 index 360bfdab7..000000000 --- a/maxscale-system-test/mdbci/revert_snapshot.sh +++ /dev/null @@ -1,5 +0,0 @@ -export curr_dir=`pwd` -cd $HOME/mdbci -$HOME/mdbci/mdbci snapshot revert --path-to-nodes $1 --snapshot-name $2 -cd $curr_dir - diff --git a/maxscale-system-test/mdbci/run_test.sh b/maxscale-system-test/mdbci/run_test.sh index 4def80585..b9ad13364 100755 --- a/maxscale-system-test/mdbci/run_test.sh +++ b/maxscale-system-test/mdbci/run_test.sh @@ -70,7 +70,7 @@ if [ $res == 0 ] ; then . ${script_dir}/configure_backend.sh ${mdbci_dir}/mdbci snapshot take --path-to-nodes $name --snapshot-name clean - if [ -z "${named_test}" ] ; then + if [ ! -z "${named_test}" ] ; then ./${named_test} else ./check_backend diff --git a/maxscale-system-test/mdbci/set_env.sh b/maxscale-system-test/mdbci/set_env.sh index 37a12d799..1fb25a35e 100644 --- a/maxscale-system-test/mdbci/set_env.sh +++ b/maxscale-system-test/mdbci/set_env.sh @@ -90,8 +90,8 @@ export sysbench_dir=${sysbench_dir:-"$HOME/sysbench_deb7/sysbench/"} export ssl=true -export take_snapshot_command="${script_dir}/take_snapshot.sh $config_name" -export revert_snapshot_command="${script_dir}/revert_snapshot.sh $config_name" +export take_snapshot_command="${mdbci_dir}/mdbci snapshot take --path-to-nodes $name --snapshot-name " +export revert_snapshot_command="${mdbci_dir}/mdbci snapshot revert --path-to-nodes $name --snapshot-name " #export use_snapshots=yes set +x diff --git a/maxscale-system-test/mdbci/take_snapshot.sh b/maxscale-system-test/mdbci/take_snapshot.sh deleted file mode 100755 index 4f8cf002b..000000000 --- a/maxscale-system-test/mdbci/take_snapshot.sh +++ /dev/null @@ -1,5 +0,0 @@ -export curr_dir=`pwd` -cd $HOME/mdbci -$HOME/mdbci/mdbci snapshot take --path-to-nodes $1 --snapshot-name $2 -cd $curr_dir - From 7a6d00e8077aae06e72fb22b2027cc1526c1ee37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 4 Dec 2017 16:07:50 +0200 Subject: [PATCH 34/46] Cherry-pick test fixes from 2.2 This is a partial cherry-pick of 9f11fdd2c122c9b30548c7ab55df8dda643ec659. Use larger BLOB type for mxs812_1, the inserted value exceeds the normal BLOB size. Add a baseline check into bulk_insert to verify that direct connections work (at the moment they don't, needs an investigation). Modified avro_alter to prevent data type conversion errors. --- maxscale-system-test/avro_alter.cpp | 10 +++++++++- maxscale-system-test/bulk_insert.cpp | 5 +++++ maxscale-system-test/mxs812_1.cpp | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/maxscale-system-test/avro_alter.cpp b/maxscale-system-test/avro_alter.cpp index 2ee641875..80f9afd1a 100644 --- a/maxscale-system-test/avro_alter.cpp +++ b/maxscale-system-test/avro_alter.cpp @@ -23,17 +23,23 @@ int main(int argc, char *argv[]) test.set_timeout(120); test.repl->connect(); + // Execute two events for each version of the schema execute_query_silent(test.repl->nodes[0], "DROP TABLE test.t1"); execute_query(test.repl->nodes[0], "CREATE TABLE test.t1(id INT)"); execute_query(test.repl->nodes[0], "INSERT INTO test.t1 VALUES (1)"); + execute_query(test.repl->nodes[0], "DELETE FROM test.t1"); execute_query(test.repl->nodes[0], "ALTER TABLE test.t1 ADD COLUMN a VARCHAR(100)"); execute_query(test.repl->nodes[0], "INSERT INTO test.t1 VALUES (2, \"a\")"); + execute_query(test.repl->nodes[0], "DELETE FROM test.t1"); execute_query(test.repl->nodes[0], "ALTER TABLE test.t1 ADD COLUMN b FLOAT"); execute_query(test.repl->nodes[0], "INSERT INTO test.t1 VALUES (3, \"b\", 3.0)"); + execute_query(test.repl->nodes[0], "DELETE FROM test.t1"); execute_query(test.repl->nodes[0], "ALTER TABLE test.t1 CHANGE COLUMN b c DATETIME(3)"); execute_query(test.repl->nodes[0], "INSERT INTO test.t1 VALUES (4, \"c\", NOW())"); + execute_query(test.repl->nodes[0], "DELETE FROM test.t1"); execute_query(test.repl->nodes[0], "ALTER TABLE test.t1 DROP COLUMN c"); execute_query(test.repl->nodes[0], "INSERT INTO test.t1 VALUES (5, \"d\")"); + execute_query(test.repl->nodes[0], "DELETE FROM test.t1"); test.repl->close_connections(); @@ -61,7 +67,9 @@ int main(int argc, char *argv[]) nrows++; } - test.add_result(nrows != 1, "Expected 1 line in file number %d, got %d: %s", i, nrows, rows); + // The number of changes that are present in each version of the schema + const int nchanges = 2; + test.add_result(nrows != nchanges, "Expected %d line in file number %d, got %d: %s", nchanges, i, nrows, rows); free(rows); } diff --git a/maxscale-system-test/bulk_insert.cpp b/maxscale-system-test/bulk_insert.cpp index 9e3595e54..d5202551f 100644 --- a/maxscale-system-test/bulk_insert.cpp +++ b/maxscale-system-test/bulk_insert.cpp @@ -203,12 +203,17 @@ int main(int argc, char** argv) TestConnections::require_repl_version("10.2"); TestConnections test(argc, argv); test.connect_maxscale(); + test.repl->connect(); + test.tprintf("Testing column-wise binding with a direct connection"); + test.add_result(bind_by_column(test.repl->nodes[0]), "Bulk inserts with a direct connection should work"); test.tprintf("Testing column-wise binding with readwritesplit"); test.add_result(bind_by_column(test.conn_rwsplit), "Bulk inserts with readwritesplit should work"); test.tprintf("Testing column-wise binding with readconnroute"); test.add_result(bind_by_column(test.conn_master), "Bulk inserts with readconnroute should work"); + test.tprintf("Testing row-wise binding with a direct connection"); + test.add_result(bind_by_row(test.repl->nodes[0]), "Bulk inserts with a direct connection should work"); test.tprintf("Testing row-wise binding with readwritesplit"); test.add_result(bind_by_row(test.conn_rwsplit), "Bulk inserts with readwritesplit should work"); test.tprintf("Testing row-wise binding with readconnroute"); diff --git a/maxscale-system-test/mxs812_1.cpp b/maxscale-system-test/mxs812_1.cpp index 5f7ad1015..d1d564f6d 100644 --- a/maxscale-system-test/mxs812_1.cpp +++ b/maxscale-system-test/mxs812_1.cpp @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) /** Create test table */ Test->repl->connect(); Test->try_query(Test->repl->nodes[0], (char*)"DROP TABLE IF EXISTS long_blob_table"); - Test->try_query(Test->repl->nodes[0], (char*)"CREATE TABLE long_blob_table(x INT, b BLOB)"); + Test->try_query(Test->repl->nodes[0], (char*)"CREATE TABLE long_blob_table(x INT, b LONGBLOB)"); Test->connect_maxscale(); Test->tprintf("Starting test"); From 8ed1ff67c2d178d9db710da7cc97c62fe46f4b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 6 Dec 2017 16:48:15 +0200 Subject: [PATCH 35/46] Fix avro regression The fact whether a query explicitly defined a query was ignored by the statement parsing function and it always assumed the database was explicitly defined. This caused the TABLE keyword in a CREATE TABLE statement to be falsely identified as the current database. --- .../modules/routing/avrorouter/avro_schema.c | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/server/modules/routing/avrorouter/avro_schema.c b/server/modules/routing/avrorouter/avro_schema.c index 9949c9ebe..2d8199802 100644 --- a/server/modules/routing/avrorouter/avro_schema.c +++ b/server/modules/routing/avrorouter/avro_schema.c @@ -403,10 +403,12 @@ static bool get_table_name(const char* sql, char* dest) /** * Extract the database name from a CREATE TABLE statement + * * @param sql SQL statement * @param dest Destination where the database name is extracted. Must be at least - * MYSQL_DATABASE_MAXLEN bytes long. - * @return True if extraction was successful + * MYSQL_DATABASE_MAXLEN bytes long. + * + * @return True if a database name was extracted */ static bool get_database_name(const char* sql, char* dest) { @@ -426,22 +428,27 @@ static bool get_database_name(const char* sql, char* dest) ptr--; } - while (*ptr == '`' || *ptr == '.' || isspace(*ptr)) + if (*ptr == '.') { - ptr--; + // The query defines an explicit database + + while (*ptr == '`' || *ptr == '.' || isspace(*ptr)) + { + ptr--; + } + + const char* end = ptr + 1; + + while (*ptr != '`' && *ptr != '.' && !isspace(*ptr)) + { + ptr--; + } + + ptr++; + memcpy(dest, ptr, end - ptr); + dest[end - ptr] = '\0'; + rval = true; } - - const char* end = ptr + 1; - - while (*ptr != '`' && *ptr != '.' && !isspace(*ptr)) - { - ptr--; - } - - ptr++; - memcpy(dest, ptr, end - ptr); - dest[end - ptr] = '\0'; - rval = true; } return rval; @@ -717,13 +724,15 @@ TABLE_CREATE* table_create_alloc(const char* sql, int len, const char* db) { err = "table name"; } - /** The CREATE statement contains the database name */ + if (get_database_name(sql, database)) { + // The CREATE statement contains the database name db = database; } else if (*db == '\0') { + // No explicit or current database err = "database name"; } From ca458cdce88c7b9749cfd25d8475e9cc1709a187 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 7 Dec 2017 14:59:33 +0200 Subject: [PATCH 36/46] Update bug-list --- Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md index 4bab84120..3c91b9b71 100644 --- a/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.1.12-Release-Notes.md @@ -36,6 +36,7 @@ where only parameters are used with the binlogrouter. [Here is a list of bugs fixed in MaxScale 2.1.12.](https://jira.mariadb.org/issues/?jql=project%20%3D%20MXS%20AND%20issuetype%20%3D%20Bug%20AND%20status%20%3D%20Closed%20AND%20fixVersion%20%3D%202.1.12) +* [MXS-1555](https://jira.mariadb.org/browse/MXS-1555) Protocol command tracking doesn't work with readwritesplit * [MXS-1553](https://jira.mariadb.org/browse/MXS-1553) GaleraMon ignores server's SSL configuration * [MXS-1540](https://jira.mariadb.org/browse/MXS-1540) Race conditions in Galeramon server parameter handling * [MXS-1536](https://jira.mariadb.org/browse/MXS-1536) Fatal: MaxScale 2.1.10 received fatal signal 11. Attempting backtrace. Commit ID: 96c3f0dda3b5a9640c4995f46ac8efec77686269 System name: Linux Release string: NAME=CentOS Linux From 0ba7bdca81d8132fff28001ae1d425fa21d3bc27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 8 Dec 2017 10:39:49 +0200 Subject: [PATCH 37/46] Update connector-c to 3.0.2 for tests Updated connector to same version that is used in MaxScale. --- maxscale-system-test/utilities.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maxscale-system-test/utilities.cmake b/maxscale-system-test/utilities.cmake index 27deb9f16..a657c87a7 100644 --- a/maxscale-system-test/utilities.cmake +++ b/maxscale-system-test/utilities.cmake @@ -91,7 +91,7 @@ add_test_executable_notest(sysbench_example.cpp sysbench_example replication) # Build the MariaDB Connector/C 3.0 -set(CONNECTOR_C_VERSION "3.0" CACHE STRING "The Connector-C version to use") +set(CONNECTOR_C_VERSION "v3.0.2" CACHE STRING "The Connector-C version to use") include(ExternalProject) ExternalProject_Add(connector-c From 821d21dafb81033f925c38c25edf32a35eb294ab Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Mon, 11 Dec 2017 12:17:13 +0200 Subject: [PATCH 38/46] remove unnecessary 'cd' in run_test_snapsht (#148) remove unnecessary 'cd' in run_test_snapshot --- maxscale-system-test/mdbci/run_test_snapshot.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/maxscale-system-test/mdbci/run_test_snapshot.sh b/maxscale-system-test/mdbci/run_test_snapshot.sh index d12df309a..77d319121 100755 --- a/maxscale-system-test/mdbci/run_test_snapshot.sh +++ b/maxscale-system-test/mdbci/run_test_snapshot.sh @@ -83,7 +83,6 @@ checkExitStatus $? "Failed to check backends" $snapshot_lock_file ctest $test_set -VV -D Nightly -cd $dir ${script_dir}/copy_logs.sh # Removing snapshot_lock From 6803ca2efccd9613da45e3de528b54799201589c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Dec 2017 10:41:02 +0200 Subject: [PATCH 39/46] Fix crash in mxs361 The test crashed as it used the wrong result set field. --- maxscale-system-test/mariadb_nodes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maxscale-system-test/mariadb_nodes.cpp b/maxscale-system-test/mariadb_nodes.cpp index ad66452b0..6b675b214 100644 --- a/maxscale-system-test/mariadb_nodes.cpp +++ b/maxscale-system-test/mariadb_nodes.cpp @@ -1310,7 +1310,7 @@ static void wait_until_pos(MYSQL *mysql, int filenum, int pos) { MYSQL_ROW row = mysql_fetch_row(res); - if (row && row[6] && row[21]) + if (row && row[5] && strchr(row[5], '.') && row[21]) { char *file_suffix = strchr(row[5], '.') + 1; slave_filenum = atoi(file_suffix); From 357eb67a841426fcf6dd6aa2855eccecf9953501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Dec 2017 10:48:15 +0200 Subject: [PATCH 40/46] Add missing configuration file for mxs1509 The test configuration file was not added to git. --- .../cnf/maxscale.cnf.template.mxs1509 | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 maxscale-system-test/cnf/maxscale.cnf.template.mxs1509 diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs1509 b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1509 new file mode 100644 index 000000000..c839b0dad --- /dev/null +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1509 @@ -0,0 +1,45 @@ +[maxscale] +threads=###threads### + +[MySQL Monitor] +type=monitor +module=mysqlmon +servers=server1,server2 +user=maxskysql +passwd=skysql +monitor_interval=1000 + +[RW Split Router] +type=service +router=readwritesplit +servers=server1,server2 +user=maxskysql +passwd=skysql + +[RW Split Listener] +type=listener +service=RW Split Router +protocol=MySQLClient +port=4006 + +[CLI] +type=service +router=cli + +[CLI Listener] +type=listener +service=CLI +protocol=maxscaled +socket=default + +[server1] +type=server +address=###node_server_IP_1### +port=###node_server_port_1### +protocol=MySQLBackend + +[server2] +type=server +address=###node_server_IP_2### +port=###node_server_port_2### +protocol=MySQLBackend From 66be882ae04d2a984f4c9d11684def632f1330c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Dec 2017 11:33:50 +0200 Subject: [PATCH 41/46] Don't reload users for dummy sessions The service for a dummy session will be NULL. If authentication fails for a dummy session, then no service level actions should be taken. Only the binlogrouter can trigger authentication failure with a dummy session as it creates connections before the service itself has started. --- server/core/service.c | 1 + server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/core/service.c b/server/core/service.c index d44805132..da1053402 100644 --- a/server/core/service.c +++ b/server/core/service.c @@ -1606,6 +1606,7 @@ service_update(SERVICE *service, char *router, char *user, char *auth) */ int service_refresh_users(SERVICE *service) { + ss_dassert(service); int ret = 1; if (spinlock_acquire_nowait(&service->spin)) diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index e03761cf7..9d70cc3e3 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -358,8 +358,11 @@ static void handle_error_response(DCB *dcb, GWBUF *buffer) errcode == ER_DBACCESS_DENIED_ERROR || errcode == ER_ACCESS_DENIED_NO_PASSWORD_ERROR) { - // Authentication failed, reload users - service_refresh_users(dcb->service); + if (dcb->session->state != SESSION_STATE_DUMMY) + { + // Authentication failed, reload users + service_refresh_users(dcb->service); + } } } From 257112dc27a41f7fcaadd093880f1580e6bd561b Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Mon, 11 Dec 2017 15:16:33 +0200 Subject: [PATCH 42/46] swithch to maxscale-system-test dir in the proper way before running test --- maxscale-system-test/mdbci/run_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maxscale-system-test/mdbci/run_test.sh b/maxscale-system-test/mdbci/run_test.sh index b9ad13364..eb0f32c73 100755 --- a/maxscale-system-test/mdbci/run_test.sh +++ b/maxscale-system-test/mdbci/run_test.sh @@ -58,7 +58,7 @@ export name=`echo $name | sed "s/?//g"` . ${script_dir}/configure_log_dir.sh -cd maxscale-system-test +cd ${script_dir}/.. cmake . -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug make From 6b05d07c795d79f65ebf9e906256be89f5def4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Dec 2017 22:12:35 +0200 Subject: [PATCH 43/46] Update mxs431 Removed excessive output, tuned timeouts and removed unnecessary heap allocation of TestConnections. --- maxscale-system-test/mxs431.cpp | 68 ++++++++++++++------------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/maxscale-system-test/mxs431.cpp b/maxscale-system-test/mxs431.cpp index 708f95ea5..787d416ea 100644 --- a/maxscale-system-test/mxs431.cpp +++ b/maxscale-system-test/mxs431.cpp @@ -5,62 +5,52 @@ * - Connect repeatedly to MaxScale with 'testdb' as the default database and execute SELECT 1 */ - -#include #include "testconnections.h" -using namespace std; - int main(int argc, char *argv[]) { - TestConnections * Test = new TestConnections(argc, argv); + TestConnections test(argc, argv); char str[256]; - int iterations = Test->smoke ? 100 : 500; - Test->repl->execute_query_all_nodes((char *) "set global max_connections = 600;"); - Test->set_timeout(30); - Test->repl->stop_slaves(); - Test->set_timeout(30); - Test->restart_maxscale(); - Test->set_timeout(30); - Test->repl->connect(); - Test->stop_timeout(); + int iterations = 100; + test.repl->execute_query_all_nodes((char *) "set global max_connections = 600;"); + test.set_timeout(30); + test.repl->stop_slaves(); + test.set_timeout(30); + test.restart_maxscale(); + test.set_timeout(30); + test.repl->connect(); + test.stop_timeout(); /** Create a database on each node */ - for (int i = 0; i < Test->repl->N; i++) + for (int i = 0; i < test.repl->N; i++) { - Test->set_timeout(20); + test.set_timeout(20); sprintf(str, "DROP DATABASE IF EXISTS shard_db%d", i); - Test->tprintf("%s\n", str); - execute_query(Test->repl->nodes[i], str); - Test->set_timeout(20); + test.tprintf("%s\n", str); + execute_query(test.repl->nodes[i], str); + test.set_timeout(20); sprintf(str, "CREATE DATABASE shard_db%d", i); - Test->tprintf("%s\n", str); - execute_query(Test->repl->nodes[i], str); - Test->stop_timeout(); + test.tprintf("%s\n", str); + execute_query(test.repl->nodes[i], str); + test.stop_timeout(); } - Test->repl->close_connections(); + test.repl->close_connections(); - for (int j = 0; j < iterations && Test->global_result == 0; j++) + for (int j = 0; j < iterations && test.global_result == 0; j++) { - for (int i = 0; i < Test->repl->N; i++) + for (int i = 0; i < test.repl->N && test.global_result == 0; i++) { sprintf(str, "shard_db%d", i); - Test->set_timeout(15); - MYSQL *conn = open_conn_db(Test->rwsplit_port, Test->maxscale_IP, - str, Test->maxscale_user, - Test->maxscale_password, Test->ssl); - Test->set_timeout(15); - Test->tprintf("Trying DB %d\n", i); - if (execute_query(conn, "SELECT 1")) - { - Test->add_result(1, "Failed at %d\n", j); - break; - } + test.set_timeout(30); + MYSQL *conn = open_conn_db(test.rwsplit_port, test.maxscale_IP, + str, test.maxscale_user, + test.maxscale_password, test.ssl); + test.set_timeout(30); + test.add_result(execute_query(conn, "SELECT 1"), "Trying DB %d failed at %d", i, j); mysql_close(conn); } } - int rval = Test->global_result; - delete Test; - return rval; + + return test.global_result; } From 4b9bb9e65f29f75a804edbcf0884f51d06c256ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Dec 2017 22:37:35 +0200 Subject: [PATCH 44/46] Assign service pointer in BLR DCBs The DCBs that were manually allocated by the binlogrouter were not assigned the service pointers. --- server/modules/routing/binlogrouter/blr_master.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/modules/routing/binlogrouter/blr_master.c b/server/modules/routing/binlogrouter/blr_master.c index 8ab9fa7d6..ae9bbae6a 100644 --- a/server/modules/routing/binlogrouter/blr_master.c +++ b/server/modules/routing/binlogrouter/blr_master.c @@ -182,6 +182,7 @@ blr_start_master(void* data) return; } client->session = router->session; + client->service = router->service; if ((router->master = dcb_connect(router->service->dbref->server, router->session, BLR_PROTOCOL)) == NULL) { char *name = MXS_MALLOC(strlen(router->service->name) + strlen(" Master") + 1); @@ -202,6 +203,7 @@ blr_start_master(void* data) return; } router->master->remote = MXS_STRDUP_A(router->service->dbref->server->name); + router->master->service = router->service; MXS_NOTICE("%s: attempting to connect to master server [%s]:%d, binlog %s, pos %lu", router->service->name, router->service->dbref->server->name, From 757ab3fd476c4e55cea38a5b2b71b3bfc4cbe933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 12 Dec 2017 08:53:19 +0200 Subject: [PATCH 45/46] Increase mxs431 timeouts The first timeouts don't appear to relate to the actual test but to preparing it. Due to this, they can be increased by a great amount. --- maxscale-system-test/mxs431.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maxscale-system-test/mxs431.cpp b/maxscale-system-test/mxs431.cpp index 787d416ea..15e9d00c8 100644 --- a/maxscale-system-test/mxs431.cpp +++ b/maxscale-system-test/mxs431.cpp @@ -13,11 +13,11 @@ int main(int argc, char *argv[]) char str[256]; int iterations = 100; test.repl->execute_query_all_nodes((char *) "set global max_connections = 600;"); - test.set_timeout(30); + test.set_timeout(200); test.repl->stop_slaves(); - test.set_timeout(30); + test.set_timeout(200); test.restart_maxscale(); - test.set_timeout(30); + test.set_timeout(200); test.repl->connect(); test.stop_timeout(); From 7ebd487ef35c6f665f55206da39736a176a81fc0 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Tue, 12 Dec 2017 00:27:34 +0200 Subject: [PATCH 46/46] change cnfs for binlog tests --- maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog | 4 ++-- .../cnf/maxscale.cnf.template.setup_binlog.in | 4 ++-- maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog1 | 4 ++-- maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog2 | 4 ++-- .../cnf/maxscale.cnf.template.setup_binlog_semisync | 4 ++-- .../cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss0 | 4 ++-- .../cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss1 | 4 ++-- .../cnf/maxscale.cnf.template.setup_binlog_semisync_txs1_ss0 | 4 ++-- .../cnf/maxscale.cnf.template.setup_binlog_tx_safe | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog index c85f33b95..81985d120 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog +++ b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog @@ -7,9 +7,9 @@ type=service router=binlogrouter user=skysql passwd=skysql -version_string=5.6.15-log +#version_string=5.6.15-log #router_options=server-id=3,user=repl,password=repl,master-id=1 -router_options=server-id=3,user=repl,password=repl,longburst=500,heartbeat=30,binlogdir=/var/lib/maxscale/Binlog_Service,mariadb10-compatibility=1 +router_options=server-id=9993,send_slave_heartbeat=On,user=repl,password=repl,longburst=500,heartbeat=10,binlogdir=/var/lib/maxscale/Binlog_Service,mariadb10-compatibility=1 [Binlog Listener] diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog.in b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog.in index c85f33b95..81985d120 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog.in +++ b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog.in @@ -7,9 +7,9 @@ type=service router=binlogrouter user=skysql passwd=skysql -version_string=5.6.15-log +#version_string=5.6.15-log #router_options=server-id=3,user=repl,password=repl,master-id=1 -router_options=server-id=3,user=repl,password=repl,longburst=500,heartbeat=30,binlogdir=/var/lib/maxscale/Binlog_Service,mariadb10-compatibility=1 +router_options=server-id=9993,send_slave_heartbeat=On,user=repl,password=repl,longburst=500,heartbeat=10,binlogdir=/var/lib/maxscale/Binlog_Service,mariadb10-compatibility=1 [Binlog Listener] diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog1 b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog1 index 473832a71..ee369a8f3 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog1 +++ b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog1 @@ -7,9 +7,9 @@ type=service router=binlogrouter user=skysql passwd=skysql -version_string=5.6.15-log +#version_string=5.6.15-log #router_options=server-id=3,user=repl,password=repl,master-id=1 -router_options=server-id=3,longburst=500,heartbeat=30,binlogdir=/var/lib/maxscale/Binlog_Service,mariadb10-compatibility=1 +router_options=server-id=9993,send_slave_heartbeat=On,longburst=500,heartbeat=10,binlogdir=/var/lib/maxscale/Binlog_Service,mariadb10-compatibility=1 diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog2 b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog2 index 2d41e8396..0d03663a3 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog2 +++ b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog2 @@ -8,9 +8,9 @@ type=service router=binlogrouter user=skysql passwd=skysql -version_string=5.6.15-log +#version_string=5.6.15-log #router_options=server-id=3,user=repl,password=repl,master-id=1 -router_options=server-id=3,user=repl,password=repl,longburst=500,heartbeat=30,binlogdir=/var/lib/maxscale/Binlog_Service,transaction_safety=1,mariadb10-compatibility=1 +router_options=server-id=9993,send_slave_heartbeat=On,user=repl,password=repl,longburst=500,heartbeat=10,binlogdir=/var/lib/maxscale/Binlog_Service,transaction_safety=1,mariadb10-compatibility=1 diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync index 4fb918415..76a8f6910 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync +++ b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync @@ -8,9 +8,9 @@ router=binlogrouter #servers=master user=skysql passwd=skysql -version_string=5.6.15-log +#version_string=5.6.15-log #router_options=server-id=3,user=repl,password=repl,master-id=1 -router_options=server-id=3,user=repl,password=repl,longburst=500,heartbeat=30,binlogdir=/var/lib/maxscale/Binlog_Service,semisync=1,transaction_safety=1,mariadb10-compatibility=1 +router_options=server-id=9993,send_slave_heartbeat=On,user=repl,password=repl,longburst=500,heartbeat=10,binlogdir=/var/lib/maxscale/Binlog_Service,semisync=1,transaction_safety=1,mariadb10-compatibility=1 diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss0 b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss0 index 13a459c20..4f55f4ec9 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss0 +++ b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss0 @@ -8,9 +8,9 @@ router=binlogrouter #servers=master user=skysql passwd=skysql -version_string=5.6.15-log +#version_string=5.6.15-log #router_options=server-id=3,user=repl,password=repl,master-id=1 -router_options=server-id=3,user=repl,password=repl,longburst=500,heartbeat=30,binlogdir=/var/lib/maxscale/Binlog_Service,semisync=0,transaction_safety=0,mariadb10-compatibility=1 +router_options=server-id=9993,send_slave_heartbeat=On,user=repl,password=repl,longburst=500,heartbeat=10,binlogdir=/var/lib/maxscale/Binlog_Service,semisync=0,transaction_safety=0,mariadb10-compatibility=1 diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss1 b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss1 index 93098385d..8c0267ddc 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss1 +++ b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs0_ss1 @@ -8,9 +8,9 @@ router=binlogrouter #servers=master user=skysql passwd=skysql -version_string=5.6.15-log +#version_string=5.6.15-log #router_options=server-id=3,user=repl,password=repl,master-id=1 -router_options=server-id=3,user=repl,password=repl,longburst=500,heartbeat=30,binlogdir=/var/lib/maxscale/Binlog_Service,semisync=1,transaction_safety=0,mariadb10-compatibility=1 +router_options=server-id=9993,send_slave_heartbeat=On,user=repl,password=repl,longburst=500,heartbeat=10,binlogdir=/var/lib/maxscale/Binlog_Service,semisync=1,transaction_safety=0,mariadb10-compatibility=1 diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs1_ss0 b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs1_ss0 index 8e78d9126..20f30f984 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs1_ss0 +++ b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_semisync_txs1_ss0 @@ -8,9 +8,9 @@ router=binlogrouter #servers=master user=skysql passwd=skysql -version_string=5.6.15-log +#version_string=5.6.15-log #router_options=server-id=3,user=repl,password=repl,master-id=1 -router_options=server-id=3,user=repl,password=repl,longburst=500,heartbeat=30,binlogdir=/var/lib/maxscale/Binlog_Service,semisync=0,transaction_safety=1,mariadb10-compatibility=1 +router_options=server-id=9993,send_slave_heartbeat=On,user=repl,password=repl,longburst=500,heartbeat=10,binlogdir=/var/lib/maxscale/Binlog_Service,semisync=0,transaction_safety=1,mariadb10-compatibility=1 diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_tx_safe b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_tx_safe index 33957920a..6a1078fc9 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_tx_safe +++ b/maxscale-system-test/cnf/maxscale.cnf.template.setup_binlog_tx_safe @@ -8,9 +8,9 @@ router=binlogrouter #servers=master user=skysql passwd=skysql -version_string=5.6.15-log +#version_string=5.6.15-log #router_options=server-id=3,user=repl,password=repl,master-id=1 -router_options=server-id=3,user=repl,password=repl,longburst=500,heartbeat=30,binlogdir=/var/lib/maxscale/Binlog_Service,transaction_safety=1,mariadb10-compatibility=1 +router_options=server-id=9993,send_slave_heartbeat=On,user=repl,password=repl,longburst=500,heartbeat=10,binlogdir=/var/lib/maxscale/Binlog_Service,transaction_safety=1,mariadb10-compatibility=1