Skip to content

Commit

Permalink
Add a warning if --innodb_snapshot_isolation=ON is set.
Browse files Browse the repository at this point in the history
See #2848.
  • Loading branch information
meisterT committed Nov 24, 2024
1 parent cbadb70 commit 62a319c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions webapp/src/Controller/Jury/JuryMiscController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ public function __construct(
#[Route(path: '', name: 'jury_index')]
public function indexAction(ConfigurationService $config): Response
{
if ($this->isGranted('ROLE_ADMIN')) {
$innodbSnapshotIsolation = $this->em->getConnection()->query('SHOW VARIABLES LIKE "innodb_snapshot_isolation"')->fetchAssociative();
if ($innodbSnapshotIsolation && $innodbSnapshotIsolation['Value'] === 'ON') {
$this->addFlash('danger', 'InnoDB snapshot isolation is enabled. Set --innodb_snapshot_isolation=OFF in your MariaDB configuration. See https://github.com/DOMjudge/domjudge/issues/2848 for more information.');
}
}

return $this->render('jury/index.html.twig', [
'adminer_enabled' => $config->get('adminer_enabled'),
'CCS_SPEC_API_URL' => GI::CCS_SPEC_API_URL,
Expand Down
13 changes: 12 additions & 1 deletion webapp/src/Service/CheckConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,16 @@ public function checkMysqlSettings(): ConfigCheckItem
$r = $this->em->getConnection()->fetchAllAssociative(
'SHOW variables WHERE Variable_name IN
("innodb_log_file_size", "max_connections", "max_allowed_packet",
"tx_isolation", "transaction_isolation")'
"tx_isolation", "transaction_isolation", "innodb_snapshot_isolation")'
);

$vars = [];
foreach ($r as $row) {
$vars[$row['Variable_name']] = $row['Value'];
}
if (!isset($vars['innodb_snapshot_isolation'])) {
$vars['innodb_snapshot_isolation'] = false;
}
# MySQL 8 has "transaction_isolation" instead of "tx_isolation".
if (isset($vars['transaction_isolation'])) {
$vars['tx_isolation'] = $vars['transaction_isolation'];
Expand Down Expand Up @@ -251,6 +255,13 @@ public function checkMysqlSettings(): ConfigCheckItem
$desc .= sprintf("max_allowed_packet is set to %s.\n", Utils::printsize((int)$vars['max_allowed_packet']));
}

if ($vars['innodb_snapshot_isolation'] === 'ON') {
$result = 'E';
$desc .= 'InnoDB snapshot isolation is enabled. Set --innodb_snapshot_isolation=OFF in your MariaDB configuration. See https://github.com/DOMjudge/domjudge/issues/2848 for more information.';
} else {
$desc .= "InnoDB snapshot isolation is disabled.\n";
}

$this->stopwatch->stop(__FUNCTION__);
return new ConfigCheckItem(
caption: 'MySQL settings',
Expand Down

0 comments on commit 62a319c

Please sign in to comment.