From 682fad193a536d4265dd6ada131ed7a682bffddb Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 12 Sep 2023 00:43:31 -0700 Subject: [PATCH] Upgrader - Skip snapshots on some MariaDB env's (roughly: 10.6.0-10.6.5) --- CRM/Upgrade/Snapshot.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CRM/Upgrade/Snapshot.php b/CRM/Upgrade/Snapshot.php index 4e1addf2fafa..5c3f4ef15734 100644 --- a/CRM/Upgrade/Snapshot.php +++ b/CRM/Upgrade/Snapshot.php @@ -44,8 +44,20 @@ class CRM_Upgrade_Snapshot { public static function getActivationIssues(): array { if (static::$activationIssues === NULL) { $policy = CRM_Utils_Constant::value('CIVICRM_UPGRADE_SNAPSHOT', 'auto'); + static::$activationIssues = []; + + $version = CRM_Utils_SQL::getDatabaseVersion(); + if (stripos($version, 'mariadb') !== FALSE) { + // MariaDB briefly (10.6.0-10.6.5) flirted with the idea of phasing-out `COMPRESSED`. By default, snapshots won't work on those versions. + // https://mariadb.com/kb/en/innodb-compressed-row-format/#read-only + $roCompressed = CRM_Core_DAO::singleValueQuery('SELECT @@innodb_read_only_compressed'); + if (in_array($roCompressed, ['on', 'ON', 1, '1'])) { + static::$activationIssues['row_compressed'] = ts('This MariaDB instance does not allow creating compressed snapshots.'); + } + } + if ($policy === TRUE) { - return []; + return static::$activationIssues; } $limits = [ @@ -57,7 +69,6 @@ public static function getActivationIssues(): array { 'civicrm_event' => 200 * 1000, ]; - static::$activationIssues = []; foreach ($limits as $table => $limit) { try { // Use select MAX(id) rather than COUNT as COUNT is slow on large databases.