Did the Backup Fail? 3 reports and 3 different answers.

Did the Backup Fail? 3 reports and 3 different answers.

by Sam Drong -
Number of replies: 2

I'm not sure if my backups are failing. Could someone please explain to me why I am getting discrepencies from different reports. Also, which report should I believe?


I ran the cron by visiting /admin/cron.php. The backup section of the log reads:

Running required automated backups...
Backing up Electrical Association...complete - next execution: Thursday, 4 October 2012, 5:15 AM
Backing up Electrical Exam Prep Course...complete - next execution: Thursday, 4 October 2012, 5:15 AM
Backing up Apprentice Year 1...complete - next execution: Thursday, 4 October 2012, 5:15 AM
Backing up Apprentice Test-Out...complete - next execution: Thursday, 4 October 2012, 5:15 AM
Backing up Apprentice Year 2...complete - next execution: Thursday, 4 October 2012, 5:15 AM
Backing up Apprentice Year 3...complete - next execution: Thursday, 4 October 2012, 5:15 AM
Backing up Apprentice Year 4...complete - next execution: Thursday, 4 October 2012, 5:15 AM
Sending email to admin
Automated backups complete.

As you can see, each of the 7 courses in my system are marked as complete. When I receive the admin email. It reads:

Summary
==================================================
  Courses: 7
  OK: 5
  Skipped: 0
  Error: 0
  Unfinished: 2
  Some of your courses weren't saved!!
  Please take a look at your backup logs in:
  http://<mywebsite>/report/backups/index.php

As you can see here, it explains that 2 courses did not complete. It doesn't say there is an error, it simply says they are unfinished. When view the backups log I get the following:

Could someone tell me what to believe? Should I believe the cron log or email/backup execution log? Per the Backup and restore FAQ's, I have tried increasing PHP/Apache limits on memory and execution time. It has not helped.

Thank you.

I am currently running 2.3.1+ (Build: 20120726).

Average of ratings: -
In reply to Sam Drong

Re: Did the Backup Fail? 3 reports and 3 different answers.

by Ken Task -
Picture of Particularly helpful Moodlers

By chance are those two courses larger than the others?  By that I mean, has many links to files that have been uploaded.  Do they have at test bank?

Check moodledata/temp/backup/ folder to see if there are files/folders remaining from failed backups.  A failed backup will have a hashed.log name of greater than 0 bytes.  Those are text and might give a clue/hint as to the problem.

The files contained in moodledata/temp/backup/ can be safely deleted by other means without affecting Moodle.

After those are deleted try manually backing one of them up.

MIght have to turn on debugging and then step thourgh manually backing up one of those failed courses.

You might need to increase max_packets_size for the DB.

my.cnf (the config file for MySQL on a Linux server) has a section shown as [mysqld].

In that section, type: max_allowed_packet=16M (size is a guess).

If you make changes to my.cnf (MySQL config) one must restart MySQL.

'spirit of sharing', Ken

In reply to Ken Task

Re: Did the Backup Fail? 3 reports and 3 different answers.

by Sam Drong -

Yes, the two courses are larger. They both have links to uploaded files and they also have a 150+ question test bank.

I deleted all the temp files and folders in moodledata/temp/backup/. I ran a manual backup with full debugging on and got the following errors.

Error reading from database
Debug info: MySQL server has gone away
SELECT count(r.repositoryid)
FROM mea_files f
LEFT JOIN mea_files_reference r
ON r.id = f.referencefileid
JOIN mea_backup_ids_temp bi
ON f.id = bi.itemid
WHERE bi.backupid = ?
AND bi.itemname = 'filefinal'
[array (
0 => '00a8cf04a06c8847f6072f538f16c561',
)]
Error code: dmlreadexception
Stack trace:
  • line 407 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 945 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1346 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
  • line 1419 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
  • line 1590 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
  • line 429 of /backup/util/dbops/backup_controller_dbops.class.php: call to moodle_database->count_records_sql()
  • line 1593 of /backup/moodle2/backup_stepslib.php: call to backup_controller_dbops::backup_includes_file_references()
  • line 34 of /backup/util/plan/backup_execution_step.class.php: call to backup_store_backup_file->define_execution()
  • line 153 of /backup/util/plan/base_task.class.php: call to backup_execution_step->execute()
  • line 163 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
  • line 110 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
  • line 309 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
  • line 111 of /backup/util/ui/backup_ui.class.php: call to backup_controller->execute_plan()
  • line 89 of /backup/backup.php: call to backup_ui->execute()
Debug info: MySQL server has gone away
SELECT
bi.id,
bp.id AS blockpositionid,
bi.blockname,
bi.parentcontextid,
bi.showinsubcontexts,
bi.pagetypepattern,
bi.subpagepattern,
bi.defaultregion,
bi.defaultweight,
COALESCE(bp.visible, 1) AS visible,
COALESCE(bp.region, bi.defaultregion) AS region,
COALESCE(bp.weight, bi.defaultweight) AS weight,
bi.configdata
, ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance

FROM mea_block_instances bi
JOIN mea_block b ON bi.blockname = b.name
LEFT JOIN mea_block_positions bp ON bp.blockinstanceid = bi.id
AND bp.contextid = ?
AND bp.pagetype = ?
AND bp.subpage = ?
LEFT JOIN mea_context ctx ON (ctx.instanceid = bi.id AND ctx.contextlevel = 80)

WHERE
(bi.parentcontextid = ? OR (bi.showinsubcontexts = 1 AND bi.parentcontextid IN (?,?)))
AND bi.pagetypepattern IN (?,?,?,?)
AND (bi.subpagepattern IS NULL OR bi.subpagepattern = ?)
AND (bp.visible = 1 OR bp.visible IS NULL)
AND b.visible = 1

ORDER BY
COALESCE(bp.region, bi.defaultregion),
COALESCE(bp.weight, bi.defaultweight),
bi.id
[array (
0 => '15',
1 => 'backup-backup',
2 => '',
3 => '15',
4 => '3',
5 => '1',
6 => 'backup-backup',
7 => 'backup-backup-*',
8 => 'backup-*',
9 => '*',
10 => '',
)]
Error code: dmlreadexception
Stack trace:
  • line 407 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 903 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 604 of /lib/blocklib.php: call to mysqli_native_moodle_database->get_recordset_sql()
  • line 1381 of /lib/pagelib.php: call to block_manager->load_blocks()
  • line 847 of /lib/pagelib.php: call to moodle_page->starting_output()
  • line 707 of /lib/outputrenderers.php: call to moodle_page->set_state()
  • line 2190 of /lib/outputrenderers.php: call to core_renderer->header()
  • line 366 of /lib/setuplib.php: call to core_renderer->fatal_error()
  • line ? of unknownfile: call to default_exception_handler()

Fatal error: Uncaught exception 'dml_read_exception' with message 'Error reading from database' in /home/elect103/public_html/lib/dml/moodle_database.php:407 Stack trace: #0 /home/elect103/public_html/lib/dml/mysqli_native_moodle_database.php(461): moodle_database->query_end(false) #1 /home/elect103/public_html/lib/ddl/sql_generator.php(230): mysqli_native_moodle_database->get_tables() #2 /home/elect103/public_html/lib/ddl/database_manager.php(104): sql_generator->table_exists(Object(xmldb_table)) #3 /home/elect103/public_html/lib/ddl/database_manager.php(310): database_manager->table_exists(Object(xmldb_table)) #4 /home/elect103/public_html/lib/dml/moodle_temptables.php(131): database_manager->drop_table(Object(xmldb_table)) #5 /home/elect103/public_html/lib/dml/moodle_database.php(333): moodle_temptables->dispose() #6 /home/elect103/public_html/lib/dml/mysqli_native_moodle_database.php(416): moodle_database->dispose() #7 /home/elect103/public_html/lib/dml/moodle_database.php(143): mysqli_native_moodle_database->dispose( in /home/elect103/public_html/lib/dml/moodle_database.php on line 407


I have not tried changing the my.cnf file yet. I will try that tonight during our maintenance time window.

Thank you Ken for your help thus far.

--Sam