Skip to content

Commit 62a319c

Browse files
committed
Add a warning if --innodb_snapshot_isolation=ON is set.
See #2848.
1 parent cbadb70 commit 62a319c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Diff for: webapp/src/Controller/Jury/JuryMiscController.php

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ public function __construct(
4949
#[Route(path: '', name: 'jury_index')]
5050
public function indexAction(ConfigurationService $config): Response
5151
{
52+
if ($this->isGranted('ROLE_ADMIN')) {
53+
$innodbSnapshotIsolation = $this->em->getConnection()->query('SHOW VARIABLES LIKE "innodb_snapshot_isolation"')->fetchAssociative();
54+
if ($innodbSnapshotIsolation && $innodbSnapshotIsolation['Value'] === 'ON') {
55+
$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.');
56+
}
57+
}
58+
5259
return $this->render('jury/index.html.twig', [
5360
'adminer_enabled' => $config->get('adminer_enabled'),
5461
'CCS_SPEC_API_URL' => GI::CCS_SPEC_API_URL,

Diff for: webapp/src/Service/CheckConfigService.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,16 @@ public function checkMysqlSettings(): ConfigCheckItem
198198
$r = $this->em->getConnection()->fetchAllAssociative(
199199
'SHOW variables WHERE Variable_name IN
200200
("innodb_log_file_size", "max_connections", "max_allowed_packet",
201-
"tx_isolation", "transaction_isolation")'
201+
"tx_isolation", "transaction_isolation", "innodb_snapshot_isolation")'
202202
);
203+
203204
$vars = [];
204205
foreach ($r as $row) {
205206
$vars[$row['Variable_name']] = $row['Value'];
206207
}
208+
if (!isset($vars['innodb_snapshot_isolation'])) {
209+
$vars['innodb_snapshot_isolation'] = false;
210+
}
207211
# MySQL 8 has "transaction_isolation" instead of "tx_isolation".
208212
if (isset($vars['transaction_isolation'])) {
209213
$vars['tx_isolation'] = $vars['transaction_isolation'];
@@ -251,6 +255,13 @@ public function checkMysqlSettings(): ConfigCheckItem
251255
$desc .= sprintf("max_allowed_packet is set to %s.\n", Utils::printsize((int)$vars['max_allowed_packet']));
252256
}
253257

258+
if ($vars['innodb_snapshot_isolation'] === 'ON') {
259+
$result = 'E';
260+
$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.';
261+
} else {
262+
$desc .= "InnoDB snapshot isolation is disabled.\n";
263+
}
264+
254265
$this->stopwatch->stop(__FUNCTION__);
255266
return new ConfigCheckItem(
256267
caption: 'MySQL settings',

0 commit comments

Comments
 (0)