Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Desportes <williamdes@wdes.fr>2022-10-01 00:42:22 +0300
committerWilliam Desportes <williamdes@wdes.fr>2022-10-01 00:49:58 +0300
commit5d48e1006bf2e81dad0ceb75d72ad89ef980e55b (patch)
tree4addd8891ee277ba0afe4f316cae6b362d8ae013 /libraries
parentb5e20ad8f4bdbcf18aa9662d612338aa1cdcdf93 (diff)
parent49b4951cbb3df1a8b76da4a3e0290af96c6f8674 (diff)
Merge #17657 - Supporting the column compression option on MariaDB
Pull-request: #17657 Ref: #14956 Signed-off-by: William Desportes <williamdes@wdes.fr>
Diffstat (limited to 'libraries')
-rw-r--r--libraries/classes/Query/Compatibility.php14
-rw-r--r--libraries/classes/Types.php12
-rw-r--r--libraries/classes/Util.php11
3 files changed, 36 insertions, 1 deletions
diff --git a/libraries/classes/Query/Compatibility.php b/libraries/classes/Query/Compatibility.php
index aa1ab6829f..5f995951f6 100644
--- a/libraries/classes/Query/Compatibility.php
+++ b/libraries/classes/Query/Compatibility.php
@@ -214,6 +214,20 @@ class Compatibility
}
/**
+ * Returns whether the database server supports compressed columns
+ */
+ public static function supportsCompressedColumns(int $serverVersion): bool
+ {
+ // @see https://mariadb.com/kb/en/innodb-page-compression/#comment_1992
+ // Comment: Page compression is only available in MariaDB >= 10.1. [...]
+ if (self::isMariaDb()) {
+ return $serverVersion >= 100100;
+ }
+
+ return false;
+ }
+
+ /**
* @see https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-6.html#mysqld-5-7-6-account-management
* @see https://mariadb.com/kb/en/mariadb-1042-release-notes/#notable-changes
*
diff --git a/libraries/classes/Types.php b/libraries/classes/Types.php
index 12f7a7e4cf..4c2b2eeb78 100644
--- a/libraries/classes/Types.php
+++ b/libraries/classes/Types.php
@@ -7,6 +7,8 @@ declare(strict_types=1);
namespace PhpMyAdmin;
+use PhpMyAdmin\Query\Compatibility;
+
use function __;
use function _pgettext;
use function array_diff;
@@ -713,13 +715,21 @@ class Types
*/
public function getAttributes()
{
- return [
+ $serverVersion = $this->dbi->getVersion();
+
+ $attributes = [
'',
'BINARY',
'UNSIGNED',
'UNSIGNED ZEROFILL',
'on update CURRENT_TIMESTAMP',
];
+
+ if (Compatibility::supportsCompressedColumns($serverVersion)) {
+ $attributes[] = 'COMPRESSED=zlib';
+ }
+
+ return $attributes;
}
/**
diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php
index 8338d8e003..2e5a88159b 100644
--- a/libraries/classes/Util.php
+++ b/libraries/classes/Util.php
@@ -1373,6 +1373,7 @@ class Util
$binary = false;
$unsigned = false;
$zerofill = false;
+ $compressed = false;
} else {
$enumSetValues = [];
@@ -1394,6 +1395,8 @@ class Util
$zerofill = ($zerofillCount > 0);
$printType = (string) preg_replace('@unsigned@', '', $printType, -1, $unsignedCount);
$unsigned = ($unsignedCount > 0);
+ $printType = (string) preg_replace('@\/\*!100301 compressed\*\/@', '', $printType, -1, $compressedCount);
+ $compressed = ($compressedCount > 0);
$printType = trim($printType);
}
@@ -1410,6 +1413,14 @@ class Util
$attribute = 'UNSIGNED ZEROFILL';
}
+ if ($compressed) {
+ // With InnoDB page compression, multiple compression algorithms are supported.
+ // In contrast, with InnoDB's COMPRESSED row format, zlib is the only supported compression algorithm.
+ // This means that the COMPRESSED row format has less compression options than InnoDB page compression does.
+ // @see https://mariadb.com/kb/en/innodb-page-compression/#comparison-with-the-compressed-row-format
+ $attribute = 'COMPRESSED=zlib';
+ }
+
$canContainCollation = false;
if (! $binary && preg_match('@^(char|varchar|text|tinytext|mediumtext|longtext|set|enum)@', $type)) {
$canContainCollation = true;