mdl_backup_controllers table size

mdl_backup_controllers table size

napisao/la Richard Jones -
Broj odgovora: 12
Slika Plugin developers Slika Testers

Hello

Could someone shed light on the purpose of this table?  I just did automated backups on Moodle 2.0 and it suddenly has 22,500 entries and takes up 1.6 Gb of space making it easily the biggest table in the database.

Obviously this has knock-on effects in terms of routine Moodle site backups as well.

Thanks.

Richard

U odgovoru na Richard Jones

Re: mdl_backup_controllers table size

napisao/la Richard Jones -
Slika Plugin developers Slika Testers

Well, in case anyone is interested.  I made a copy of the table and emptied it.  It was re-created at a more reasonable size on the next autobackup.

U odgovoru na Richard Jones

Backup controllers table size is MASSIVE!!

napisao/la Paul Vaughan -

Very interested indeed!!

Our Moodle 2 database is 3.4Gb of which 3.0Gb is the backup_controllers table. This is a phenomenal amount of space really, and while it's not at a premium on our db server, it's good practice to keep usage to a minimum!!

If anyone can shed some light on this, it would be useful indeed.

U odgovoru na Paul Vaughan

Re: Backup controllers table size is MASSIVE!!

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers

This seems to be a common problem.  I am working on a script to run to automatically delete old records in this table and will post when I have it.  In the meantime you can truncate the table and it will not negatively affect anything.

(Maybe this was you!) but it is reported at

Please vote! 

U odgovoru na Emma Richardson

Re: Backup controllers table size is MASSIVE!!

napisao/la Paul Vaughan -

Yes, that was me, I forgot to post it here, so thanks for that.

As we've just installed a bunch of new software onto a bunch of new virtualised hardware, I am watching our systems like a hawk, but would like to see your script as and when you complete it. smešak

U odgovoru na Paul Vaughan

Re: Backup controllers table size is MASSIVE!!

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers

Ok, so I have the script working on another table but in my testing today I managed to delete all records in the controllers table (before I got smart enough to use the SELECT command first!!) so I want to wait a couple of days to let the records build up so that I can run it on that table and make sure everything works as it should before I post it.

It is a simple script file that can then be added into your cron and ran as often as you like. 

U odgovoru na Paul Vaughan

Re: Backup controllers table size is MASSIVE!!

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers

Sorry for the slow response.  Here is the process for deleting out old config controllers and keeping the table size to a minimum.  I have run this successfully from terminal and have it set up to run through cron tonight and will post if there are any problems.

I created a script which I have saved as controllers.sh.  This is just a simple file with the following script:

#!/bin/bash

mysql -u YOURDATABASEUSERHERE -pYOURPASSWORDHERE moodle <<EOF

DELETE FROM mdl_backup_controllers WHERE timecreated< unix_timestamp(now() - interval 7 day)

EOF

 

Put in your database username after the -u and your database password after -p (no space here). 

If your database is not called moodle, then change this to the appropriate name. This will delete out all controllers over a week old.

 

I have then made the following entry to crontab:

00 01 * * * bash /home/moodle/Desktop/controllers.sh

 

This should run the script nightly, though I have had issues with bash scripts through cron before so will post tomorrow if it does not run as expected. This is the direct path to where I put the script file - you will obviously need to direct it to wherever your script file is.


U odgovoru na Emma Richardson

Re: Backup controllers table size is MASSIVE!!

napisao/la marcos gonzalez -

Hi

Thanks for the script, recovering this thread, I don't understand If exist any patch to resolv withouth upgrading version.

IF I pass the script, database not will be corrupted?

Thanks for your time smešak

 

U odgovoru na marcos gonzalez

Re: Backup controllers table size is MASSIVE!!

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers

I am not sure if that been any resolution to this issue - I am running 2.4.1 and I am pretty sure I am still running the script but maybe I don't need to!!  All it does is delete anything a week old in that table.  I have not had any issues with the database and I use cron to run it nightly. 

U odgovoru na Emma Richardson

Re: Backup controllers table size is MASSIVE!!

napisao/la marcos gonzalez -

Thanks for the appointment. I need to know for what I need this table, in my case we save log 5 years of activity, and I don't know IF this table only Is used for automatic backups or for any more.

Deleting this table affects any other content? I only save 1 week of automatic backups.

Thanks

U odgovoru na marcos gonzalez

Re: Backup controllers table size is MASSIVE!!

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers

All this table does is log the actions taken by the backup process - it does not affect any data at all.  I know it is scary to delete out data from a table but I have not had any effect from clearing this one out.  If you are worried, you can always make a copy of the table with the data first, truncate the old table or run the script, see that nothing breaks and then delete the copied table.

U odgovoru na Emma Richardson

Re: Backup controllers table size is MASSIVE!!

napisao/la nilesh k -

I am new in moodle & I also suffering same issue.

Can any one guide where I have to store this controllers.sh script & how to run.

Thanks for help.

 

 

U odgovoru na nilesh k

Re: Backup controllers table size is MASSIVE!!

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers

You can store it wherever you want on your server and then just create the entry in cron and make sure it points to the location of the script as detailed above.