From dbde182ecdcf3ebe392943c2b34adae1fdf00110 Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Thu, 19 Sep 2024 05:24:11 +0200 Subject: [PATCH] =?UTF-8?q?refactor(Deps/MySQL):=20Drop=20MariaDB=20and=20?= =?UTF-8?q?MySQL=205.7/8.1=20and=20add=20MySQL=208.=E2=80=A6=20(#19451)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/SECURITY.md | 43 ++++---- data/sql/create/drop_mysql.sql | 14 +-- data/sql/create/drop_mysql_8.sql | 9 -- src/cmake/macros/FindMySQL.cmake | 98 ++----------------- src/cmake/showoptions.cmake | 1 - .../apps/authserver/authserver.conf.dist | 3 +- src/server/apps/worldserver/Main.cpp | 6 -- .../database/Database/DatabaseWorkerPool.cpp | 22 +---- .../database/Database/DatabaseWorkerPool.h | 20 +--- .../database/Database/MySQLConnection.cpp | 14 +-- src/server/database/Updater/DBUpdater.cpp | 9 -- src/tools/dbimport/dbimport.conf.dist | 2 +- 12 files changed, 37 insertions(+), 204 deletions(-) delete mode 100644 data/sql/create/drop_mysql_8.sql diff --git a/.github/SECURITY.md b/.github/SECURITY.md index e7b138f777..fbabc2817e 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -15,23 +15,16 @@ Versions of AzerothCore: | AzerothCore Branch | Supported | | ------------------ | ------------------ | | master | :white_check_mark: | +| Any playerbot fork | :red_circle: | +| Any NPCBot fork | :red_circle: | Versions of MySQL: | MySQL Version | Supported | | ------------- | ------------------ | -| 8.1 | :white_check_mark: | +| 8.4 | :white_check_mark: | | 8.0 | :white_check_mark: | -| 5.7 | :white_check_mark: | -| 5.6 and lower | :red_circle: | - -Versions of MariaDB: - -| MariaDB Version | Supported | -| --------------- | ------------------ | -| 10.6 | :white_check_mark: | -| 10.5 | :white_check_mark: | -| 10.4 and lower | :red_circle: | +| 5.7 and lower | :red_circle: | Versions of CLang: @@ -43,26 +36,26 @@ Versions of CLang: Versions of GCC: -| GCC Version | Supported | -| ----------- | ------------------ | -| 14 | :white_check_mark: | -| 12 | :white_check_mark: | -| 11 and lower| :red_circle: | +| GCC Version | Supported | +| ------------ | ------------------ | +| 14 | :white_check_mark: | +| 12 | :white_check_mark: | +| 11 and lower | :red_circle: | Versions of Ubuntu: -| Ubuntu version | Supported | -| -------------- | ------------------ | -| 24.04 | :white_check_mark: | -| 22.04 | :white_check_mark: | -| 20.04 and lower| :red_circle: | +| Ubuntu version | Supported | +| --------------- | ------------------ | +| 24.04 | :white_check_mark: | +| 22.04 | :white_check_mark: | +| 20.04 and lower | :red_circle: | Versions of macOS: -| macOS Version | Supported | -| -------------- | ------------------ | -| 12 | :white_check_mark: | -| 11 and lower | :red_circle: | +| macOS Version | Supported | +| ------------- | ------------------ | +| 12 | :white_check_mark: | +| 11 and lower | :red_circle: | **Note**: We do NOT support any repacks that may or may not have been made based on AzerothCore. This is because they are usually based on older versions and there is no way to know what is in the precompiled binaries. Instead, you should compile your binaries from the AzerothCore source. To get started, read the [Installation Guide](https://www.azerothcore.org/wiki/installation). diff --git a/data/sql/create/drop_mysql.sql b/data/sql/create/drop_mysql.sql index 8b8d66f284..669e2538bc 100644 --- a/data/sql/create/drop_mysql.sql +++ b/data/sql/create/drop_mysql.sql @@ -1,16 +1,4 @@ -REVOKE ALL PRIVILEGES ON * . * FROM 'acore'@'localhost'; - -REVOKE ALL PRIVILEGES ON `acore_world` . * FROM 'acore'@'localhost'; - -REVOKE GRANT OPTION ON `acore_world` . * FROM 'acore'@'localhost'; - -REVOKE ALL PRIVILEGES ON `acore_characters` . * FROM 'acore'@'localhost'; - -REVOKE GRANT OPTION ON `acore_characters` . * FROM 'acore'@'localhost'; - -REVOKE ALL PRIVILEGES ON `acore_auth` . * FROM 'acore'@'localhost'; - -REVOKE GRANT OPTION ON `acore_auth` . * FROM 'acore'@'localhost'; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'acore'@'localhost'; DROP USER 'acore'@'localhost'; diff --git a/data/sql/create/drop_mysql_8.sql b/data/sql/create/drop_mysql_8.sql deleted file mode 100644 index 669e2538bc..0000000000 --- a/data/sql/create/drop_mysql_8.sql +++ /dev/null @@ -1,9 +0,0 @@ -REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'acore'@'localhost'; - -DROP USER 'acore'@'localhost'; - -DROP DATABASE IF EXISTS `acore_world`; - -DROP DATABASE IF EXISTS `acore_characters`; - -DROP DATABASE IF EXISTS `acore_auth`; diff --git a/src/cmake/macros/FindMySQL.cmake b/src/cmake/macros/FindMySQL.cmake index 09a7fd1df4..32a5775737 100644 --- a/src/cmake/macros/FindMySQL.cmake +++ b/src/cmake/macros/FindMySQL.cmake @@ -24,77 +24,6 @@ set( MYSQL_FOUND 0 ) -# Find MariaDB for Windows -if (WIN32) - # Set know versions MariaDB - set(_MARIADB_KNOWN_VERSIONS "MariaDB 10.9" "MariaDB 10.8" "MariaDB 10.7" "MariaDB 10.6" "MariaDB 10.5") - - # Set default options - set(MARIADB_FOUND_LIB 0) - set(MARIADB_FOUND_INCLUDE 0) - set(MARIADB_FOUND_EXECUTABLE 0) - set(MARIADB_FOUND 0) - - macro(FindLibMariaDB MariaDBVersion) - # Find include - find_path(MYSQL_INCLUDE_DIR - NAMES - mysql.h - PATHS - ${MYSQL_ADD_INCLUDE_PATH} - "$ENV{ProgramW6432}/${MariaDBVersion}/include/mysql" - "$ENV{ProgramFiles}/${MariaDBVersion}/include/mysql" - "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/mysql" - DOC - "Specify the directory containing mysql.h." - ) - - if(MYSQL_INCLUDE_DIR) - set(MARIADB_FOUND_INCLUDE 1) - endif() - - find_library(MYSQL_LIBRARY - NAMES - libmariadb - PATHS - ${MYSQL_ADD_LIBRARIES_PATH} - "$ENV{ProgramW6432}/${MariaDBVersion}/lib" - "$ENV{ProgramW6432}/${MariaDBVersion}/lib/opt" - "$ENV{ProgramFiles}/${MariaDBVersion}/lib" - "$ENV{ProgramFiles}/${MariaDBVersion}/lib/opt" - "$ENV{SystemDrive}/${MariaDBVersion}/lib/opt" - "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" - DOC - "Specify the location of the mysql library here." - ) - - if(MYSQL_LIBRARY) - set(MARIADB_FOUND_LIB 1) - endif() - - find_program(MYSQL_EXECUTABLE mysql - PATHS - "$ENV{ProgramW6432}/${MariaDBVersion}/bin" - "$ENV{ProgramW6432}/${MariaDBVersion}/bin/opt" - "$ENV{ProgramFiles}/${MariaDBVersion}/bin" - "$ENV{ProgramFiles}/${MariaDBVersion}/bin/opt" - "$ENV{SystemDrive}/${MariaDBVersion}/bin/opt" - DOC - "path to your mysql binary.") - - if (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR AND MYSQL_EXECUTABLE) - set(MARIADB_FOUND 1) - endif() - - endmacro(FindLibMariaDB) - - foreach(version ${_MARIADB_KNOWN_VERSIONS}) - if (NOT MARIADB_FOUND) - FindLibMariaDB(${version}) - endif() - endforeach() -endif() - if( UNIX ) set(MYSQL_CONFIG_PREFER_PATH "$ENV{MYSQL_HOME}/bin" CACHE FILEPATH "preferred path to MySQL (mysql_config)" @@ -156,15 +85,12 @@ find_path(MYSQL_INCLUDE_DIR /usr/local/include/mysql /usr/local/mysql/include "C:/tools/mysql/current/include" # chocolatey package - "$ENV{ProgramW6432}/MySQL/MySQL Server 8.1/include" + "$ENV{ProgramW6432}/MySQL/MySQL Server 8.4/include" + "$ENV{ProgramFiles}/MySQL/MySQL Server 8.4/include" + "$ENV{SystemDrive}/MySQL/MySQL Server 8.4/include" "$ENV{ProgramW6432}/MySQL/MySQL Server 8.0/include" - "$ENV{ProgramW6432}/MySQL/MySQL Server 5.7/include" - "$ENV{ProgramFiles}/MySQL/MySQL Server 8.1/include" "$ENV{ProgramFiles}/MySQL/MySQL Server 8.0/include" - "$ENV{ProgramFiles}/MySQL/MySQL Server 5.7/include" - "$ENV{SystemDrive}/MySQL/MySQL Server 8.1/include" "$ENV{SystemDrive}/MySQL/MySQL Server 8.0/include" - "$ENV{SystemDrive}/MySQL/MySQL Server 5.7/include" "$ENV{MYSQL_INCLUDE_DIR}" "$ENV{MYSQL_DIR}/include" DOC @@ -195,15 +121,12 @@ if( WIN32 ) PATHS ${MYSQL_ADD_LIBRARIES_PATH} "C:/tools/mysql/current/lib" # chocolatey package - "$ENV{ProgramW6432}/MySQL/MySQL Server 8.1/lib" + "$ENV{ProgramW6432}/MySQL/MySQL Server 8.4/lib" + "$ENV{ProgramFiles}/MySQL/MySQL Server 8.4/lib" + "$ENV{SystemDrive}/MySQL/MySQL Server 8.4/lib" "$ENV{ProgramW6432}/MySQL/MySQL Server 8.0/lib" - "$ENV{ProgramW6432}/MySQL/MySQL Server 5.7/lib" - "$ENV{ProgramFiles}/MySQL/MySQL Server 8.1/lib" "$ENV{ProgramFiles}/MySQL/MySQL Server 8.0/lib" - "$ENV{ProgramFiles}/MySQL/MySQL Server 5.7/lib" - "$ENV{SystemDrive}/MySQL/MySQL Server 8.1/lib" "$ENV{SystemDrive}/MySQL/MySQL Server 8.0/lib" - "$ENV{SystemDrive}/MySQL/MySQL Server 5.7/lib" "$ENV{MYSQL_LIBRARY}" "$ENV{MYSQL_DIR}/lib" DOC "Specify the location of the mysql library here." @@ -242,15 +165,12 @@ if( WIN32 ) find_program(MYSQL_EXECUTABLE mysql PATHS "C:/tools/mysql/current/bin" # chocolatey package - "$ENV{ProgramW6432}/MySQL/MySQL Server 8.1/bin" + "$ENV{ProgramW6432}/MySQL/MySQL Server 8.4/bin" + "$ENV{ProgramFiles}/MySQL/MySQL Server 8.4/bin" + "$ENV{SystemDrive}/MySQL/MySQL Server 8.4/bin" "$ENV{ProgramW6432}/MySQL/MySQL Server 8.0/bin" - "$ENV{ProgramW6432}/MySQL/MySQL Server 5.7/bin" - "$ENV{ProgramFiles}/MySQL/MySQL Server 8.1/bin" "$ENV{ProgramFiles}/MySQL/MySQL Server 8.0/bin" - "$ENV{ProgramFiles}/MySQL/MySQL Server 5.7/bin" - "$ENV{SystemDrive}/MySQL/MySQL Server 8.1/bin" "$ENV{SystemDrive}/MySQL/MySQL Server 8.0/bin" - "$ENV{SystemDrive}/MySQL/MySQL Server 5.7/bin" "$ENV{MYSQL_ROOT}/bin" DOC "path to your mysql binary.") diff --git a/src/cmake/showoptions.cmake b/src/cmake/showoptions.cmake index 7111990b6f..443584127d 100644 --- a/src/cmake/showoptions.cmake +++ b/src/cmake/showoptions.cmake @@ -153,7 +153,6 @@ if(WITH_STRICT_DATABASE_TYPE_CHECKS) message(" *** WITH_STRICT_DATABASE_TYPE_CHECKS - WARNING!") message(" *** Validates uses of database Get***() functions from Field class") message(" *** invalid calls will result in returning value 0") - message(" *** NOT COMPATIBLE WITH MARIADB!") add_definitions(-DACORE_STRICT_DATABASE_TYPE_CHECKS) endif() diff --git a/src/server/apps/authserver/authserver.conf.dist b/src/server/apps/authserver/authserver.conf.dist index 6cd7372191..13f2f7063d 100644 --- a/src/server/apps/authserver/authserver.conf.dist +++ b/src/server/apps/authserver/authserver.conf.dist @@ -176,8 +176,7 @@ SourceDirectory = "" # MySQLExecutable # Description: The path to your MySQL CLI binary. # If the path is left empty, built-in path from cmake is used. -# Example: "C:/Program Files/MariaDB 10.5/bin/mysql.exe" -# "C:/Program Files/MySQL/MySQL Server 8.0/bin/mysql.exe" +# Example: "C:/Program Files/MySQL/MySQL Server 8.4/bin/mysql.exe" # "mysql.exe" # "/usr/bin/mysql" # Default: "" diff --git a/src/server/apps/worldserver/Main.cpp b/src/server/apps/worldserver/Main.cpp index 0b485bffad..68fb037e83 100644 --- a/src/server/apps/worldserver/Main.cpp +++ b/src/server/apps/worldserver/Main.cpp @@ -386,12 +386,6 @@ int main(int argc, char** argv) sScriptMgr->OnStartup(); -// Be kind and warn people of EOL deprecation :) -#if !defined(MARIADB_VERSION_ID) - if (MySQL::GetLibraryVersion() < 80000) - LOG_WARN("server", "WARNING: You are using MySQL version 5.7 which is soon EOL!\nThis version will be deprecated. Consider upgrading to MySQL 8.0 or 8.1!"); -#endif - // Launch CliRunnable thread std::shared_ptr cliThread; #if AC_PLATFORM == AC_PLATFORM_WINDOWS diff --git a/src/server/database/Database/DatabaseWorkerPool.cpp b/src/server/database/Database/DatabaseWorkerPool.cpp index 3be45ed401..0fd20d4b47 100644 --- a/src/server/database/Database/DatabaseWorkerPool.cpp +++ b/src/server/database/Database/DatabaseWorkerPool.cpp @@ -59,15 +59,10 @@ DatabaseWorkerPool::DatabaseWorkerPool() : { WPFatal(mysql_thread_safe(), "Used MySQL library isn't thread-safe."); -#if !defined(MARIADB_VERSION_ID) || MARIADB_VERSION_ID < 100600 bool isSupportClientDB = mysql_get_client_version() >= MIN_MYSQL_CLIENT_VERSION; bool isSameClientDB = mysql_get_client_version() == MYSQL_VERSION_ID; -#else // MariaDB 10.6+ - bool isSupportClientDB = mysql_get_client_version() >= MIN_MYSQL_CLIENT_VERSION; - bool isSameClientDB = true; // Client version 3.2.3? -#endif - WPFatal(isSupportClientDB, "AzerothCore does not support MySQL versions below 5.7 or MariaDB versions below 10.5.\n\nFound version: {} / {}. Server compiled with: {}.\nSearch the wiki for ACE00043 in Common Errors (https://www.azerothcore.org/wiki/common-errors#ace00043).", + WPFatal(isSupportClientDB, "AzerothCore does not support MySQL versions below 8.0\n\nFound version: {} / {}. Server compiled with: {}.\nSearch the wiki for ACE00043 in Common Errors (https://www.azerothcore.org/wiki/common-errors#ace00043).", mysql_get_client_info(), mysql_get_client_version(), MYSQL_VERSION_ID); WPFatal(isSameClientDB, "Used MySQL library version ({} id {}) does not match the version id used to compile AzerothCore (id {}).\nSearch the wiki for ACE00046 in Common Errors (https://www.azerothcore.org/wiki/common-errors#ace00046).", mysql_get_client_info(), mysql_get_client_version(), MYSQL_VERSION_ID); @@ -378,8 +373,6 @@ void DatabaseWorkerPool::KeepAlive() * * DatabaseIncompatibleVersion("8.0.35") => false * DatabaseIncompatibleVersion("5.6.6") => true -* DatabaseIncompatibleVersion("5.5.5-10.5.5-MariaDB") => false -* DatabaseIncompatibleVersion("5.5.5-10.4.0-MariaDB") => true * * Adapted from stackoverflow response * https://stackoverflow.com/a/2941508 @@ -410,17 +403,6 @@ bool DatabaseIncompatibleVersion(std::string const mysqlVersion) uint8 offset = 0; std::string minVersion = MIN_MYSQL_SERVER_VERSION; - // If the version string contains "MariaDB", use that - if (mysqlVersion.find("MariaDB") != std::string::npos) - { - // All MariaDB 10.X versions have a prefix of 5.5.5 from the - // mysql_get_server_info() function. To make matters more - // annoying, this is removed in MariaDB 11.X - if (mysqlVersion.rfind("5.5.5-", 0) == 0) - offset = 6; - minVersion = MIN_MARIADB_SERVER_VERSION; - } - auto parsedMySQLVersion = parse(mysqlVersion.substr(offset)); auto parsedMinVersion = parse(minVersion); @@ -455,7 +437,7 @@ uint32 DatabaseWorkerPool::OpenConnections(InternalIndex type, uint8 numConne } else if (DatabaseIncompatibleVersion(connection->GetServerInfo())) { - LOG_ERROR("sql.driver", "AzerothCore does not support MySQL versions below 5.7 or MariaDB versions below 10.5.\n\nFound server version: {}. Server compiled with: {}.", + LOG_ERROR("sql.driver", "AzerothCore does not support MySQL versions below 8.0\n\nFound server version: {}. Server compiled with: {}.", connection->GetServerInfo(), MYSQL_VERSION_ID); return 1; } diff --git a/src/server/database/Database/DatabaseWorkerPool.h b/src/server/database/Database/DatabaseWorkerPool.h index 233fd5cf21..fb11b2a4ab 100644 --- a/src/server/database/Database/DatabaseWorkerPool.h +++ b/src/server/database/Database/DatabaseWorkerPool.h @@ -26,31 +26,17 @@ /** @file DatabaseWorkerPool.h */ -/** -* @def MIN_MYSQL_CLIENT_VERSION -* The minimum MariaDB Client Version -* MARIADB_VERSION_ID is defined if using libmariadbclient instead of libmysqlclient -*/ -#if MARIADB_VERSION_ID >= 100600 -#define MIN_MYSQL_CLIENT_VERSION 30203u -#else /** * @def MIN_MYSQL_CLIENT_VERSION * The minimum MySQL Client Version */ -#define MIN_MYSQL_CLIENT_VERSION 50700u -#endif +#define MIN_MYSQL_CLIENT_VERSION 80000u /** * @def MIN_MYSQL_SERVER_VERSION * The minimum MySQL Server Version */ -#define MIN_MYSQL_SERVER_VERSION "5.7.0" -/** -* @def MIN_MARIADB_SERVER_VERSION -* The minimum MariaDB Server Version -*/ -#define MIN_MARIADB_SERVER_VERSION "10.5.0" +#define MIN_MYSQL_SERVER_VERSION "8.0.0" template class ProducerConsumerQueue; @@ -253,4 +239,4 @@ private: #endif }; -#endif +#endif // _DATABASEWORKERPOOL_H diff --git a/src/server/database/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp index 54c393c75b..7303ea82fa 100644 --- a/src/server/database/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -130,7 +130,6 @@ uint32 MySQLConnection::Open() if (m_connectionInfo.ssl != "") { -#if !defined(MARIADB_VERSION_ID) && MYSQL_VERSION_ID >= 80000 mysql_ssl_mode opt_use_ssl = SSL_MODE_DISABLED; if (m_connectionInfo.ssl == "ssl") { @@ -138,15 +137,6 @@ uint32 MySQLConnection::Open() } mysql_options(mysqlInit, MYSQL_OPT_SSL_MODE, (char const*)&opt_use_ssl); -#else - MySQLBool opt_use_ssl = MySQLBool(0); - if (m_connectionInfo.ssl == "ssl") - { - opt_use_ssl = MySQLBool(1); - } - - mysql_options(mysqlInit, MYSQL_OPT_SSL_ENFORCE, (char const*)&opt_use_ssl); -#endif } m_Mysql = reinterpret_cast(mysql_real_connect(mysqlInit, m_connectionInfo.host.c_str(), m_connectionInfo.user.c_str(), @@ -227,7 +217,7 @@ bool MySQLConnection::Execute(PreparedStatementBase* stmt) uint32 _s = getMSTime(); -#if !defined(MARIADB_VERSION_ID) && (MYSQL_VERSION_ID >= 80300) +#if MYSQL_VERSION_ID >= 80300 if (mysql_stmt_bind_named_param(msql_STMT, msql_BIND, m_mStmt->GetParameterCount(), nullptr)) #else if (mysql_stmt_bind_param(msql_STMT, msql_BIND)) @@ -279,7 +269,7 @@ bool MySQLConnection::_Query(PreparedStatementBase* stmt, MySQLPreparedStatement uint32 _s = getMSTime(); -#if !defined(MARIADB_VERSION_ID) && (MYSQL_VERSION_ID >= 80300) +#if MYSQL_VERSION_ID >= 80300 if (mysql_stmt_bind_named_param(msql_STMT, msql_BIND, m_mStmt->GetParameterCount(), nullptr)) #else if (mysql_stmt_bind_param(msql_STMT, msql_BIND)) diff --git a/src/server/database/Updater/DBUpdater.cpp b/src/server/database/Updater/DBUpdater.cpp index 7b3ead0669..ee35fc5e6f 100644 --- a/src/server/database/Updater/DBUpdater.cpp +++ b/src/server/database/Updater/DBUpdater.cpp @@ -493,18 +493,9 @@ void DBUpdater::ApplyFile(DatabaseWorkerPool& pool, std::string const& hos // Set max allowed packet to 1 GB args.emplace_back("--max-allowed-packet=1GB"); -#if !defined(MARIADB_VERSION_ID) && MYSQL_VERSION_ID >= 80000 - if (ssl == "ssl") args.emplace_back("--ssl-mode=REQUIRED"); -#else - - if (ssl == "ssl") - args.emplace_back("--ssl"); - -#endif - // Execute sql file args.emplace_back("-e"); args.emplace_back(Acore::StringFormat("BEGIN; SOURCE {}; COMMIT;", path.generic_string())); diff --git a/src/tools/dbimport/dbimport.conf.dist b/src/tools/dbimport/dbimport.conf.dist index 37ea25e5e7..c4c38e937c 100644 --- a/src/tools/dbimport/dbimport.conf.dist +++ b/src/tools/dbimport/dbimport.conf.dist @@ -54,7 +54,7 @@ SourceDirectory = "" # MySQLExecutable # Description: The path to your MySQL CLI binary. # If the path is left empty, built-in path from cmake is used. -# Example: "C:/Program Files/MariaDB 10.9/bin/mysql.exe" +# Example: "C:/Program Files/MySQL Server 8.4/bin/mysql.exe" # "mysql.exe" # "/usr/bin/mysql" # Default: ""