Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrader - Skip snapshots on some MariaDB env's (roughly: 10.6.0-10.6.5) #27404

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions CRM/Upgrade/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm this variable doesn't exist on mariadb 10.3 so it's a hard crash. From the docs it looks like it doesn't exist until 10.6?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR: #27464

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 = [
Expand All @@ -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.
Expand Down