HELP: Upgrade 1.9.2 loop, assignment module

HELP: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
Number of replies: 14
Hi all,

I am in the middle of upgrading our production site from version 1.8.3 to version 1.9.2+. I have hit a snag that did not come up during the test upgrades we conducted in our test servers. It comes after the database upgrade and the new settings and looks as follows:

No warnings - Scroll to the continue button

assignment module needs upgrading


(mysql): ALTER TABLE mdl_assignment_submissions MODIFY COLUMN data1 TEXT NULL after numfiles
Success

(mysql): ALTER TABLE mdl_assignment_submissions MODIFY COLUMN data2 TEXT NULL after data1
Success

(mysql): UPDATE mdl_assignment SET var4=1 WHERE assignmenttype='upload'
Success
Processing assignment grades, this may take a while if there are many assignments...

Found more than one record in fetch() !

Clicking the continue button loops back to the above page. Does anyone have any idea what the message "Found more than one record in fetch()" refers to? What can I do to remedy this situation?

Rgrds,
Paul.
Average of ratings: -
In reply to Paul Nijbakker

Re: HELP: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
OK, I managed to turn debug on and it provided me with the following extra data:

Found more than one grade item
  • line 90 of lib\gradelib.php: call to debugging()
  • line 2241 of mod\assignment\lib.php: call to grade_update()
  • line 2196 of mod\assignment\lib.php: call to assignment_grade_item_update()
  • line 58 of mod\assignment\db\upgrade.php: call to assignment_update_grades()
  • line 338 of lib\adminlib.php: call to xmldb_assignment_upgrade()
  • line 422 of admin\index.php: call to upgrade_activity_modules()
Any suggestions as to where the problem lies and how to solve it?

Rgrds,
Paul.

In reply to Paul Nijbakker

Re: HELP: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
If you have experienced the same problem, please vote for this bug to be resolved in the bug tracker: http://tracker.moodle.org/browse/MDL-14124

The issue has been known since the beginning of April, so it must be difficult to solve.

Rgrds,
Paul.
In reply to Paul Nijbakker

Re: HELP: Upgrade 1.9.2 loop, assignment module

by Mauno Korpelainen -

Hi Paul,

try the method that Karlene Clapp used in http://tracker.moodle.org/browse/MDL-11470

I don't guarantee that it works but it might help.

"I removed the folder /mod/assignment and could then breeze through the rest of the upgrade, skipping assignment. I then put the mod/assignment folder back.

...I renamed the assignment and assignment submissions tables so that moodle couldn't see them. This produced an error that showed me the query it was trying to perform on the database that was giving the error:

ALTER TABLE mdl_assignment_submissions MODIFY COLUMN data1 TEXT NULL after numfiles

I then ran this query on the table through phpmyadmin and changed the mdl_assignment_submissions table back to its regular name and refreshed the update. Then it went through the update successfully. After this I changed the mdl_assignment table back to it's reg. name and refreshed moodle. All seems to be working fine so far."

EDIT: Take a backup of database before testing!

EDIT2: Sorry - in your case the error is not in column data1, it was successful...but you should find the faulty mysql command like Karlene did if you temporarely remove mod assignment...

In reply to Mauno Korpelainen

Re: HELP: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
Hi Mauno,

Thanks for your reply. I am not sure removing the assignment folder is a solution. The error Karen experienced is different from the one we have, which seems to be some kind of duplicate entry in the gradeitems, although we haven't yet been able to find any duplicate entries.

We will keep the removal of the assignment in mind as a last resort. If it doesn't work we will simply have to return to Moodle 1.8 and wait until the issue has been adressed in (hopefully) 1.9.3.

Rgrds,
Paul.
In reply to Paul Nijbakker

Re: HELP: Upgrade 1.9.2 loop, assignment module

by Mauno Korpelainen -

Removing temporarely folder assignment should help you to upgrade other parts of moodle and to get site up and running. The problem is clearly in grades and assignment module and you can upgrade it later when you find the reason for those duplicate records...

It is of course possible to go back with backups if you want to wait for the solution of that bug.

Edit: the reason might be some old stuff from 3rd party activities again when you have restored old courses (probably to existing course, not as a new course) but it looks like people in HQ are right now trying to solve the bug...

I haven't seen this bug to happen - this was just an idea to get it solved.

In reply to Mauno Korpelainen

Re: HELP: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
Hi Mauno,

Our 1.8 install was clean, with all courses imported fro 1.6. The test server is a copy of the production server. We do not have any graded third party modules in our production server. Our test server is messier in that respect than the production server, but it upgraded without the above-mentioned problem. So whatever it is that went wrong, it has to be something that came up in the months since we copied the production server into the test server.

I was really disappointed, because I thought that we had been so careful that all would go smoothly this time. sad

If I cannot find any duplicates in the mdl_grade_grades table, I will try the suggested work around.

EDIT: We turned on debug in the upgrade.php for the assignment module and found that the duplicate rows are in the mdl_grade_items table. We have not yet discovered how we can remove those duplicates. Any suggestions are welcome.

Rgrds,
Paul.
In reply to Paul Nijbakker

Re: HELP: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
UPDATE: We managed to delete the (9) duplicate rows that caused the "Found more than one grade item" error. When we try to upgrade (Continue), those errors are gone, but we still get the message "Found more than one record in fetch()" and the upgrade does not continue.

What to do?

Rgrds,
Paul.
In reply to Paul Nijbakker

SOLVED: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
Hi all,

I am relieved to say that we finally managed to overcome the problem with the "Found more than one record in fetch() !" error. It was a result of 9 duplicate rows in the mdl_grade_items table and 1 duplicate row in the mdl_grade_categories table. We found these by:

A: adding $CFG->debug=1; to the middle of the config.php file (this showed us where the duplicates in the grade items were in combination with the setting below)

B: setting debug to true in the mod/assignment/db/upgrade.php

We could then track down the duplicate rows in the moodle MySql database and delete the offending rows.

After that the upgrade was a breeze.

Rgrds,
Paul.
In reply to Paul Nijbakker

Re: SOLVED: Upgrade 1.9.2 loop, assignment module

by Mauno Korpelainen -

Nice that you solved it Paul - do you have any idea where those duplicates came from?

( = Did you write down the info of deleted duplicates to check if they were related to some deleted/restored course, attachment, teacher etc? )

It might help other people to avoid similar situations and developers to find the cause of those duplicates.

In reply to Mauno Korpelainen

Re: SOLVED: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
Hi Mauno,

The issue affected two courses. One, a copied course in which assignments with the same name occur. They still give the same error when I try to edit them. The other course seems to have no problems.

Rgrds,
Paul.


In reply to Paul Nijbakker

Re: SOLVED: Upgrade 1.9.2 loop, assignment module

by Richard Enison -
PN,

What a coincidence! The last comment (as of this writing) in the tracker issue MDL-14124, by P. S. Paaskynen, dated today (July 16, 2008 in my time zone) at 6:23 pm, seems to be an exact copy of your post (447930) except for the last sentence.

RLE
In reply to Richard Enison

Re: SOLVED: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
Yep, I posted that; my ID in the tracker is not the same as in moodle (It does not import).

Rgrds,
Paul.
In reply to Paul Nijbakker

Re: SOLVED: Upgrade 1.9.2 loop, assignment module

by Paul Nijbakker -
OK, I found how to edit my profile in the tracker big grin (We learn something new every day).
In reply to Paul Nijbakker

Re: SOLVED: Upgrade 1.9.2 loop, assignment module

by Caroline Moore -
Paul,

Thank you, thank you, thank you for posting this! I upgraded from 1.8.3 to 1.9.2 today and ran into this same error on the assignments, grade_items, and grade_categories tables. Your fix worked like a charm!

~Caroline