From 82c2d98fa2a24bb2d3eaf6c4f847812bf7f34e4b Mon Sep 17 00:00:00 2001 From: Matteo Scaramuccia Date: Tue, 29 May 2018 00:18:52 +0200 Subject: [PATCH] MDL-61702 dml: MariaDB 10.3 supports only the Barracuda file format. More details about this change also in https://tracker.moodle.org/browse/MDL-59099 Ref.: https://mariadb.com/kb/en/library/mariadb-1031-release-notes/#other-variables --- lib/dml/mysqli_native_moodle_database.php | 33 ++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/lib/dml/mysqli_native_moodle_database.php b/lib/dml/mysqli_native_moodle_database.php index c3e2e66e381..b0a6a70f344 100644 --- a/lib/dml/mysqli_native_moodle_database.php +++ b/lib/dml/mysqli_native_moodle_database.php @@ -293,6 +293,29 @@ class mysqli_native_moodle_database extends moodle_database { return $collation; } + /** + * Tests if the Antelope file format is still supported or it has been removed. + * When removed, only Barracuda file format is supported, given the XtraDB/InnoDB engine. + * + * @return bool True if the Antelope file format has been removed; otherwise, false. + */ + protected function is_antelope_file_format_no_more_supported() { + // Breaking change: Antelope file format support has been removed from both MySQL and MariaDB. + // The following InnoDB file format configuration parameters were deprecated and then removed: + // - innodb_file_format + // - innodb_file_format_check + // - innodb_file_format_max + // - innodb_large_prefix + // 1. MySQL: deprecated in 5.7.7 and removed 8.0.0+. + $ismysqlge8d0d0 = ($this->get_dbtype() == 'mysqli') && + version_compare($this->get_server_info()['version'], '8.0.0', '>='); + // 2. MariaDB: deprecated in 10.2.0 and removed 10.3.1+. + $ismariadbge10d3d1 = ($this->get_dbtype() == 'mariadb') && + version_compare($this->get_server_info()['version'], '10.3.1', '>='); + + return $ismysqlge8d0d0 || $ismariadbge10d3d1; + } + /** * Get the row format from the database schema. * @@ -307,9 +330,8 @@ class mysqli_native_moodle_database extends moodle_database { FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = DATABASE() AND table_name = '{$this->prefix}$table'"; } else { - if (($this->get_dbtype() == 'mysqli') && - // Breaking change in MySQL 8.0.0+: antelope file format support has been removed. - version_compare($this->get_server_info()['version'], '8.0.0', '>=')) { + if ($this->is_antelope_file_format_no_more_supported()) { + // Breaking change: Antelope file format support has been removed, only Barracuda. $dbengine = $this->get_dbengine(); $supporteddbengines = array('InnoDB', 'XtraDB'); if (in_array($dbengine, $supporteddbengines)) { @@ -396,9 +418,8 @@ class mysqli_native_moodle_database extends moodle_database { * @return bool True if on otherwise false. */ public function is_large_prefix_enabled() { - if (($this->get_dbtype() == 'mysqli') && - // Breaking change since 8.0.0: there is only one file format and 'innodb_large_prefix' has been removed. - version_compare($this->get_server_info()['version'], '8.0.0', '>=')) { + if ($this->is_antelope_file_format_no_more_supported()) { + // Breaking change: Antelope file format support has been removed, only Barracuda. return true; } -- 2.43.0