Skip to content

Commit ef55f05

Browse files
committed
Always show MySQL variables, also if check is ok
This helps quickly inspecting settings, in my case for example the MySQL transaction isolation level. We should probably do this for all configuration settings.
1 parent 4aacc80 commit ef55f05

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

webapp/src/Service/CheckConfigService.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,37 +219,43 @@ public function checkMysqlSettings(): ConfigCheckItem
219219
$max_inout = max($max_inout, $output_limit);
220220

221221
$result = 'O';
222-
$desc = '';
222+
$desc = sprintf("max_connections is set to %s.\n", $vars['max_connections']);
223223
if ($vars['max_connections'] < 300) {
224224
$result = 'W';
225-
$desc .= sprintf("MySQL's max_connections is set to %s. In our experience you need at least 300, but better 1000 connections to prevent connection refusal during the contest.\n", $vars['max_connections']);
225+
$desc .= sprintf("In our experience you need at least 300, but better 1000 connections to prevent connection refusal during the contest.\n");
226226
}
227227

228228
if ($vars['innodb_log_file_size'] < 10 * $max_inout) {
229229
$result = 'W';
230-
$desc .= sprintf("MySQL's innodb_log_file_size is set to %s. You may want to raise this to 10x the maximum of the test case size and output (storage) limit (now %s).\n", Utils::printsize((int)$vars['innodb_log_file_size']), Utils::printsize($max_inout));
230+
$desc .= sprintf("innodb_log_file_size is set to %s. You may want to raise this to 10x the maximum of the test case size and output (storage) limit (now %s).\n", Utils::printsize((int)$vars['innodb_log_file_size']), Utils::printsize($max_inout));
231+
} else {
232+
$desc .= sprintf("innodb_log_file_size is set to %s. \n", Utils::printsize((int)$vars['innodb_log_file_size']));
231233
}
232234

233235
$tx = ['REPEATABLE-READ', 'SERIALIZABLE'];
234236
if (!in_array($vars['tx_isolation'], $tx)) {
235237
$result = 'W';
236-
$desc .= sprintf("MySQL's transaction isolation level is set to %s. You should set this to %s to prevent data inconsistencies.\n", $vars['tx_isolation'], implode(' or ', $tx));
238+
$desc .= sprintf("transaction isolation level is set to %s. You should set this to %s to prevent data inconsistencies.\n", $vars['tx_isolation'], implode(' or ', $tx));
239+
} else {
240+
$desc .= sprintf("transaction isolation level is set to %s.\n", $vars['tx_isolation']);
237241
}
238242

239243
$recommended_max_allowed_packet = 16*1024*1024;
240244
if ($vars['max_allowed_packet'] < 2*$max_inout) {
241245
$result = 'E';
242-
$desc .= sprintf("MySQL's max_allowed_packet is set to %s. You may want to raise this to about twice the maximum of the test case size and output (storage) limit (currently %s).\n", Utils::printsize((int)$vars['max_allowed_packet']), Utils::printsize($max_inout));
246+
$desc .= sprintf("max_allowed_packet is set to %s. You may want to raise this to about twice the maximum of the test case size and output (storage) limit (currently %s).\n", Utils::printsize((int)$vars['max_allowed_packet']), Utils::printsize($max_inout));
243247
} elseif ($vars['max_allowed_packet'] < $recommended_max_allowed_packet) {
244248
$result = 'W';
245-
$desc .= sprintf("MySQL's max_allowed_packet is set to %s. We recommend at least 16MB.\n", Utils::printsize((int)$vars['max_allowed_packet']));
249+
$desc .= sprintf("max_allowed_packet is set to %s. We recommend at least 16MB.\n", Utils::printsize((int)$vars['max_allowed_packet']));
250+
} else {
251+
$desc .= sprintf("max_allowed_packet is set to %s.\n", Utils::printsize((int)$vars['max_allowed_packet']));
246252
}
247253

248254
$this->stopwatch->stop(__FUNCTION__);
249255
return new ConfigCheckItem(
250256
caption: 'MySQL settings',
251257
result: $result,
252-
desc: $desc ?: 'MySQL settings are all ok'
258+
desc: $desc
253259
);
254260
}
255261

0 commit comments

Comments
 (0)