Moodle
  1. Moodle
  2. MDL-27819

a 1.9 to 2.1 restored mod lesson has db error - 'found more than one record'

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: Backup, Lesson
    • Labels:

      Description

      using the backup in the parent bug, converted and restored into a 2.1 installation.
      i'm seeing the lesson module show up this error on top.

      Error: mdb->get_record() found more than one record!
      line 1290 of /lib/dml/moodle_database.php: call to debugging()
      line 1353 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1332 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
      line 1311 of /lib/dml/moodle_database.php: call to moodle_database->get_field_select()
      line 164 of /mod/lesson/view.php: call to moodle_database->get_field()
      Error: mdb->get_record() found more than one record!
      line 1290 of /lib/dml/moodle_database.php: call to debugging()
      line 1353 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1332 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
      line 1311 of /lib/dml/moodle_database.php: call to moodle_database->get_field_select()
      line 251 of /mod/lesson/view.php: call to moodle_database->get_field()

      for some reason there is some duplicity going on.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Eloy Lafuente (stronk7) added a comment -

            Assigning to David, raising prio. Feel free to send it me back if the problem is on restore and not on conversion.

            Show
            Eloy Lafuente (stronk7) added a comment - Assigning to David, raising prio. Feel free to send it me back if the problem is on restore and not on conversion.
            Hide
            Aparup Banerjee added a comment -

            grabbing, just in the midst of looking at this.
            ps: bug report based on https://github.com/mudrd8mz/moodle/tree/backup-convert

            Show
            Aparup Banerjee added a comment - grabbing, just in the midst of looking at this. ps: bug report based on https://github.com/mudrd8mz/moodle/tree/backup-convert
            Hide
            Aparup Banerjee added a comment -

            seems the converted xml needs 2 more data (can't find upgrade scripts) <prevpageid/> and <nextpageid/>. fixing ..
            (depending on integration status of backup-convert the pull will be into backup-convert or straight into integration-master)

            ps: (next time i'll compare 2.x xml with 1.9 xml for more bug free conversions :-D)

            Show
            Aparup Banerjee added a comment - seems the converted xml needs 2 more data (can't find upgrade scripts) <prevpageid/> and <nextpageid/>. fixing .. (depending on integration status of backup-convert the pull will be into backup-convert or straight into integration-master) ps: (next time i'll compare 2.x xml with 1.9 xml for more bug free conversions :-D)
            Hide
            David Mudrak added a comment -

            I say it over and over again - do not rely on just comparing the XML files. Read backuplib.php in 1.9 and compare it with the backup/restore stepslib code in 2.0. Some XML tags can be there conditionally for example.

            Show
            David Mudrak added a comment - I say it over and over again - do not rely on just comparing the XML files. Read backuplib.php in 1.9 and compare it with the backup/restore stepslib code in 2.0. Some XML tags can be there conditionally for example.
            Hide
            Aparup Banerjee added a comment - - edited

            creating pseudo integration request that can be tweaked.
            (not compared with anything really , sort of diffed against backup-convert (my branch includes a merge from timhunt) , but could also diff against integration master)

            Show
            Aparup Banerjee added a comment - - edited creating pseudo integration request that can be tweaked. (not compared with anything really , sort of diffed against backup-convert (my branch includes a merge from timhunt) , but could also diff against integration master)
            Hide
            Eloy Lafuente (stronk7) added a comment -

            hi aparup, I've been looking at your pre-integration issue and looks ok (note i don't know much about the converters implementations). I've tried here with one basic lesson (just having 2 pages and "next" jumps) and seems it was converted ok.

            There are some harcoded [0] and [1] in the pages loop that I didn't investigate much but called my attention.

            I'd suggest you to:

            • provide (find/create) some 1.9 course backup having, say, 2 complex lessons, with all sort of jumps and pages defined. Test your code with them.
            • ask for quick review to David / SamH once working.
            • make proper integration request
            • relax, hopefully :-P

            Hope it helps, ciao

            Show
            Eloy Lafuente (stronk7) added a comment - hi aparup, I've been looking at your pre-integration issue and looks ok (note i don't know much about the converters implementations). I've tried here with one basic lesson (just having 2 pages and "next" jumps) and seems it was converted ok. There are some harcoded [0] and [1] in the pages loop that I didn't investigate much but called my attention. I'd suggest you to: provide (find/create) some 1.9 course backup having, say, 2 complex lessons, with all sort of jumps and pages defined. Test your code with them. ask for quick review to David / SamH once working. make proper integration request relax, hopefully :-P Hope it helps, ciao
            Hide
            Aparup Banerjee added a comment -

            Thanks Eloy,
            I've got basic lessons as part of attachment in MDL-22414. I'll attach lesson specific backups here soon(the complex ones).

            the [0] and [1]'s are hard reference lookups (next prev pageid / 3rd 4th answers) needed to make them nice n relative as is in 2.x.

            I've tested with a few lessons so i'll make the integration request proper now that backup-convert in integrated.
            (hm, MDL-27787 seems integrated but shows up in my diff : https://github.com/nebgor/moodle/compare/integration-master...MDL-27819_grrgit , please bear with it , pick my commit)

            Show
            Aparup Banerjee added a comment - Thanks Eloy, I've got basic lessons as part of attachment in MDL-22414 . I'll attach lesson specific backups here soon(the complex ones). the [0] and [1] 's are hard reference lookups (next prev pageid / 3rd 4th answers) needed to make them nice n relative as is in 2.x. I've tested with a few lessons so i'll make the integration request proper now that backup-convert in integrated. (hm, MDL-27787 seems integrated but shows up in my diff : https://github.com/nebgor/moodle/compare/integration-master...MDL-27819_grrgit , please bear with it , pick my commit)
            Hide
            Aparup Banerjee added a comment -

            David, could you do a quick review of this

            Show
            Aparup Banerjee added a comment - David, could you do a quick review of this
            Hide
            Aparup Banerjee added a comment -

            just working on a quick memory usage improvement as the current code is quiet possibly heavy on memory :

            (13:41:42) mudrd8mz@jabber.cz: so you can still write them progressively, just using a buffer
            (13:42:00) mudrd8mz@jabber.cz: so you write the n-the after you parse n+1-th

            Show
            Aparup Banerjee added a comment - just working on a quick memory usage improvement as the current code is quiet possibly heavy on memory : (13:41:42) mudrd8mz@jabber.cz: so you can still write them progressively, just using a buffer (13:42:00) mudrd8mz@jabber.cz: so you write the n-the after you parse n+1-th
            Hide
            Aparup Banerjee added a comment -

            memory usage optimized

            submitting for integration.

            please integrate just my last 2 commits thanks

            Show
            Aparup Banerjee added a comment - memory usage optimized submitting for integration. please integrate just my last 2 commits thanks
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Integrated by cherry-picking the 2 target commits (35689c8b and 27819bf9), thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - Integrated by cherry-picking the 2 target commits (35689c8b and 27819bf9), thanks!
            Hide
            Rossiani Wijaya added a comment -

            Lesson restored without error, however there's a bug on lesson page, the value of jumps column contain repetition of the previous page.

            Show
            Rossiani Wijaya added a comment - Lesson restored without error, however there's a bug on lesson page, the value of jumps column contain repetition of the previous page.
            Hide
            Aparup Banerjee added a comment -

            Thanks rosie! that was a last minute change after testing with a huge backup of a 1.9 school demo. i should stay away from last minute eh.

            its now fixed in : https://github.com/nebgor/moodle/compare/integration-master...MDL-27819_grr_answers

            Show
            Aparup Banerjee added a comment - Thanks rosie! that was a last minute change after testing with a huge backup of a 1.9 school demo. i should stay away from last minute eh. its now fixed in : https://github.com/nebgor/moodle/compare/integration-master...MDL-27819_grr_answers
            Hide
            Aparup Banerjee added a comment - - edited

            ah just fixed one last thing. the jumpto modification should only be for qtype =5 : fixed in

            https://github.com/nebgor/moodle/compare/integration-master...MDL-27819_grr_answers

            Show
            Aparup Banerjee added a comment - - edited ah just fixed one last thing. the jumpto modification should only be for qtype =5 : fixed in https://github.com/nebgor/moodle/compare/integration-master...MDL-27819_grr_answers
            Hide
            Rossiani Wijaya added a comment -

            Hi Apu,

            I re-test your latest patch and it restored properly.
            Thanks for fixing this.

            Show
            Rossiani Wijaya added a comment - Hi Apu, I re-test your latest patch and it restored properly. Thanks for fixing this.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            re-integrated by adding 2 more commits

            Show
            Eloy Lafuente (stronk7) added a comment - re-integrated by adding 2 more commits
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Passing tests based on Rossiani & Aparup comments. Thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - Passing tests based on Rossiani & Aparup comments. Thanks!
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Upstream, upstream, this is part of upstream, upstream... thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - Upstream, upstream, this is part of upstream, upstream... thanks!

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: