I stumbled on this issue due to a high increase of our DB resources upgrading to Moodle 3.8
Our mdl_logstore_standard_log went up to 40 gb.
Our first step was decreasing the logs we saved in the database, it gave us a 50% win, though we are stuck on the 20GB.
Which still is too much in our opinion.
I checked out the UI of the LOGS and found out that every minute there CLI > event name "Calendar event updated" > the user with id 'x' updated the event 'name assignment'. And we run alot of assignments on this Moodle site, with alot of due dates etc.
I think - not sure - that this event seems to being triggerd by \mod_assign\task\cron_task
The tasks completes just fine, but shows a continue stream of errors like the one below:
++ Error: mdb->get_record() found more than one record! ++
* line 1599 of /lib/dml/moodle_database.php: call to debugging()
* line 1660 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
* line 1641 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
* line 1391 of /mod/assign/locallib.php: call to moodle_database->get_field_select()
* line 2724 of /mod/assign/locallib.php: call to assign->update_calendar()
* line 44 of /mod/assign/classes/task/cron_task.php: call to assign::cron()
* line 201 of /lib/cronlib.php: call to mod_assign\task\cron_task->execute()
* line 119 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
* line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
* line 61 of /admin/cli/cron.php: call to cron_run()
Figuring this might be caused by something, I continued my search and found out that assignements that been part of a Moodle course imported created multiple calander items at 1 day, while the due date of the assignment was not the same.
In my calendar I noticed that on saturday december 15th 2018 2 events of the assigment with the message ( Due date).
When I go to the assignment and check the DUE date it states a different due date.
I can confirm that the Due date that is showing in the activity is actually in the calendar as well.
So at this time it shows 3 calendar items for 1 activity.
What I am not sure of is why did this happen. The course was backed up from a Moodle 3.4 enviroment, and imported in the 3.8 site with calendar events. Maybe it was something on that enviroment already - not sure.
Anyways -> I tried to save the activity without any change, doing this showed the following error notification:
Error: mdb->get_record() found more than one record!
- line 1599 of /lib/dml/moodle_database.php: call to debugging()
- line 1660 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
- line 1641 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
- line 1391 of /mod/assign/locallib.php: call to moodle_database->get_field_select()
- line 1509 of /mod/assign/locallib.php: call to assign->update_calendar()
- line 237 of /mod/assign/lib.php: call to assign->update_instance()
- line 596 of /course/modlib.php: call to assign_update_instance()
- line 152 of /course/modedit.php: call to update_moduleinfo()
When I disable the due date setting, there is no error anymore and all calender items are being removed.
After this I can change the due dates to what every I want without any issues.
As said I am not sure if this is being caused by the backup / import action, or being able to replicated this due to other restrictions.
The reasons I post this is more to see if others have seen the same issues:
- An increase on logging in Moodle 3.8 by the CLI based on event: Calendar event updated? And if so -> is this expected behavior?
- Is the task error \mod_assign\task\cron_task and the error in the assignment connected to each other? And if so, could this be cause of the exstensive logging we see?
Meanwhile I keep checking the calander and solving any of these "double" / "tripple" issues and hoping it solves anything.
BUt I do hope some can give me a bit more insight.