From c49a28ef12d7550e3103885a9f1ba95d008efca8 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 16 Nov 2020 14:35:31 +0200 Subject: [PATCH 1/9] 2.4 Update maintenance release --- VERSION24.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION24.cmake b/VERSION24.cmake index 073a87454..991c072d0 100644 --- a/VERSION24.cmake +++ b/VERSION24.cmake @@ -5,7 +5,7 @@ set(MAXSCALE_VERSION_MAJOR "2" CACHE STRING "Major version") set(MAXSCALE_VERSION_MINOR "4" CACHE STRING "Minor version") -set(MAXSCALE_VERSION_PATCH "14" CACHE STRING "Patch version") +set(MAXSCALE_VERSION_PATCH "15" CACHE STRING "Patch version") # This should only be incremented if a package is rebuilt set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number") From 558bd9279bf7c33651bf3baab0e47f2587b3b5f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 16 Nov 2020 16:54:37 +0200 Subject: [PATCH 2/9] Use same script for both SSL and non-SSL users --- system-test/create_user.sh | 17 +++++++++++------ system-test/create_user_ssl.sh | 8 ++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/system-test/create_user.sh b/system-test/create_user.sh index b8b6064b7..4fac0a098 100755 --- a/system-test/create_user.sh +++ b/system-test/create_user.sh @@ -1,10 +1,15 @@ #!/bin/bash +# The following environment variables are used: +# node_user - A custom user to create +# node_password - The password for the user +# require_ssl - Require SSL for all users except the replication user + mysql --force $1 <& /dev/null DROP USER IF EXISTS '$node_user'@'%'; CREATE USER '$node_user'@'%' IDENTIFIED BY '$node_password'; -GRANT ALL PRIVILEGES ON *.* TO '$node_user'@'%' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON *.* TO '$node_user'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'repl'@'%'; CREATE USER 'repl'@'%' IDENTIFIED BY 'repl'; @@ -16,7 +21,7 @@ GRANT ALL ON *.* TO 'repl'@'localhost' WITH GRANT OPTION; DROP USER IF EXISTS 'skysql'@'%'; CREATE USER 'skysql'@'%' IDENTIFIED BY 'skysql'; -GRANT ALL ON *.* TO 'skysql'@'%' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'skysql'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'skysql'@'localhost'; CREATE USER 'skysql'@'localhost' IDENTIFIED BY 'skysql'; @@ -24,19 +29,19 @@ GRANT ALL ON *.* TO 'skysql'@'localhost' WITH GRANT OPTION; DROP USER IF EXISTS 'maxskysql'@'%'; CREATE USER 'maxskysql'@'%' IDENTIFIED BY 'skysql'; -GRANT ALL ON *.* TO 'maxskysql'@'%' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxskysql'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'maxskysql'@'localhost'; CREATE USER 'maxskysql'@'localhost' IDENTIFIED BY 'skysql'; -GRANT ALL ON *.* TO 'maxskysql'@'localhost' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxskysql'@'localhost' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'maxuser'@'%'; CREATE USER 'maxuser'@'%' IDENTIFIED BY 'maxpwd'; -GRANT ALL ON *.* TO 'maxuser'@'%' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxuser'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'maxuser'@'localhost'; CREATE USER 'maxuser'@'localhost' IDENTIFIED BY 'maxpwd'; -GRANT ALL ON *.* TO 'maxuser'@'localhost' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxuser'@'localhost' $require_ssl WITH GRANT OPTION; RESET MASTER; EOF diff --git a/system-test/create_user_ssl.sh b/system-test/create_user_ssl.sh index 879c57fd1..2190d3ee8 100755 --- a/system-test/create_user_ssl.sh +++ b/system-test/create_user_ssl.sh @@ -1,8 +1,4 @@ #!/bin/bash -echo "DROP USER '$node_user'@'%'" | sudo mysql $1 -echo "grant all privileges on *.* to '$node_user'@'%' identified by '$node_password' require ssl WITH GRANT OPTION" -echo "grant all privileges on *.* to '$node_user'@'%' identified by '$node_password' require ssl WITH GRANT OPTION" | sudo mysql $1 - -echo "grant all privileges on *.* to 'maxskysql'@'%' identified by 'skysql' require ssl WITH GRANT OPTION" | sudo mysql $1 -echo "grant all privileges on *.* to 'maxuser'@'%' identified by 'maxpwd' require ssl WITH GRANT OPTION" | sudo mysql $1 +export require_ssl="REQUIRE SSL" +./create_user.sh $1 From 4545b8f798546f54ac5e1184a8fbbfd67d96b049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 17 Nov 2020 10:08:15 +0200 Subject: [PATCH 3/9] Fix division by zero If the query failed instantly it would crash the test. --- system-test/mxs1926_killed_server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/mxs1926_killed_server.cpp b/system-test/mxs1926_killed_server.cpp index a17b8a6a8..0710c2fc5 100644 --- a/system-test/mxs1926_killed_server.cpp +++ b/system-test/mxs1926_killed_server.cpp @@ -54,7 +54,7 @@ void tune_rowcount(TestConnections& test) remove(filename.c_str()); int orig = ROWCOUNT; - ROWCOUNT = orig / dur.count() * 10000; + ROWCOUNT = orig / (dur.count() + 1) * 10000; test.tprintf("Loading %d rows took %ld ms, setting row count to %d", orig, dur.count(), From fa0b9d8df103011e72e8e366b94419c75cb8dcb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 13 Nov 2020 15:55:47 +0200 Subject: [PATCH 4/9] Install one ASAN, not both Installing both seems to cause problems on CentOS 7. --- BUILD/install_build_deps.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/BUILD/install_build_deps.sh b/BUILD/install_build_deps.sh index a6efc530f..9e6ae2561 100755 --- a/BUILD/install_build_deps.sh +++ b/BUILD/install_build_deps.sh @@ -127,12 +127,18 @@ then sudo yum -y install centos-release-scl || \ sudo yum-config-manager --enable rhui-REGION-rhel-server-rhscl - sudo yum -y install devtoolset-7-gcc-c++ - sudo yum -y install devtoolset-7-libasan-devel - - - # Enable it by default - echo "source /opt/rh/devtoolset-7/enable" >> ~/.bashrc + # Install newer compiler for CentOS 7 and 6 + grep "release [67]" /etc/redhat-release + if [ $? -eq 0 ] + then + sudo yum -y install devtoolset-7-gcc-c++ + sudo yum -y install devtoolset-7-libasan-devel + # Enable it by default + echo "source /opt/rh/devtoolset-7/enable" >> ~/.bashrc + else + # CentOS 8 only needs ASAN + sudo yum -y install libasan-devel + fi grep "release 6" /etc/redhat-release if [ $? -ne 0 ] From f577d098292b63e616e3864216daebcdeab0c5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 17 Nov 2020 10:43:40 +0200 Subject: [PATCH 5/9] MXS-3297: Don't advertise unsupported capabilities Only bulk execute is supported. Supporting progress reporting currently breaks the protocol result processing code. --- include/maxscale/protocol/mysql.h | 3 +++ server/modules/protocol/MySQL/mariadbclient/mysql_client.cc | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/maxscale/protocol/mysql.h b/include/maxscale/protocol/mysql.h index b5baedf00..454280b73 100644 --- a/include/maxscale/protocol/mysql.h +++ b/include/maxscale/protocol/mysql.h @@ -272,6 +272,9 @@ typedef enum #define MXS_MARIA_CAP_COM_MULTI (1 << 1) #define MXS_MARIA_CAP_STMT_BULK_OPERATIONS (1 << 2) +// Only bulk operations are supported +#define MXS_MARIADB_CAP_SERVER MXS_MARIA_CAP_STMT_BULK_OPERATIONS + typedef enum { MXS_COM_SLEEP = 0, diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index f8c3b51a5..763f1de2f 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -661,7 +661,8 @@ static void store_client_information(DCB* dcb, GWBUF* buffer) * there are extra capabilities stored in the last 4 bytes of the 23 byte filler. */ if ((proto->client_capabilities & GW_MYSQL_CAPABILITIES_CLIENT_MYSQL) == 0) { - proto->extra_capabilities = gw_mysql_get_byte4(data + MARIADB_CAP_OFFSET); + uint32_t caps = gw_mysql_get_byte4(data + MARIADB_CAP_OFFSET); + proto->extra_capabilities = caps & MXS_MARIADB_CAP_SERVER; } if (len > MYSQL_AUTH_PACKET_BASE_SIZE) From 4728730510409fc15d2b3a55fa6e00008651794d Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 17 Nov 2020 13:25:13 +0200 Subject: [PATCH 6/9] MXS-3301 Look for "xpand" to find out whether server is Xpand We will continue to look for "clustrix" as well so that MaxScale will continue to work with older releases. Clustrix was replaced with xpand in all symbols. --- include/maxscale/server.hh | 2 +- server/core/server.cc | 5 +-- .../authenticator/MariaDBAuth/dbusers.cc | 36 +++++++++---------- .../monitor/mariadbmon/mariadbserver.cc | 6 ++-- .../monitor/mariadbmon/mariadbserver.hh | 2 +- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/include/maxscale/server.hh b/include/maxscale/server.hh index 1758bcba4..476572b9d 100644 --- a/include/maxscale/server.hh +++ b/include/maxscale/server.hh @@ -141,7 +141,7 @@ public: { MARIADB, MYSQL, - CLUSTRIX + XPAND }; enum class RLagState diff --git a/server/core/server.cc b/server/core/server.cc index 0520e0819..e3d4d57db 100644 --- a/server/core/server.cc +++ b/server/core/server.cc @@ -1150,9 +1150,10 @@ void Server::VersionInfo::set(uint64_t version, const std::string& version_str) m_version_num.patch = patch; careful_strcpy(m_version_str, MAX_VERSION_LEN, version_str); - if (strcasestr(version_str.c_str(), "clustrix") != NULL) + if (strcasestr(version_str.c_str(), "xpand") != NULL + || strcasestr(version_str.c_str(), "clustrix") != NULL) { - m_type = Type::CLUSTRIX; + m_type = Type::XPAND; } else if (strcasestr(version_str.c_str(), "mariadb") != NULL) { diff --git a/server/modules/authenticator/MariaDBAuth/dbusers.cc b/server/modules/authenticator/MariaDBAuth/dbusers.cc index e0672a5f4..c3643fa58 100644 --- a/server/modules/authenticator/MariaDBAuth/dbusers.cc +++ b/server/modules/authenticator/MariaDBAuth/dbusers.cc @@ -51,7 +51,7 @@ const char* mariadb_users_query_format = "FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t " "ON (u.user = t.user AND u.host = t.host) WHERE u.plugin IN ('', 'mysql_native_password') %s"; -const char* clustrix_users_query_format = +const char* xpand_users_query_format = "SELECT u.username AS user, u.host, a.dbname AS db, " " IF(a.privileges & 1048576, 'Y', 'N') AS select_priv, u.password " "FROM system.users AS u LEFT JOIN system.user_acl AS a ON (u.user = a.role) " @@ -144,7 +144,7 @@ enum server_category_t { SERVER_NO_ROLES, SERVER_ROLES, - SERVER_CLUSTRIX + SERVER_XPAND }; static int get_users(Listener* listener, bool skip_local, SERVER** srv); @@ -208,7 +208,7 @@ static char* get_mariadb_users_query(bool include_root, const SERVER::Version& v return rval; } -static char* get_clustrix_users_query(bool include_root) +static char* get_xpand_users_query(bool include_root) { const char* with_root; @@ -223,10 +223,10 @@ static char* get_clustrix_users_query(bool include_root) with_root = "AND u.username <> 'root'"; } - size_t n_bytes = snprintf(NULL, 0, clustrix_users_query_format, with_root); + size_t n_bytes = snprintf(NULL, 0, xpand_users_query_format, with_root); char* rval = static_cast(MXS_MALLOC(n_bytes + 1)); MXS_ABORT_IF_NULL(rval); - snprintf(rval, n_bytes + 1, clustrix_users_query_format, with_root); + snprintf(rval, n_bytes + 1, xpand_users_query_format, with_root); return rval; } @@ -243,8 +243,8 @@ static char* get_users_query(const SERVER::Version& version, bool include_root, get_mariadb_101_users_query(include_root); break; - case SERVER_CLUSTRIX: - rval = get_clustrix_users_query(include_root); + case SERVER_XPAND: + rval = get_xpand_users_query(include_root); break; case SERVER_NO_ROLES: @@ -866,14 +866,14 @@ static bool check_default_table_permissions(MYSQL* mysql, } /** - * @brief Check table permissions on a Clustrix server + * @brief Check table permissions on a Xpand server * * @return True if the table permissions are OK, false otherwise. */ -static bool check_clustrix_table_permissions(MYSQL* mysql, - SERVICE* service, - SERVER* server, - const char* user) +static bool check_xpand_table_permissions(MYSQL* mysql, + SERVICE* service, + SERVER* server, + const char* user) { bool rval = true; @@ -948,9 +948,9 @@ static bool check_server_permissions(SERVICE* service, } bool rval = true; - if (server->type() == SERVER::Type::CLUSTRIX) + if (server->type() == SERVER::Type::XPAND) { - rval = check_clustrix_table_permissions(mysql, service, server, user); + rval = check_xpand_table_permissions(mysql, service, server, user); } else { @@ -1113,9 +1113,9 @@ struct User bool query_and_process_users(const char* query, MYSQL* con, SERVICE* service, int* users, std::vector* userlist, server_category_t category) { - // Clustrix does not have a mysql database. If non-clustrix we set the + // Xpand does not have a mysql database. If non-xpand we set the // default database in case CTEs are used. - bool rval = (category == SERVER_CLUSTRIX || mxs_mysql_query(con, "USE mysql") == 0); + bool rval = (category == SERVER_XPAND || mxs_mysql_query(con, "USE mysql") == 0); if (rval && mxs_mysql_query(con, query) == 0) { @@ -1197,9 +1197,9 @@ int get_users_from_server(MYSQL* con, SERVER* server, SERVICE* service, Listener } server_category_t category; - if (server->type() == SERVER::Type::CLUSTRIX) + if (server->type() == SERVER::Type::XPAND) { - category = SERVER_CLUSTRIX; + category = SERVER_XPAND; } else if (roles_are_available(con, service, server)) { diff --git a/server/modules/monitor/mariadbmon/mariadbserver.cc b/server/modules/monitor/mariadbmon/mariadbserver.cc index 8b467c728..e65fea785 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.cc +++ b/server/modules/monitor/mariadbmon/mariadbserver.cc @@ -232,7 +232,7 @@ bool MariaDBServer::do_show_slave_status(string* errmsg_out) unsigned int columns = 0; string query; bool all_slaves_status = false; - if (m_srv_type == server_type::CLUSTRIX) + if (m_srv_type == server_type::XPAND) { return false; } @@ -898,9 +898,9 @@ void MariaDBServer::update_server_version() m_srv_type = server_type::UNKNOWN; // TODO: Use type information in SERVER directly auto base_server_type = srv->type(); MYSQL_RES* result; - if (base_server_type == SERVER::Type::CLUSTRIX) + if (base_server_type == SERVER::Type::XPAND) { - m_srv_type = server_type::CLUSTRIX; + m_srv_type = server_type::XPAND; } // Check whether this server is a MaxScale Binlog Server. else if (mxs_mysql_query(conn, "SELECT @@maxscale_version") == 0 diff --git a/server/modules/monitor/mariadbmon/mariadbserver.hh b/server/modules/monitor/mariadbmon/mariadbserver.hh index 30783d3bb..2ae6a8a13 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.hh +++ b/server/modules/monitor/mariadbmon/mariadbserver.hh @@ -89,7 +89,7 @@ public: UNKNOWN, /* Totally unknown. Server has not been connected to yet. */ NORMAL, /* A normal MariaDB/MySQL server, possibly supported. */ BINLOG_ROUTER, /* MaxScale binlog server. Requires special handling. */ - CLUSTRIX /* Clustrix server. Requires special handling. */ + XPAND /* Xpand server. Requires special handling. */ }; enum class BinlogMode From 64ca695c849fd5ef10945b6a2d430201b6790cac Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 17 Nov 2020 17:21:14 +0200 Subject: [PATCH 7/9] Revert "MXS-3301 Look for "xpand" to find out whether server is Xpand" This reverts commit 4728730510409fc15d2b3a55fa6e00008651794d. The clustrix -> xpand name change causes too much trouble when merging to 2.5. --- include/maxscale/server.hh | 2 +- server/core/server.cc | 5 ++- .../authenticator/MariaDBAuth/dbusers.cc | 36 +++++++++---------- .../monitor/mariadbmon/mariadbserver.cc | 6 ++-- .../monitor/mariadbmon/mariadbserver.hh | 2 +- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/include/maxscale/server.hh b/include/maxscale/server.hh index 476572b9d..1758bcba4 100644 --- a/include/maxscale/server.hh +++ b/include/maxscale/server.hh @@ -141,7 +141,7 @@ public: { MARIADB, MYSQL, - XPAND + CLUSTRIX }; enum class RLagState diff --git a/server/core/server.cc b/server/core/server.cc index e3d4d57db..0520e0819 100644 --- a/server/core/server.cc +++ b/server/core/server.cc @@ -1150,10 +1150,9 @@ void Server::VersionInfo::set(uint64_t version, const std::string& version_str) m_version_num.patch = patch; careful_strcpy(m_version_str, MAX_VERSION_LEN, version_str); - if (strcasestr(version_str.c_str(), "xpand") != NULL - || strcasestr(version_str.c_str(), "clustrix") != NULL) + if (strcasestr(version_str.c_str(), "clustrix") != NULL) { - m_type = Type::XPAND; + m_type = Type::CLUSTRIX; } else if (strcasestr(version_str.c_str(), "mariadb") != NULL) { diff --git a/server/modules/authenticator/MariaDBAuth/dbusers.cc b/server/modules/authenticator/MariaDBAuth/dbusers.cc index c3643fa58..e0672a5f4 100644 --- a/server/modules/authenticator/MariaDBAuth/dbusers.cc +++ b/server/modules/authenticator/MariaDBAuth/dbusers.cc @@ -51,7 +51,7 @@ const char* mariadb_users_query_format = "FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t " "ON (u.user = t.user AND u.host = t.host) WHERE u.plugin IN ('', 'mysql_native_password') %s"; -const char* xpand_users_query_format = +const char* clustrix_users_query_format = "SELECT u.username AS user, u.host, a.dbname AS db, " " IF(a.privileges & 1048576, 'Y', 'N') AS select_priv, u.password " "FROM system.users AS u LEFT JOIN system.user_acl AS a ON (u.user = a.role) " @@ -144,7 +144,7 @@ enum server_category_t { SERVER_NO_ROLES, SERVER_ROLES, - SERVER_XPAND + SERVER_CLUSTRIX }; static int get_users(Listener* listener, bool skip_local, SERVER** srv); @@ -208,7 +208,7 @@ static char* get_mariadb_users_query(bool include_root, const SERVER::Version& v return rval; } -static char* get_xpand_users_query(bool include_root) +static char* get_clustrix_users_query(bool include_root) { const char* with_root; @@ -223,10 +223,10 @@ static char* get_xpand_users_query(bool include_root) with_root = "AND u.username <> 'root'"; } - size_t n_bytes = snprintf(NULL, 0, xpand_users_query_format, with_root); + size_t n_bytes = snprintf(NULL, 0, clustrix_users_query_format, with_root); char* rval = static_cast(MXS_MALLOC(n_bytes + 1)); MXS_ABORT_IF_NULL(rval); - snprintf(rval, n_bytes + 1, xpand_users_query_format, with_root); + snprintf(rval, n_bytes + 1, clustrix_users_query_format, with_root); return rval; } @@ -243,8 +243,8 @@ static char* get_users_query(const SERVER::Version& version, bool include_root, get_mariadb_101_users_query(include_root); break; - case SERVER_XPAND: - rval = get_xpand_users_query(include_root); + case SERVER_CLUSTRIX: + rval = get_clustrix_users_query(include_root); break; case SERVER_NO_ROLES: @@ -866,14 +866,14 @@ static bool check_default_table_permissions(MYSQL* mysql, } /** - * @brief Check table permissions on a Xpand server + * @brief Check table permissions on a Clustrix server * * @return True if the table permissions are OK, false otherwise. */ -static bool check_xpand_table_permissions(MYSQL* mysql, - SERVICE* service, - SERVER* server, - const char* user) +static bool check_clustrix_table_permissions(MYSQL* mysql, + SERVICE* service, + SERVER* server, + const char* user) { bool rval = true; @@ -948,9 +948,9 @@ static bool check_server_permissions(SERVICE* service, } bool rval = true; - if (server->type() == SERVER::Type::XPAND) + if (server->type() == SERVER::Type::CLUSTRIX) { - rval = check_xpand_table_permissions(mysql, service, server, user); + rval = check_clustrix_table_permissions(mysql, service, server, user); } else { @@ -1113,9 +1113,9 @@ struct User bool query_and_process_users(const char* query, MYSQL* con, SERVICE* service, int* users, std::vector* userlist, server_category_t category) { - // Xpand does not have a mysql database. If non-xpand we set the + // Clustrix does not have a mysql database. If non-clustrix we set the // default database in case CTEs are used. - bool rval = (category == SERVER_XPAND || mxs_mysql_query(con, "USE mysql") == 0); + bool rval = (category == SERVER_CLUSTRIX || mxs_mysql_query(con, "USE mysql") == 0); if (rval && mxs_mysql_query(con, query) == 0) { @@ -1197,9 +1197,9 @@ int get_users_from_server(MYSQL* con, SERVER* server, SERVICE* service, Listener } server_category_t category; - if (server->type() == SERVER::Type::XPAND) + if (server->type() == SERVER::Type::CLUSTRIX) { - category = SERVER_XPAND; + category = SERVER_CLUSTRIX; } else if (roles_are_available(con, service, server)) { diff --git a/server/modules/monitor/mariadbmon/mariadbserver.cc b/server/modules/monitor/mariadbmon/mariadbserver.cc index e65fea785..8b467c728 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.cc +++ b/server/modules/monitor/mariadbmon/mariadbserver.cc @@ -232,7 +232,7 @@ bool MariaDBServer::do_show_slave_status(string* errmsg_out) unsigned int columns = 0; string query; bool all_slaves_status = false; - if (m_srv_type == server_type::XPAND) + if (m_srv_type == server_type::CLUSTRIX) { return false; } @@ -898,9 +898,9 @@ void MariaDBServer::update_server_version() m_srv_type = server_type::UNKNOWN; // TODO: Use type information in SERVER directly auto base_server_type = srv->type(); MYSQL_RES* result; - if (base_server_type == SERVER::Type::XPAND) + if (base_server_type == SERVER::Type::CLUSTRIX) { - m_srv_type = server_type::XPAND; + m_srv_type = server_type::CLUSTRIX; } // Check whether this server is a MaxScale Binlog Server. else if (mxs_mysql_query(conn, "SELECT @@maxscale_version") == 0 diff --git a/server/modules/monitor/mariadbmon/mariadbserver.hh b/server/modules/monitor/mariadbmon/mariadbserver.hh index 2ae6a8a13..30783d3bb 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.hh +++ b/server/modules/monitor/mariadbmon/mariadbserver.hh @@ -89,7 +89,7 @@ public: UNKNOWN, /* Totally unknown. Server has not been connected to yet. */ NORMAL, /* A normal MariaDB/MySQL server, possibly supported. */ BINLOG_ROUTER, /* MaxScale binlog server. Requires special handling. */ - XPAND /* Xpand server. Requires special handling. */ + CLUSTRIX /* Clustrix server. Requires special handling. */ }; enum class BinlogMode From 9ed51b69e1ab88fbabdd20704cde761b4d1b2ff2 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 17 Nov 2020 17:30:50 +0200 Subject: [PATCH 8/9] MXS-3301 Look for "xpand" to find out whether server is Xpand We will continue to look for "clustrix" as well so that MaxScale will continue to work with older releases. --- server/core/server.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/core/server.cc b/server/core/server.cc index 0520e0819..7daf6afea 100644 --- a/server/core/server.cc +++ b/server/core/server.cc @@ -1150,7 +1150,8 @@ void Server::VersionInfo::set(uint64_t version, const std::string& version_str) m_version_num.patch = patch; careful_strcpy(m_version_str, MAX_VERSION_LEN, version_str); - if (strcasestr(version_str.c_str(), "clustrix") != NULL) + if (strcasestr(version_str.c_str(), "xpand") != NULL + || strcasestr(version_str.c_str(), "clustrix") != NULL) { m_type = Type::CLUSTRIX; } From 5fc73646a40a672ec63e130bf6495b558ef9033d Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 18 Nov 2020 10:02:02 +0200 Subject: [PATCH 9/9] MXS-3301 Rename clustrix -> xpand everywhere --- include/maxscale/server.hh | 2 +- server/core/server.cc | 2 +- .../authenticator/MariaDBAuth/dbusers.cc | 36 +++++++++---------- .../monitor/mariadbmon/mariadbserver.cc | 6 ++-- .../monitor/mariadbmon/mariadbserver.hh | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/maxscale/server.hh b/include/maxscale/server.hh index 1758bcba4..476572b9d 100644 --- a/include/maxscale/server.hh +++ b/include/maxscale/server.hh @@ -141,7 +141,7 @@ public: { MARIADB, MYSQL, - CLUSTRIX + XPAND }; enum class RLagState diff --git a/server/core/server.cc b/server/core/server.cc index 7daf6afea..e3d4d57db 100644 --- a/server/core/server.cc +++ b/server/core/server.cc @@ -1153,7 +1153,7 @@ void Server::VersionInfo::set(uint64_t version, const std::string& version_str) if (strcasestr(version_str.c_str(), "xpand") != NULL || strcasestr(version_str.c_str(), "clustrix") != NULL) { - m_type = Type::CLUSTRIX; + m_type = Type::XPAND; } else if (strcasestr(version_str.c_str(), "mariadb") != NULL) { diff --git a/server/modules/authenticator/MariaDBAuth/dbusers.cc b/server/modules/authenticator/MariaDBAuth/dbusers.cc index e0672a5f4..c3643fa58 100644 --- a/server/modules/authenticator/MariaDBAuth/dbusers.cc +++ b/server/modules/authenticator/MariaDBAuth/dbusers.cc @@ -51,7 +51,7 @@ const char* mariadb_users_query_format = "FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t " "ON (u.user = t.user AND u.host = t.host) WHERE u.plugin IN ('', 'mysql_native_password') %s"; -const char* clustrix_users_query_format = +const char* xpand_users_query_format = "SELECT u.username AS user, u.host, a.dbname AS db, " " IF(a.privileges & 1048576, 'Y', 'N') AS select_priv, u.password " "FROM system.users AS u LEFT JOIN system.user_acl AS a ON (u.user = a.role) " @@ -144,7 +144,7 @@ enum server_category_t { SERVER_NO_ROLES, SERVER_ROLES, - SERVER_CLUSTRIX + SERVER_XPAND }; static int get_users(Listener* listener, bool skip_local, SERVER** srv); @@ -208,7 +208,7 @@ static char* get_mariadb_users_query(bool include_root, const SERVER::Version& v return rval; } -static char* get_clustrix_users_query(bool include_root) +static char* get_xpand_users_query(bool include_root) { const char* with_root; @@ -223,10 +223,10 @@ static char* get_clustrix_users_query(bool include_root) with_root = "AND u.username <> 'root'"; } - size_t n_bytes = snprintf(NULL, 0, clustrix_users_query_format, with_root); + size_t n_bytes = snprintf(NULL, 0, xpand_users_query_format, with_root); char* rval = static_cast(MXS_MALLOC(n_bytes + 1)); MXS_ABORT_IF_NULL(rval); - snprintf(rval, n_bytes + 1, clustrix_users_query_format, with_root); + snprintf(rval, n_bytes + 1, xpand_users_query_format, with_root); return rval; } @@ -243,8 +243,8 @@ static char* get_users_query(const SERVER::Version& version, bool include_root, get_mariadb_101_users_query(include_root); break; - case SERVER_CLUSTRIX: - rval = get_clustrix_users_query(include_root); + case SERVER_XPAND: + rval = get_xpand_users_query(include_root); break; case SERVER_NO_ROLES: @@ -866,14 +866,14 @@ static bool check_default_table_permissions(MYSQL* mysql, } /** - * @brief Check table permissions on a Clustrix server + * @brief Check table permissions on a Xpand server * * @return True if the table permissions are OK, false otherwise. */ -static bool check_clustrix_table_permissions(MYSQL* mysql, - SERVICE* service, - SERVER* server, - const char* user) +static bool check_xpand_table_permissions(MYSQL* mysql, + SERVICE* service, + SERVER* server, + const char* user) { bool rval = true; @@ -948,9 +948,9 @@ static bool check_server_permissions(SERVICE* service, } bool rval = true; - if (server->type() == SERVER::Type::CLUSTRIX) + if (server->type() == SERVER::Type::XPAND) { - rval = check_clustrix_table_permissions(mysql, service, server, user); + rval = check_xpand_table_permissions(mysql, service, server, user); } else { @@ -1113,9 +1113,9 @@ struct User bool query_and_process_users(const char* query, MYSQL* con, SERVICE* service, int* users, std::vector* userlist, server_category_t category) { - // Clustrix does not have a mysql database. If non-clustrix we set the + // Xpand does not have a mysql database. If non-xpand we set the // default database in case CTEs are used. - bool rval = (category == SERVER_CLUSTRIX || mxs_mysql_query(con, "USE mysql") == 0); + bool rval = (category == SERVER_XPAND || mxs_mysql_query(con, "USE mysql") == 0); if (rval && mxs_mysql_query(con, query) == 0) { @@ -1197,9 +1197,9 @@ int get_users_from_server(MYSQL* con, SERVER* server, SERVICE* service, Listener } server_category_t category; - if (server->type() == SERVER::Type::CLUSTRIX) + if (server->type() == SERVER::Type::XPAND) { - category = SERVER_CLUSTRIX; + category = SERVER_XPAND; } else if (roles_are_available(con, service, server)) { diff --git a/server/modules/monitor/mariadbmon/mariadbserver.cc b/server/modules/monitor/mariadbmon/mariadbserver.cc index 8b467c728..e65fea785 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.cc +++ b/server/modules/monitor/mariadbmon/mariadbserver.cc @@ -232,7 +232,7 @@ bool MariaDBServer::do_show_slave_status(string* errmsg_out) unsigned int columns = 0; string query; bool all_slaves_status = false; - if (m_srv_type == server_type::CLUSTRIX) + if (m_srv_type == server_type::XPAND) { return false; } @@ -898,9 +898,9 @@ void MariaDBServer::update_server_version() m_srv_type = server_type::UNKNOWN; // TODO: Use type information in SERVER directly auto base_server_type = srv->type(); MYSQL_RES* result; - if (base_server_type == SERVER::Type::CLUSTRIX) + if (base_server_type == SERVER::Type::XPAND) { - m_srv_type = server_type::CLUSTRIX; + m_srv_type = server_type::XPAND; } // Check whether this server is a MaxScale Binlog Server. else if (mxs_mysql_query(conn, "SELECT @@maxscale_version") == 0 diff --git a/server/modules/monitor/mariadbmon/mariadbserver.hh b/server/modules/monitor/mariadbmon/mariadbserver.hh index 30783d3bb..2ae6a8a13 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.hh +++ b/server/modules/monitor/mariadbmon/mariadbserver.hh @@ -89,7 +89,7 @@ public: UNKNOWN, /* Totally unknown. Server has not been connected to yet. */ NORMAL, /* A normal MariaDB/MySQL server, possibly supported. */ BINLOG_ROUTER, /* MaxScale binlog server. Requires special handling. */ - CLUSTRIX /* Clustrix server. Requires special handling. */ + XPAND /* Xpand server. Requires special handling. */ }; enum class BinlogMode