Error finding or creating section structures for this course

Error finding or creating section structures for this course

by Alvin Ching -
Number of replies: 8
Error finding or creating section structures for this course

I had uploaded many resources, and had created many activities for a particular module, and it never give me any problem, not till...

I uploaded a resource, and encounter the following problem:

Error finding or creating section structures for this course

Help! I do not want all my efforts to be wasted! How can the above problem be resoloved? Do I need to wipe out everything and start everything afresh???

Cheers
Average of ratings: -
In reply to Alvin Ching

Re: Error finding or creating section structures for this course

by Alvin Ching -
I have yet to resolve that issue. Here are more information:

Looking at the codes course/view.php, here's where it trigger the error message:

if (! $sections = get_all_sections($course->id) ) {
error("Error finding or creating section structures for this course");
}


By printing courseid, error($section->course), it had provided me with the associated course id.


Looking at course/lib.php:
function get_all_sections($courseid) {

return get_records("course_sections", "course", "$courseid", "section",
"section, id, course, summary, sequence");
}

Where the function get_records were being defined?

I have not make any changes to database or codes, the only actions I took are just add and uploading resources...., and right now each time I clicked on the course name, all give rise to the same error messages, even if I have just recently added a new course (after the error arises).

By masking the if condition in view.php:

if (! $sections = get_all_sections($course->id) ) {
error("Error finding or creating section structures for this course");
}

I am able to get into my course page, I still can see my uploaded files via Administration:Files, however I have lost all my Actvity:Resources, Quizzes, Assignments, Forums!!!! (By clicking on the resources link, it says no resources find), however I am able to see those resouces still in my mysql database (example my quiz in mdl_quiz_question)

I believe just inputs, linklist in the database had gone wrong, by identifying that I need not have to key in everything again. Frankly I really have not edit or manually add records into the database.

Can someone point me the lights? My experience illustrate the importance of backup your data, database!!!

Anyway despite the above, I have to admit that this is a really good application! I believe I just have to re keyin all my earlier information once again, if no help is round the corner.

Cheers!
In reply to Alvin Ching

Re: Error finding or creating section structures for this course

by Alvin Ching -
So here's the problem! I failed to open Table mdl_course_sections! Why!!! What have I done wrong that I couldn't open the file suddenly??? How can I rectify this problem? How can I prevent such problem from happening again???

Can't open file: 'mdl_course_sections.MYI'. (errno: 145)

Error

SQL-query :

SHOW KEYS FROM `mdl_course_sections`

MySQL said:


Can't open file: 'mdl_course_sections.MYI'. (errno: 145)

Back
In reply to Alvin Ching

Re: Error finding or creating section structures for this course

by Alvin Ching -
In reply to Alvin Ching

Re: Error finding or creating section structures for this course

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi, Alvin

(no need to keep posting new messages, you can edit existing ones smile )

I've never seen this problem happen before - what version are you using? Have you upgraded recently? If you upgraded, did you make sure to visit the admin page after the upgrade?

Since you seem comfortable with editing code, two useful debugging tricks are:

$db->debug = true; // shows SQL commands and errors

print_object($variable); // prints any variable nicely
In reply to Martin Dougiamas

Re: Error finding or creating section structures for this course

by Alvin Ching -
Sorry about that. Thought that would better present my thoughts:

Here's the information:

Moodle 1.0.8.1 (2003011200)
Apache: 1.3.27 (unix)
Mysql: 4.0.12
Php: 4.3.1
Linux Kernal: 2.4.18-14smp

I have not done any upgrade, this is a fresh install. THe application has been working fine despite all the resources I had created, till I add a resource (add an uploaded file), infact I have been adding resources (including adding uploaded files) the whole day.

So it seems that this problem just pop up, database overload???

I have yet to repair the table, hope it works.

cheers!
In reply to Alvin Ching

Re: Error finding or creating section structures for this course

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Actually, now that I take my Moodle glasses off and actually look at the error it seems MySQL has lost it's index file for that table. The REPAIR sounds like a good option.
In reply to Martin Dougiamas

Re: Error finding or creating section structures for this course

by Alvin Ching -
I had repaired the table, and it worked! It had definitely saved me many hours of re-work.

Yes it seems that this problem persists if 'something' happened to your mysql while you update your tables.

So it again strengthened my faith on Moodle.

In reply to Alvin Ching

Re: Error finding or creating section structures for this course

by Eric Swanson -

Using Moodle 1.21 

I've seen this error 2x on our first course. The time it happened today I know exactly what I was doing and have a hunch as to what not to do now.

We ran a chat this morning with ~10 people and all seemed well except my connection was really slow at times so It's a local ISP issue. Few others in the chat had any problems except us on the US west coast so I figure one of the big pipes or possibly the latest sassy worm is taking its toll.

So, after the chat I am adding on new resources while other students are logged in doing work and reading. I get impatient because my computer seems to time out while waiting for a resource to add (an uplaoded file that I had already uploaded via FTP) so I click on Save again and it's the 2nd instance that locked the table. Instead of MYISAM, Myphpadmin list s the table as in use and noone can view the site because of the afforementioned error message.

A simple REPAIR TABLE mdl_course_sections fixed the problem and another backup ensures nothing lost.

Hope this helps someone in the future.

Eric