Need better log_debug output from lib/db/upgrade.php
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Robert Lyon | ||
15.10 |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
One of the most annoying things about db locking up during upgrade is you don't know where abouts in the upgrade you are - because it doesn't error out.
It would be most useful if there was:
1) At least a log_debug line at the start of every if version block - there are often comments there so just turn them into log_debug() comments.
2) Every time we loop over a bunch of results we should have a loop counter, so upgrader knows things are still running eg:
if ($results) {
$count = 0;
$limit = 1000; // where limit is some appropriate number
$total = count($results);
foreach ($results as $result) {
... the purpose happens here ...
$count++;
if (($count % $limit) == 0 || $count == $total) {
}
}
Changed in mahara: | |
status: | New → Confirmed |
Changed in mahara: | |
status: | Confirmed → In Progress |
assignee: | nobody → Robert Lyon (robertl-9) |
milestone: | none → 15.10.0 |
importance: | Undecided → Medium |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
While we're at it, it would also be good to save the upgrade state after each of those blocks as well. So that if you make it through three blocks and fail on the fourth, you can try again and start at the fourth.
Which I think is sort of how Moodle does it. Maybe it's time we refactor our upgrade a little? Have a method you call at the start of each of these blocks, that logs and updates the version number.