Error writing to database

Re: Error writing to database

by Ken Task -
Number of replies: 4
Picture of Particularly helpful Moodlers

Well, if it consistently fails, trying the same way without any changes will probably result in same - failed restore. (been there myself!)   Checking error logs shows nothing new?   In the moodledata directory ./temp/backup/ is there a .log file that has the same content hash name as the directory that was being used to restore the course?   That .log file is ascii and can be opened with any text editor.   It won't give any humanly understandable info cept for a number which corresponds to the plan for restoring the course.    1000 seen, then the restore completed - any number below that kinda indicates the point at which it failed .... users, quizzes, activities, etc. are handled differently.

It's further along that it was ... right?   How about increasing values for PHP and MySQL higher ... you can always back them down later.

Just how big is this backup?   Have some tinker servers that we can use if you want further inspection of the issue (not that this offer will resolve it).

PM me and provide a real EMail addy and I'll set you up in one so you can upload the backup so that I can inspect.

'spirit of sharing', Ken

In reply to Ken Task

Re: Error writing to database

by JC Dodo -

Hi Ken,

I just PMed you. What are those particular values in PHP and MySQL to change?


I suspect the issue is on MySQL because I tried to use test MySQL with the same values to prod one and it works perfectly to restore the backup file. Now, when I tried to use test server to host the moodle and use the prod. mysql, it will cause the issue.


I am a bit hardly find the issue on my prod mysql because both test and prod are literally the same values. Very strange...

In reply to JC Dodo

Re: Error writing to database

by Ken Task -
Picture of Particularly helpful Moodlers

In php.ini, Time script can run, memory a script can consume.  You can see those in your phpinfo link from the Moodle.

MySQL - max_allowed_packet sometimes bites if set to default.  Have to add a line to your my.cnf file and give that variable at least 1G.

The values are anyone's guess.   Bump them up ... whatever they are X2.

Restart apache service for them to take affect.   Check the PHP settings via PHPInfo link from your Moodle.

If production server on shared host or in a jail of some sort, there might be caps.

'spirit of sharing', Ken


In reply to JC Dodo

Re: Error writing to database

by Ken Task -
Picture of Particularly helpful Moodlers

JW and I have been tinkering on another server ...

Course backup was 850 Megs.

PHP/MySQL settings on the tinker box where your course was semi-successfully
restored.  Issues with restore had to do with aliases files and the repo
not present on restore box.   Grade book issues ... for which I've really
not clue but might related to users authenticating on something else ... so I think only those users that had manual accounts were restored.   Role mappings.

CentOS 5.highest
16 Gig Mem
PHP/5.5.38
max_execution_time    120
max_input_vars    1500
memory_limit    256M
post_max_size    850M
upload_max_filesize    850M

MySQL Vr 5.5.37
Settings:
max_allowed_packet=1G
open_files_limit=6000
innodb_buffer_pool_size=4G
innodb_buffer_pool_instances=4

Not sure that helps ... but there ya go! ;)

@ JW ... production system settings are?

'spirit of sharing', Ken


In reply to Ken Task

Re: Error writing to database

by JC Dodo -

It seems the issue is on my database server which needs to improved on disk storage type to use.

BTW, Thanks Ken for your help and really appreciate your effort smile