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:
    • Rank:
      17461

      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.

        Issue Links

          Activity

          Aparup Banerjee created issue -
          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.
          Eloy Lafuente (stronk7) made changes -
          Field Original Value New Value
          Fix Version/s 2.1 [ 10370 ]
          Priority Minor [ 4 ] Major [ 3 ]
          Labels triaged
          Assignee Eloy Lafuente (stronk7) [ stronk7 ] David Mudrak [ mudrd8mz ]
          Eloy Lafuente (stronk7) made changes -
          Parent MDL-27811 [ 44804 ]
          Issue Type Sub-task [ 5 ] Bug [ 1 ]
          Eloy Lafuente (stronk7) made changes -
          Link This issue has a non-specific relationship to MDL-22414 [ MDL-22414 ]
          Aparup Banerjee made changes -
          Assignee David Mudrak [ mudrd8mz ] Aparup Banerjee [ nebgor ]
          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
          Aparup Banerjee made changes -
          Fix Version/s DEV Sprint 2.1 [ 10650 ]
          Aparup Banerjee made changes -
          Status Open [ 1 ] Development in progress [ 3 ]
          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)
          Aparup Banerjee made changes -
          Link This issue has been marked as being related by MDL-27446 [ MDL-27446 ]
          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)
          Aparup Banerjee made changes -
          Pull Master Diff URL https://github.com/nebgor/moodle/commit/35689c8bbe0176bc5709ce325c159780f7146ee6
          Pull Master Branch MDL-27819_grrgit
          Integrator stronk7
          Pull from Repository git://github.com/nebgor/moodle.git
          Aparup Banerjee made changes -
          Status Development in progress [ 3 ] Waiting for peer review [ 10012 ]
          Peer reviewer samhemelryk
          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
          Aparup Banerjee made changes -
          Original Estimate 0 minutes [ 0 ]
          Remaining Estimate 0 minutes [ 0 ]
          Status Waiting for peer review [ 10012 ] Development in progress [ 3 ]
          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
          Aparup Banerjee made changes -
          Eloy Lafuente (stronk7) made changes -
          Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
          Currently in integration Yes
          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!
          Eloy Lafuente (stronk7) made changes -
          Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
          moodle.com made changes -
          Tester rwijaya
          Rossiani Wijaya made changes -
          Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
          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.
          Rossiani Wijaya made changes -
          Status Testing in progress [ 10011 ] Problem during testing [ 10007 ]
          Rossiani Wijaya made changes -
          Link This issue is duplicated by MDL-27874 [ MDL-27874 ]
          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.
          Eloy Lafuente (stronk7) made changes -
          Status Problem during testing [ 10007 ] Integration review in progress [ 10004 ]
          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
          Eloy Lafuente (stronk7) made changes -
          Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
          Eloy Lafuente (stronk7) made changes -
          Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
          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!
          Eloy Lafuente (stronk7) made changes -
          Status Testing in progress [ 10011 ] Tested [ 10006 ]
          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!
          Eloy Lafuente (stronk7) made changes -
          Status Tested [ 10006 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Currently in integration Yes
          Integration date 16/Jun/11
          Michael de Raadt made changes -
          Link This issue has been marked as being related by MDL-28621 [ MDL-28621 ]
          Eloy Lafuente (stronk7) made changes -
          Fix Version/s DEV Sprint 2.1 [ 10650 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: