Installation help

Upgrade to 2.2.11 - coding error detected

 
 
Picture of Marc Wenger
Upgrade to 2.2.11 - coding error detected
 

I'm upgarding Moodle from 2.1.2 to 2.6, and have to first do the upgrade from 2.1.2 to 2.2.  I came across this error (also attached)

 

mod_quiz

Upgrading quiz attempts: quiz 0/49 (Quiz id 2)

 

Coding error detected, it must be fixed by a programmer: moodle_database::insert_record_raw() no fields found

Stack trace:
  • line 958 of /lib/dml/mysqli_native_moodle_database.php: coding_exception thrown
  • line 1015 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 300 of /question/engine/upgrade/upgradelib.php: call to mysqli_native_moodle_database->insert_record()
  • line 254 of /question/engine/upgrade/upgradelib.php: call to question_engine_attempt_upgrader->insert_record()
  • line 222 of /question/engine/upgrade/upgradelib.php: call to question_engine_attempt_upgrader->save_usage()
  • line 177 of /question/engine/upgrade/upgradelib.php: call to question_engine_attempt_upgrader->convert_quiz_attempt()
  • line 132 of /question/engine/upgrade/upgradelib.php: call to question_engine_attempt_upgrader->update_all_attempts_at_quiz()
  • line 1112 of /mod/quiz/db/upgrade.php: call to question_engine_attempt_upgrader->convert_all_quiz_attempts()
  • line 540 of /lib/upgradelib.php: call to xmldb_quiz_upgrade()
  • line 271 of /lib/upgradelib.php: call to upgrade_plugins_modules()
  • line 1437 of /lib/upgradelib.php: call to upgrade_plugins()
  • line 269 of /admin/index.php: call to upgrade_noncore()

I'm not to sure where to go on from here.  Any ideas or what more information can I provide that would be useful?  Thank you


 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Upgrade to 2.2.11 - coding error detected
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Some things to try to get more information:

1. Look in moodledata/upgradelogs, and there should file called qe_{datestamp}.html which contains information about what the upgrade did so far. However, it probably won't contain the error.

2. Go back to the backup of your pre-upgrade site, and try to review the attempts of the quiz with id 2. That is, go to .../mod/quiz/view.php?q=2, go to the reports, and review all the attempts. Are there any errors before the upgrade?

3. In the pre-upgrade site, got to the 'Question engine upgrade helper' tool in the admin menu, and use that to upgrade the attempts before doing the main upgrade to 2.6.

 
Average of ratings: -
Picture of Marc Wenger
Re: Upgrade to 2.2.11 - coding error detected
 

Hi Tim,

1 - I checked the logs, but unfortunately no data beyond the header is contained within

2 - I checked the attempt for quiz 2.  There were still some open attempts.  Should attempts be closed or deleted before progressing with an upgrade?

3 - The pre-upgrade version is 2.1.2.  Isn't the new question engine already on that version?  As site admin, I'm not seeing it under Settings > Site administration > question engine upgrade helperShould I assume that means the tool isn't showing because the question engine is already updated?

thanks,
-m

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Upgrade to 2.2.11 - coding error detected
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Well, you are right that normally all of this upgrade would run when you moved to Moodle 2.1.

Except that, it was a very big upgrade, and on large Moodle sites it took a huge amout of time.

Therefore we made a clever system that let you delay that bit of the upgrade until later. See http://docs.moodle.org/21/en/Upgrading_to_Moodle_2.1#Planning_the_question_engine_upgrade. So, it is possible to get to 2.1 without upgrading all the data. As it happens, I have just decided to add a check to Moodle 2.7 upgrade, so you can't upgrade to 2.7 if you never finished the upgrade. That lets us delete a lot of old code. smile

Anyway, the strange thing is, looking at your error message:

line 1112 of /mod/quiz/db/upgrade.php: call to question_engine_attempt_upgrader->convert_all_quiz_attempts()

That line 1112 is a bit of the quiz upgrade script that should have been executed as part of the upgrade to Moodle 2.1. I don't understand ...

Oh! here is a guess. Suppose that, during the upgrade to 2.1.2, the admin encoutered this error, and just chose to ingore it, so the quiz was never properly updated. Now that you are trying to upgrade to 2.2.x, it notices that this upgrade step was never run, and tries to do it now. I bet that is what happened.

Anyway, the real test is to look in the quiz_attempts table. Are there any rows there where needsupgradetonewqe is 1? If so, they should show up in qeupgradehelper, and you should be able to upgrade them from there, before you try to upgrade your site from 2.1 to 2.2.

But, that still does not explain why you are getting that error... unless you have bigger problem. Can you try http://docs.moodle.org/22/en/Verify_Database_Schema on your Moodle 2.1 site, paying particular attention to the question_ and quiz_ tables.

 

 
Average of ratings:Useful (1)
Picture of Marc Wenger
Re: Upgrade to 2.2.11 - coding error detected
 

Would it make sense to spin up a new server, install the latest version of Moodle and migrate the old data towards the new one?  Can a migration of data from one version to another work?

 
Average of ratings: -