From 35de0c392f400ccc4f260cdc756f1ad93788cdc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 1 May 2017 16:11:05 +0300 Subject: [PATCH 01/14] Only store established connections in the pool If a connection has not been fully established (i.e. authentication has been completed) then it should not be considered as a connection pool candidate. --- include/maxscale/protocol.h | 8 ++++++-- server/core/dcb.c | 1 + server/modules/protocol/CDC/cdc.c | 4 +++- server/modules/protocol/HTTPD/httpd.c | 3 ++- .../protocol/MySQL/MySQLBackend/mysql_backend.c | 13 +++++++++++-- .../protocol/MySQL/MySQLClient/mysql_client.c | 3 ++- server/modules/protocol/maxscaled/maxscaled.c | 3 ++- server/modules/protocol/telnetd/telnetd.c | 3 ++- 8 files changed, 29 insertions(+), 9 deletions(-) diff --git a/include/maxscale/protocol.h b/include/maxscale/protocol.h index 66adbcc88..249501829 100644 --- a/include/maxscale/protocol.h +++ b/include/maxscale/protocol.h @@ -43,7 +43,10 @@ struct session; * close MaxScale close entry point for the socket * listen Create a listener for the protocol * auth Authentication entry point - * session Session handling entry point + * session Session handling entry point + * auth_default Default authenticator name + * connlimit Maximum connection limit + * established Whether connection is fully established * @endverbatim * * This forms the "module object" for protocol modules within the gateway. @@ -62,9 +65,10 @@ typedef struct mxs_protocol int32_t (*close)(struct dcb *); int32_t (*listen)(struct dcb *, char *); int32_t (*auth)(struct dcb *, struct server *, struct session *, GWBUF *); - int32_t (*session)(struct dcb *, void *); + int32_t (*session)(struct dcb *, void *); // TODO: remove this, not used char *(*auth_default)(); int32_t (*connlimit)(struct dcb *, int limit); + bool (*established)(struct dcb *); } MXS_PROTOCOL; /** diff --git a/server/core/dcb.c b/server/core/dcb.c index e5d4c26c0..34b1cf3ec 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -1658,6 +1658,7 @@ static bool dcb_maybe_add_persistent(DCB *dcb) { if (dcb->user != NULL + && (dcb->func.established == NULL || dcb->func.established(dcb)) && strlen(dcb->user) && dcb->server && dcb->server->persistpoolmax diff --git a/server/modules/protocol/CDC/cdc.c b/server/modules/protocol/CDC/cdc.c index f98d617ae..763c39009 100644 --- a/server/modules/protocol/CDC/cdc.c +++ b/server/modules/protocol/CDC/cdc.c @@ -85,7 +85,9 @@ MXS_MODULE* MXS_CREATE_MODULE() cdc_listen, /* Create a listener */ NULL, /* Authentication */ NULL, /* Session */ - cdc_default_auth /* default authentication */ + cdc_default_auth, /* default authentication */ + NULL, + NULL, }; static MXS_MODULE info = diff --git a/server/modules/protocol/HTTPD/httpd.c b/server/modules/protocol/HTTPD/httpd.c index 2bea0c1ca..e021088b2 100644 --- a/server/modules/protocol/HTTPD/httpd.c +++ b/server/modules/protocol/HTTPD/httpd.c @@ -81,7 +81,8 @@ MXS_MODULE* MXS_CREATE_MODULE() NULL, /**< Authentication */ NULL, /**< Session */ httpd_default_auth, /**< Default authenticator */ - NULL /**< Connection limit reached */ + NULL, /**< Connection limit reached */ + NULL }; static MXS_MODULE info = diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index 6276cae0f..e3f116c5d 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -77,6 +77,7 @@ static int gw_send_change_user_to_backend(char *dbname, char *user, uint8_t *passwd, MySQLProtocol *conn); +static bool gw_connection_established(DCB* dcb); /* * The module entry point routine. It is this routine that @@ -102,7 +103,8 @@ MXS_MODULE* MXS_CREATE_MODULE() gw_change_user, /* Authentication */ NULL, /* Session */ gw_backend_default_auth, /* Default authenticator */ - NULL /* Connection limit reached */ + NULL, /* Connection limit reached */ + gw_connection_established }; static MXS_MODULE info = @@ -883,7 +885,8 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue) CHK_DCB(dcb); - if (dcb->was_persistent && dcb->state == DCB_STATE_POLLING) + if (dcb->was_persistent && dcb->state == DCB_STATE_POLLING && + backend_protocol->protocol_auth_state == MXS_AUTH_STATE_COMPLETE) { ss_dassert(dcb->persistentstart == 0); /** @@ -1949,3 +1952,9 @@ gw_send_change_user_to_backend(char *dbname, } return rc; } + +static bool gw_connection_established(DCB* dcb) +{ + MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol; + return proto->protocol_auth_state == MXS_AUTH_STATE_COMPLETE; +} diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c index 51cae36ad..e19fcc2d6 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c @@ -115,7 +115,8 @@ MXS_MODULE* MXS_CREATE_MODULE() NULL, /* Authentication */ NULL, /* Session */ gw_default_auth, /* Default authenticator */ - gw_connection_limit /* Send error connection limit */ + gw_connection_limit, /* Send error connection limit */ + NULL }; static MXS_MODULE info = diff --git a/server/modules/protocol/maxscaled/maxscaled.c b/server/modules/protocol/maxscaled/maxscaled.c index 895ab00df..9e2fe4391 100644 --- a/server/modules/protocol/maxscaled/maxscaled.c +++ b/server/modules/protocol/maxscaled/maxscaled.c @@ -185,7 +185,8 @@ MXS_MODULE* MXS_CREATE_MODULE() NULL, /**< Authentication */ NULL, /**< Session */ mxsd_default_auth, /**< Default authenticator */ - NULL /**< Connection limit reached */ + NULL, /**< Connection limit reached */ + NULL }; static MXS_MODULE info = diff --git a/server/modules/protocol/telnetd/telnetd.c b/server/modules/protocol/telnetd/telnetd.c index a28d76bbb..f5797a045 100644 --- a/server/modules/protocol/telnetd/telnetd.c +++ b/server/modules/protocol/telnetd/telnetd.c @@ -102,7 +102,8 @@ MXS_MODULE* MXS_CREATE_MODULE() NULL, /**< Authentication */ NULL, /**< Session */ telnetd_default_auth, /**< Default authenticator */ - NULL /**< Connection limit reached */ + NULL, /**< Connection limit reached */ + NULL }; static MXS_MODULE info = From 3cf92524f2cefbe27cc72a0850f9909edcac854f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 9 Aug 2017 09:47:08 +0300 Subject: [PATCH 02/14] Add XA transactions to limitations The lack of true XA transaction support in 2.1 is now documented in the limitations document. --- Documentation/About/Limitations.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Documentation/About/Limitations.md b/Documentation/About/Limitations.md index 286d2454b..4ba1be738 100644 --- a/Documentation/About/Limitations.md +++ b/Documentation/About/Limitations.md @@ -21,6 +21,35 @@ collect columns, functions and tables used in the `SELECT` defining the Consequently, the database firewall will **not** block `WITH` statements where the `SELECT` of the `WITH` clause refers to forbidden columns. +## Query Classification + +Follow the [MXS-1350](https://jira.mariadb.org/browse/MXS-1350) Jira issue +to track the progress on this limitation. + +XA transactions are not detected as transactions by MaxScale. This means +that all XA commands will be treated as unknown commands and will be +treated as operations that potentially modify the database (in the case of +readwritesplit, the statements are routed to the master). + +MaxScale **will not** track the XA transaction state which means that any +SELECT queries done inside an XA transaction can be routed to servers that +are not part of the XA transaction. + +This limitation can be avoided on the client side by disabling autocommit +before any XA transactions are done. The following example shows how a +simple XA transaction is done via MaxScale by disabling autocommit for the +duration of the XA transaction. + +``` +SET autocommit=0; +XA START 'MyXA'; +INSERT INTO test.t1 VALUES(1); +XA END 'MyXA'; +XA PREPARE 'MyXA'; +XA COMMIT 'MyXA'; +SET autocommit=1; +``` + ## Prepared Statements For its proper functioning, MaxScale needs in general to be aware of the From 238507d412ce9250c03f35df9b2277c372496d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 9 Aug 2017 10:11:57 +0300 Subject: [PATCH 03/14] Add script for generating the list of fixed bugs The script queries Jira for a CSV list which is transformed into a list of Markdown links. --- Documentation/list_fixed_bugs.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 Documentation/list_fixed_bugs.sh diff --git a/Documentation/list_fixed_bugs.sh b/Documentation/list_fixed_bugs.sh new file mode 100755 index 000000000..ac39dc1aa --- /dev/null +++ b/Documentation/list_fixed_bugs.sh @@ -0,0 +1,11 @@ +#!/bin/bash + + +if [ $# -ne 1 ] +then + echo "USAGE: $0 VERSION" + exit 1 +fi + +version=$1 +curl -s "https://jira.mariadb.org/sr/jira.issueviews:searchrequest-csv-current-fields/temp/SearchRequest.csv?jqlQuery=project+%3D+MXS+AND+issuetype+%3D+Bug+AND+status+%3D+Closed+AND+fixVersion+%3D+$version"|cut -f 1,2 -d ,|tail -n+2|sed 's/\(.*\),\(.*\)/* (\2)[https:\/\/jira.mariadb.org\/browse\/\2] \1/' From 5614e970c4060b1fe87d0f8bf30f96d2a126cd56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 9 Aug 2017 10:14:52 +0300 Subject: [PATCH 04/14] Add 2.1.6 release notes Added 2.1.6 release notes. --- .../MaxScale-2.1.6-Release-Notes.md | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md diff --git a/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md new file mode 100644 index 000000000..a13102810 --- /dev/null +++ b/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md @@ -0,0 +1,46 @@ +# MariaDB MaxScale 2.1.6 Release Notes + +Release 2.1.6 is a GA release. + +This document describes the changes in release 2.1.6, when compared to +release [2.1.5](MaxScale-2.1.5-Release-Notes.md). + +If you are upgrading from release 2.0, please also read the following +release notes: +[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). + +## Bug fixes + +[Here is a list of bugs fixed in MaxScale 2.1.6.](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.6) + +* [MXS-1352](https://jira.mariadb.org/browse/MXS-1352) Not all query failures in monitors are reported +* [MXS-1351](https://jira.mariadb.org/browse/MXS-1351) Partially authenticated connections are put into the connection pool +* [MXS-1338](https://jira.mariadb.org/browse/MXS-1338) Buffer objects are bound to indiviudual buffers + +## Known Issues and Limitations + +There are some limitations and known issues within this version of MaxScale. +For more information, please refer to the [Limitations](../About/Limitations.md) document. + +## 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 550899d909bb7ab05c928c9485b3db840e68a358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 9 Aug 2017 10:15:50 +0300 Subject: [PATCH 05/14] Remove outdated limitations The parsing limitations are no longer true. --- Documentation/About/Limitations.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Documentation/About/Limitations.md b/Documentation/About/Limitations.md index 4ba1be738..ce39d0cc3 100644 --- a/Documentation/About/Limitations.md +++ b/Documentation/About/Limitations.md @@ -188,12 +188,6 @@ this option for better performance. For more information, read the [ReadWriteSplit](../Routers/ReadWriteSplit.md) router documentation. -#### Parsing limitations - -Galera Cluster variables, such as `@@wsrep_node_name`, are not resolved by the -embedded MariaDB parser. This usually means that the query will be routed to the -master. - #### Limitations in client session handling Some of the queries that a client sends are routed to all backends instead of From 8607f4f2653c6d5c3e26294da0f307e9efcd256b Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 9 Aug 2017 10:58:10 +0300 Subject: [PATCH 06/14] Update version number for 2.1.6 --- VERSION21.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION21.cmake b/VERSION21.cmake index 56646f85c..c507fa2aa 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 "5" CACHE STRING "Patch version") +set(MAXSCALE_VERSION_PATCH "6" CACHE STRING "Patch version") # This should only be incremented if a package is rebuilt set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number") From e409927d6c68841218eeeee6d24149c5af562f95 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 9 Aug 2017 11:38:25 +0300 Subject: [PATCH 07/14] Update Changelog and Upgrading documents --- Documentation/Changelog.md | 1 + Documentation/Upgrading/Upgrading-To-MaxScale-2.1.md | 1 + 2 files changed, 2 insertions(+) diff --git a/Documentation/Changelog.md b/Documentation/Changelog.md index 84f55e6bc..7a33aeb63 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.6 Release Notes](Release-Notes/MaxScale-2.1.6-Release-Notes.md) * [MariaDB MaxScale 2.1.5 Release Notes](Release-Notes/MaxScale-2.1.5-Release-Notes.md) * [MariaDB MaxScale 2.1.4 Release Notes](Release-Notes/MaxScale-2.1.4-Release-Notes.md) * [MariaDB MaxScale 2.1.3 Release Notes](Release-Notes/MaxScale-2.1.3-Release-Notes.md) diff --git a/Documentation/Upgrading/Upgrading-To-MaxScale-2.1.md b/Documentation/Upgrading/Upgrading-To-MaxScale-2.1.md index a07949329..a55cefa03 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.6 Release Notes](../Release-Notes/MaxScale-2.1.6-Release-Notes.md). [MaxScale 2.1.5 Release Notes](../Release-Notes/MaxScale-2.1.5-Release-Notes.md). [MaxScale 2.1.4 Release Notes](../Release-Notes/MaxScale-2.1.4-Release-Notes.md). [MaxScale 2.1.3 Release Notes](../Release-Notes/MaxScale-2.1.3-Release-Notes.md). From 7da092843f6a59d7618a7db2783f622b02012d6f Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Wed, 9 Aug 2017 17:09:50 +0200 Subject: [PATCH 08/14] MXS-1343: send hostname to master with COM_REGISTER_SLAVE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A new option ‘slave_hostname’ allows the setting of hostname in COM_REGISTER_SLAVE. SHOW SLAVES HOSTS; in master server can show the hostname set in binlog router: MariaDB [(none)]> SHOW SLAVE HOSTS; +-----------+-----------------------------+------+-----------+ | Server_id | Host | Port | Master_id | +-----------+-----------------------------+------+-----------+ | 93 | maxscale-blr-1.mydomain.net | 8808 | 10124 | +-----------+-----------------------------+------+-----------+ --- server/modules/routing/binlogrouter/blr.c | 10 +++- server/modules/routing/binlogrouter/blr.h | 1 + .../modules/routing/binlogrouter/blr_master.c | 53 +++++++++++++++---- 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/server/modules/routing/binlogrouter/blr.c b/server/modules/routing/binlogrouter/blr.c index 7501972db..e9f1daf17 100644 --- a/server/modules/routing/binlogrouter/blr.c +++ b/server/modules/routing/binlogrouter/blr.c @@ -184,6 +184,7 @@ MXS_MODULE* MXS_CREATE_MODULE() {"master_uuid", MXS_MODULE_PARAM_STRING}, {"master_version", MXS_MODULE_PARAM_STRING}, {"master_hostname", MXS_MODULE_PARAM_STRING}, + {"slave_hostname", MXS_MODULE_PARAM_STRING}, {"mariadb10-compatibility", MXS_MODULE_PARAM_BOOL, "false"}, {"filestem", MXS_MODULE_PARAM_STRING, BINLOG_NAME_ROOT}, {"file", MXS_MODULE_PARAM_COUNT, "1"}, @@ -334,6 +335,7 @@ createInstance(SERVICE *service, char **options) inst->trx_safe = config_get_bool(params, "transaction_safety"); inst->set_master_version = config_copy_string(params, "master_version"); inst->set_master_hostname = config_copy_string(params, "master_hostname"); + inst->set_slave_hostname = config_copy_string(params, "slave_hostname"); inst->fileroot = config_copy_string(params, "filestem"); inst->serverid = config_get_integer(params, "server_id"); @@ -344,8 +346,6 @@ createInstance(SERVICE *service, char **options) inst->master_uuid = config_copy_string(params, "master_uuid"); inst->set_master_uuid = inst->master_uuid != NULL; - inst->set_master_version = NULL; - inst->set_master_hostname = NULL; inst->send_slave_heartbeat = config_get_bool(params, "send_slave_heartbeat"); /* Semi-Sync support */ @@ -482,6 +482,11 @@ createInstance(SERVICE *service, char **options) MXS_FREE(inst->set_master_hostname); inst->set_master_hostname = MXS_STRDUP_A(value); } + else if (strcmp(options[i], "slave_hostname") == 0) + { + MXS_FREE(inst->set_slave_hostname); + inst->set_slave_hostname = MXS_STRDUP_A(value); + } else if (strcmp(options[i], "mariadb10-compatibility") == 0) { inst->mariadb10_compat = config_truth_value(value); @@ -938,6 +943,7 @@ free_instance(ROUTER_INSTANCE *instance) MXS_FREE(instance->password); MXS_FREE(instance->set_master_version); MXS_FREE(instance->set_master_hostname); + MXS_FREE(instance->set_slave_hostname); MXS_FREE(instance->fileroot); MXS_FREE(instance->binlogdir); /* SSL options */ diff --git a/server/modules/routing/binlogrouter/blr.h b/server/modules/routing/binlogrouter/blr.h index 68962536d..67c986430 100644 --- a/server/modules/routing/binlogrouter/blr.h +++ b/server/modules/routing/binlogrouter/blr.h @@ -592,6 +592,7 @@ typedef struct router_instance int master_semi_sync; /*< Semi-Sync replication status of master server */ BINLOG_ENCRYPTION_SETUP encryption; /*< Binlog encryption setup */ void *encryption_ctx; /*< Encryption context */ + char *set_slave_hostname; /*< Send custom Hostname to Master */ struct router_instance *next; } ROUTER_INSTANCE; diff --git a/server/modules/routing/binlogrouter/blr_master.c b/server/modules/routing/binlogrouter/blr_master.c index 5d7fc04b0..c2e8234f8 100644 --- a/server/modules/routing/binlogrouter/blr_master.c +++ b/server/modules/routing/binlogrouter/blr_master.c @@ -885,28 +885,55 @@ blr_make_registration(ROUTER_INSTANCE *router) { GWBUF *buf; unsigned char *data; - int len = 18; + int len = 18; // Min size of COM_REGISTER_SLAVE payload int port = 3306; + int hostname_len = 0; - if ((buf = gwbuf_alloc(len + 4)) == NULL) + // Send router->set_slave_hostname + if (router->set_slave_hostname && router->set_slave_hostname[0]) + { + hostname_len = strlen(router->set_slave_hostname); + } + + // Add hostname len + len += hostname_len; + + if ((buf = gwbuf_alloc(len + MYSQL_HEADER_LEN)) == NULL) { return NULL; } + data = GWBUF_DATA(buf); encode_value(&data[0], len, 24); // Payload length data[3] = 0; // Sequence ID data[4] = COM_REGISTER_SLAVE; // Command encode_value(&data[5], router->serverid, 32); // Slave Server ID - data[9] = 0; // Slave hostname length - data[10] = 0; // Slave username length - data[11] = 0; // Slave password length + + // Point to hostname len offset + data += 9; + + *data++ = hostname_len; // Slave hostname length + + // Copy hostname + if (hostname_len) + { + memcpy(data, router->set_slave_hostname, hostname_len); + } + + // Point to user + data += hostname_len; + // Set empty user + *data++ = 0; // Slave username length + // Set empty password + *data++ = 0; // Slave password length + // Add port if (router->service->ports) { port = router->service->ports->port; } - encode_value(&data[12], port, 16); // Slave master port - encode_value(&data[14], 0, 32); // Replication rank - encode_value(&data[18], router->masterid, 32); // Master server-id + encode_value(&data[0], port, 16); // Slave master port, 2 bytes + encode_value(&data[2], 0, 32); // Replication rank, 4 bytes + encode_value(&data[6], router->masterid, 32); // Master server-id, 4 bytes // This is hack to get the result set processing in order for binlogrouter MySQLProtocol *proto = (MySQLProtocol*)router->master->protocol; @@ -2202,9 +2229,15 @@ static void blr_log_identity(ROUTER_INSTANCE *router) /* Seen by the master */ MXS_NOTICE("%s: identity seen by the master: " - "server_id: %d, uuid: %s", + "Server_id: %d, Slave_UUID: %s, Host: %s", router->service->name, - router->serverid, (router->uuid == NULL ? "not available" : router->uuid)); + router->serverid, + router->uuid == NULL ? + "not available" : + router->uuid, + (router->set_slave_hostname && router->set_slave_hostname[0]) ? + router->set_slave_hostname : + "not set"); /* Seen by the slaves */ From d60df103bf75ba7f784deee9a33bc5cbe92e8a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 10 Aug 2017 10:20:25 +0300 Subject: [PATCH 09/14] Add avrorouter binlog checksum to limitations Added a note about the avrorouter binlog checksums to the limitations document. --- Documentation/About/Limitations.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/About/Limitations.md b/Documentation/About/Limitations.md index ce39d0cc3..194510612 100644 --- a/Documentation/About/Limitations.md +++ b/Documentation/About/Limitations.md @@ -130,6 +130,14 @@ The avrorouter does not support the following data types and conversions: The avrorouter does not do any crash recovery. This means that the avro files need to be truncated to valid block lengths before starting the avrorouter. +#### Binlog Checksums + +The avrorouter does not support binlog checksums. They must must not be used in +any of the binlogs that the avrorouter will process. + +Follow [MXS-1341](https://jira.mariadb.org/browse/MXS-1341) for progress +on this issue. + ### Limitations in the connection router (readconnroute) If Master changes (ie. new Master promotion) during current connection, the From 9b9d7e4c4d80ec7921f571c45be91b2cc63918fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 10 Aug 2017 10:36:10 +0300 Subject: [PATCH 10/14] Generate a list of all fixed issues The list_fixed_bugs.sh script now also shows issues that aren't bugs. --- Documentation/list_fixed_bugs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/list_fixed_bugs.sh b/Documentation/list_fixed_bugs.sh index ac39dc1aa..bc7ab2b60 100755 --- a/Documentation/list_fixed_bugs.sh +++ b/Documentation/list_fixed_bugs.sh @@ -8,4 +8,4 @@ then fi version=$1 -curl -s "https://jira.mariadb.org/sr/jira.issueviews:searchrequest-csv-current-fields/temp/SearchRequest.csv?jqlQuery=project+%3D+MXS+AND+issuetype+%3D+Bug+AND+status+%3D+Closed+AND+fixVersion+%3D+$version"|cut -f 1,2 -d ,|tail -n+2|sed 's/\(.*\),\(.*\)/* (\2)[https:\/\/jira.mariadb.org\/browse\/\2] \1/' +curl -s "https://jira.mariadb.org/sr/jira.issueviews:searchrequest-csv-current-fields/temp/SearchRequest.csv?jqlQuery=project+%3D+MXS+AND+status+%3D+Closed+AND+fixVersion+%3D+$version"|cut -f 1,2 -d ,|tail -n+2|sed 's/\(.*\),\(.*\)/* (\2)[https:\/\/jira.mariadb.org\/browse\/\2] \1/' From 424c7b7ad3db720a0105f47471282bed1c655e1c Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Thu, 10 Aug 2017 09:42:37 +0200 Subject: [PATCH 11/14] MXS-1343: documentation update. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MXS-1343: documentation update for new option ‘slave_hostname’ --- Documentation/Routers/Binlogrouter.md | 29 +++- ...eplication-Proxy-Binlog-Router-Tutorial.md | 146 +----------------- 2 files changed, 31 insertions(+), 144 deletions(-) diff --git a/Documentation/Routers/Binlogrouter.md b/Documentation/Routers/Binlogrouter.md index a0d4bc43e..0bc573dda 100644 --- a/Documentation/Routers/Binlogrouter.md +++ b/Documentation/Routers/Binlogrouter.md @@ -93,6 +93,15 @@ version of the real master. This option allows the router to use a custom versio By default, the router will identify itself to the slaves using the hostname of the real master. This option allows the router to use a custom hostname. + +### `slave_hostname` + +Since MaxScale 2.1.6 the router can optionally identify itself +to the master using a custom hostname. +The specified hostname can be seen in the master via +`SHOW SLAVE HOSTS` command. +The default is not to send any hostname string during registration. + ### `user` This is the user name that MariaDB MaxScale uses when it connects to the @@ -271,7 +280,25 @@ follows. version_string=5.6.17-log user=maxscale passwd=Mhu87p2D - router_options=uuid=f12fcb7f-b97b-11e3-bc5e-0401152c4c22,server_id=3,user=repl,password=slavepass,master_id=32,heartbeat=30,binlogdir=/var/binlogs,transaction_safety=1,master_version=5.6.19-common,master_hostname=common_server,master_uuid=xxx-fff-cccc-common,mariadb10-compatibility=1,send_slave_heartbeat=1,ssl_cert_verification_depth=9,semisync=1,encrypt_binlog=1,encryption_algorithm=aes_ctr,encryption_key_file=/var/binlogs/enc_key.txt + router_options=uuid=f12fcb7f-b97b-11e3-bc5e-0401152c4c22, + server_id=3, + user=repl, + password=slavepass, + master_id=32, + heartbeat=30, + binlogdir=/var/binlogs, + transaction_safety=1, + master_version=5.6.19-common, + master_hostname=common_server, + master_uuid=xxx-fff-cccc-common, + mariadb10-compatibility=1, + send_slave_heartbeat=1, + ssl_cert_verification_depth=9, + semisync=1, + encrypt_binlog=1, + encryption_algorithm=aes_ctr, + encryption_key_file=/var/binlogs/enc_key.txt, + slave_hostname=maxscale-blr-1 ``` The minimum set of router options that must be given in the configuration are diff --git a/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md b/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md index fdf0b1bde..358c5edad 100644 --- a/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md +++ b/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md @@ -32,152 +32,12 @@ Using MariaDB MaxScale as a Binlog Server is much the same as using MariaDB MaxS As with any MariaDB MaxScale configuration a good starting point is with the service definition with the *maxscale.cnf* file. The service requires a name which is the section name in the ini file, a type parameter with a value of service and the name of the router plugin that should be loaded. In the case of replication proxies this router name is *binlogrouter*. -``` -[Replication] -type=service -router=binlogrouter -``` - -Other standard service parameters need to be given in the configuration section that are used to retrieve the set of users from the backend (master) database, also a version string can be given such that the MariaDB MaxScale instance will report this version string to the slave servers that connect to MariaDB MaxScale. - -``` -[Replication] -type=service -router=binlogrouter -version_string=5.6.17-log -user=maxscale -passwd=Mhu87p2D -``` - -The *user* and *passwd* entries in the above example are used in order for MariaDB MaxScale to populate the credential information that is required to allow the slaves to connect to MariaDB MaxScale. This user should be configured in exactly the same way a for any other MariaDB MaxScale service, i.e. the user needs access to the *mysql.user* table and the *mysql.db* table as well as having the ability to perform a *SHOW DATABASES* command. - -This user is the only one available for MySQL connection to MaxScale Binlog Server for administration when master connection is not done yet. - -The master server details are currently provided by a **master.ini** file located in binlog directory and could be changed via *CHANGE MASTER TO* command issued via MySQL connection to MariaDB MaxScale; refer to the Master setup section below for further details. - -In the current implementation of the router only a single server can be used. - -The final configuration requirement is the router specific options. The binlog router requires a set of parameters to be passed, these are passed, as a comma separated list of name value pairs, in the *router_options* parameter of the service definition.. - -### binlogdir - -This parameter allows the location that MariaDB MaxScale uses to store binlog files to be set. If this parameter is not set to a directory name then MariaDB MaxScale will store the binlog files in the directory */var/cache/maxscale/*. -In the binlog dir there is also the 'cache' directory that contains data retrieved from the master during registration phase and the *master.ini* file which contains the configuration of current configured master. - -### uuid - -This is used to set the unique uuid that the binlog router uses when it connects to the master server. -If no explicit value is given for the uuid in the configuration file then a uuid will be generated. - -### server-id - -As with uuid, MariaDB MaxScale must have a unique server-id for the connection it makes to the master, this parameter provides the value of server-id that MariaDB MaxScale will use when connecting to the master. - -### master-id - -The server-id value that MariaDB MaxScale should use to report to the slaves that connect to MariaDB MaxScale. -This may either be the same as the server-id of the real master or can be chosen to be different if the slaves need to be aware of the proxy layer. -The real master server-id will be used if the option is not set. - -### master_uuid - -It is a requirement of replication that each slave have a unique UUID value. The MariaDB MaxScale router will identify itself to the slaves using the uuid of the real master if this option is not set. - -### master_version - -The MariaDB MaxScale router will identify itself to the slaves using the server version of the real master if this option is not set. - -### master_hostname - -The MariaDB MaxScale router will identify itself to the slaves using the server hostname of the real master if this option is not set. - -### user - -This is the user name that MariaDB MaxScale uses when it connects to the master. This user name must have the rights required for replication as with any other user that a slave uses for replication purposes. If the user parameter is not given in the router options then the same user as is used to retrieve the credential information will be used for the replication connection, i.e. the user in the service entry. - -This user is also the only one available for Binlog Server administration when the connection with master is not ready yet: the 'master.ini' file doesn't exists and no other users are available for authentication. - -The user that is used for replication, either defined using the *user=* option in the router options or using the username and password defined of the service must be granted replication privileges on the database server. - -``` - MariaDB> CREATE USER 'repl'@'maxscalehost' IDENTIFIED by 'password'; - MariaDB> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'maxscalehost'; -``` - -### password - -The password of the above user. If the password is not explicitly given then the password in the service entry will be used. For compatibility with other username and password definitions within the MariaDB MaxScale configuration file it is also possible to use the parameter *passwd=*. - -### heartbeat - -This defines the value of the heartbeat interval in seconds for the connection to the master. MariaDB MaxScale requests the master to ensure that a binlog event is sent at least every heartbeat period. If there are no real binlog events to send the master will sent a special heartbeat event. The default value for the heartbeat period is every 5 minutes. The current interval value is reported in the diagnostic output. - -### send_slave_heartbeat - -This defines whether (on | off) MariaDB MaxScale sends to the slave the heartbeat packet when there are no real binlog events to send. The default value if 'off', no heartbeat event is sent to slave server. If value is 'on' the interval value (requested by the slave during registration) is reported in the diagnostic output and the packet is send after the time interval without any event to send. - -### burstsize - -This parameter is used to define the maximum amount of data that will be sent to a slave by MariaDB MaxScale when that slave is lagging behind the master. In this situation the slave is said to be in "catchup mode", this parameter is designed to both prevent flooding of that slave and also to prevent threads within MariaDB MaxScale spending disproportionate amounts of time with slaves that are lagging behind the master. The burst size can be defined in Kb, Mb or Gb by adding the qualifier K, M or G to the number given. The default value of burstsize is 1Mb and will be used if burstsize is not given in the router options. - -### transaction_safety - -This parameter is used to enable/disable incomplete transactions detection in binlog router. -When MariaDB MaxScale starts an error message may appear if current binlog file is corrupted or an incomplete transaction is found. -During normal operations binlog events are not distributed to the slaves until a *COMMIT* is seen. -The default value is off, set *transaction_safety=on* to enable the incomplete transactions detection. - -### semisync - -This parameter controls whether binlog server could ask Master server to start the Semi-Synchronous replication. -In order to get semi-sync working the Master server must have the *rpl_semi_sync_master* plugin installed. -The availability of the plugin and the value of the GLOBAL VARIABLE *rpl_semi_sync_master_enabled* are checked in the Master registration phase: if the plugin is installed in the Master database the binlog server subsequently requests the semi-sync option. - -Note: - - the network replication stream from Master has two additional bytes before each binlog event. - - the Semi-Sync protocol requires an acknowledge packet to be sent back to Master only when requested: the semi-sync flag will have value of 1. - This flag is set only if *rpl_semi_sync_master_enabled=1* in the Master, otherwise it will always have value of 0 and no ack packet is sent back. - -Please note that semi-sync replication is only related to binlog server to Master communication. - - -### ssl_cert_verification_depth - -This parameter sets the maximum length of the certificate authority chain that will be accepted. Legal values are positive integers. -This applies to SSL connection to master server that could be acivated either by writing options in master.ini or later via CHANGE MASTER TO. -This parameter cannot be modified at runtime, default is 9. - -### `encrypt_binlog` -Whether to encrypt binlog files: the default is Off - -When set to On the binlog files will be encrypted using specified AES algorithm and the KEY in the specified key file. - -### `encryption_algorithm` -aes_ctr or aes_cbc - -The default is 'aes_cbc' - -### `encryption_key_file` -The specified key file must have this format: -a line with `1;HEX(KEY)` - -Additional informatons about Binlog files encryption can be found here: -[Binlogrouter - The replication protocol proxy module for MariaDB MaxScale](../Routers/Binlogrouter.md). - -A complete example of a service entry for a binlog router service would be as follows. - -``` - [Replication] - type=service - router=binlogrouter - version_string=5.6.17-log - user=maxscale - passwd=Mhu87p2D - router_options=uuid=f12fcb7f-b97b-11e3-bc5e-0401152c4c22,server-id=3,user=repl,password=slavepass,master-id=1,heartbeat=30,binlogdir=/var/binlogs,transaction_safety=1,master_version=5.6.19-common,master_hostname=common_server,master_uuid=xxx-fff-cccc-common,master-id=999,mariadb10-compatibility=1,ssl_cert_verification_depth=9,semisync=1,encrypt_binlog=1,encryption_algorithm=aes_ctr,encryption_key_file=/var/binlogs/enc_key.txt -``` The minimum set of router options that must be given in the configuration are are *server-id* and *master-id*, default values may be used for all other options. +All configuration prameters can be found in the [Binlog Router Documentation](../Routers/Binlogrouter.md). + + ## Listener Section As per any service in MariaDB MaxScale a listener section is required to define the address, port and protocol that is used to listen for incoming connections. Those incoming connections will originate from the slave servers or from a MySQL client in order to administer/configure the master server configuration via SQL commands such as *STOP/START SLAVE* and *CHANGE MASTER TO* ... From 87a48919e85e76dee7349fc2cdc14bccfca5bed6 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Thu, 10 Aug 2017 10:10:56 +0200 Subject: [PATCH 12/14] Release Notes 2.1.6 update Release Notes 2.1.6 update --- Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md index a13102810..4b787c4dc 100644 --- a/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md @@ -25,6 +25,11 @@ report at [Jira](https://jira.mariadb.org). * [MXS-1351](https://jira.mariadb.org/browse/MXS-1351) Partially authenticated connections are put into the connection pool * [MXS-1338](https://jira.mariadb.org/browse/MXS-1338) Buffer objects are bound to indiviudual buffers +## New Features + +* It is now possible to configure the binlog router to identify itself +to the master using a custom hostname: [MXS-1343](https://jira.mariadb.org/browse/MXS-1343) + ## Known Issues and Limitations There are some limitations and known issues within this version of MaxScale. From ca7aadeb242ca89b24b6dbc7ea818ed83f33e24a Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Thu, 10 Aug 2017 10:18:50 +0200 Subject: [PATCH 13/14] Bingo Tutorial shows complete configuration example. Bingo Tutorial shows complete configuration example. --- Documentation/Routers/Binlogrouter.md | 1 - ...eplication-Proxy-Binlog-Router-Tutorial.md | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Documentation/Routers/Binlogrouter.md b/Documentation/Routers/Binlogrouter.md index 0bc573dda..044f18dbb 100644 --- a/Documentation/Routers/Binlogrouter.md +++ b/Documentation/Routers/Binlogrouter.md @@ -93,7 +93,6 @@ version of the real master. This option allows the router to use a custom versio By default, the router will identify itself to the slaves using the hostname of the real master. This option allows the router to use a custom hostname. - ### `slave_hostname` Since MaxScale 2.1.6 the router can optionally identify itself diff --git a/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md b/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md index 358c5edad..08cb36b53 100644 --- a/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md +++ b/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md @@ -37,6 +37,34 @@ The minimum set of router options that must be given in the configuration are ar All configuration prameters can be found in the [Binlog Router Documentation](../Routers/Binlogrouter.md). +A complete example of a service entry for a binlog router service would be as follows. + +``` + [Replication] + type=service + router=binlogrouter + version_string=5.6.17-log + user=maxscale + passwd=Mhu87p2D + router_options=uuid=f12fcb7f-b97b-11e3-bc5e-0401152c4c22,server-id=3, + user=repl, + password=slavepass, + master-id=1, + heartbeat=30, + binlogdir=/var/binlogs, + transaction_safety=1, + master_version=5.6.19-common, + master_hostname=common_server, + master_uuid=xxx-fff-cccc-common, + master-id=999, + mariadb10-compatibility=1, + ssl_cert_verification_depth=9, + semisync=1, + encrypt_binlog=1, + encryption_algorithm=aes_ctr, + encryption_key_file=/var/binlogs/enc_key.txt, + slave_hostname=maxscale-blr-1 +``` ## Listener Section From 7021041804170d6e55eb62d930bd8351cc20d2f8 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 14 Aug 2017 10:06:27 +0300 Subject: [PATCH 14/14] Update 2.1.6 release date --- Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md index 4b787c4dc..225d6d5fd 100644 --- a/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.1.6-Release-Notes.md @@ -1,4 +1,4 @@ -# MariaDB MaxScale 2.1.6 Release Notes +# MariaDB MaxScale 2.1.6 Release Notes -- 2017-08-14 Release 2.1.6 is a GA release. @@ -23,6 +23,7 @@ report at [Jira](https://jira.mariadb.org). * [MXS-1352](https://jira.mariadb.org/browse/MXS-1352) Not all query failures in monitors are reported * [MXS-1351](https://jira.mariadb.org/browse/MXS-1351) Partially authenticated connections are put into the connection pool +* (MXS-1343)[https://jira.mariadb.org/browse/MXS-1343] MaxScale's binlogrouter does not send hostname to its master * [MXS-1338](https://jira.mariadb.org/browse/MXS-1338) Buffer objects are bound to indiviudual buffers ## New Features