Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Susan Mangan -
Number of replies: 15

Error during upgrade from 1.9.14 - 2.2

Should this go in the tracker?

Tx!

DDL sql execution error

More information about this error

Debug info: Duplicate entry '11862-auth_forcepasswordchange' for key 'mdl_userpref_usenam_uix'
CREATE UNIQUE INDEX mdl_userpref_usenam_uix ON mdl_user_preferences (userid, name)
Stack trace:
  • line 400 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown
  • line 669 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 88 of /lib/ddl/database_manager.php: call to mysqli_native_moodle_database->change_database_structure()
  • line 75 of /lib/ddl/database_manager.php: call to database_manager->execute_sql()
  • line 892 of /lib/ddl/database_manager.php: call to database_manager->execute_sql_arr()
  • line 5395 of /lib/db/upgrade.php: call to database_manager->add_index()
  • line 1406 of /lib/upgradelib.php: call to xmldb_main_upgrade()
  • line 236 of /admin/index.php: call to upgrade_core()
Average of ratings: -
In reply to Susan Mangan

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Susan Mangan -

..just adding a screen shot of upgrade error

Attachment upgrade-error.png
In reply to Susan Mangan

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Susan Mangan -

Went back and cleaned out original 1.9 data using xml editor and did data dump.

Started fresh with newly created database and re-imported new .sql file with cleaner data.

Upgrade halted on same error as above.

I can remove the various duplicate entries manually but the upgrade just halts on another user and another duplicate entry - seems endless.  Not sure what to do - created:

http://tracker.moodle.org/browse/MDL-32288?focusedCommentId=151087#comment-151087

In reply to Susan Mangan

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Guillermo Madero -

Hi Susan,

Maybe you could try by upgrading first to 2.0 and then to 2.2? Just an idea.

In reply to Guillermo Madero

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Direct 1.9 -> 2.2 transistion is supported. Possibly Susan has _overwritten_ $moodle. See http://moodle.org/mod/forum/discuss.php?d=199498#p869942.
In reply to Visvanath Ratnaweera

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Susan Mangan -

Thanks Visvanath.  Right now the latest error I am receiving is one that seems to be common as per http://tracker.moodle.org/browse/MDL-25248

Unknown error upgrading mod_resource to version 2009062600, can not continue. When upgrading to Moodle 2.0

However, I am willing to try anything at this point, so if you suggest getting I.9 codebase running I will try that.

Thanks

In reply to Visvanath Ratnaweera

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Susan Mangan -

Hello Visvanath, thanks for trying to help but completing a migration prior to my upgrade didn't change anything, I receive the same set of errors.

In reply to Guillermo Madero

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Susan Mangan -

Thank you for the suggestion Guillermo!  I have in fact tried that approach and I received the same error. 

I did remove the duplicates successfully and my upgrade continues with a myriad of other errors ...  which (so far .. nock on wood) I have been able to fix based on various suggestions I have managed to dig out of the forums.

I'm not sure why this is happening - perhaps because we are dealing with an ancient schema from 2004 (1.5??).

I am just continuing to document what I am doing should it catch someone's eye who might have some brilliant idea as to why I am getting this onslaught of errors.

Currently I am stuck on:

Unknown error upgrading mod_resource to version 2009062600, can not continue. When upgrading to Moodle 2.0

Apparently this has an existing tracker entry and it looks as though some of the prior errors people were getting are similar to mine as well.

http://tracker.moodle.org/browse/MDL-25248

In reply to Susan Mangan

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Ken Task -
Picture of Particularly helpful Moodlers

The duplications seem to be related to users ... unless I mis-understand the errors shown.

Hope you've been working with a copy of the 1.9.x you have.

Might be wise to upgrade the 1.9.14 to the highest 1.9.x. first.  Yes, I know we're trying to do a 'hyperjump' and that would be easiest, but, it no workie, sooooooo ....  One might find troubles with users in the 1.9.x upgrade and those are just compounded when hyperjumping.

In the copy of the upgraded 1.9.x, remove all users with exception of Admin user and one other account that has admin level.

Then try the migration to 2.x with the upgraded 1.9.x copy.

Of course, if one *needs* all the users and their enrollments in courses to remain, then the above is for the bit bucket and I'm sorry for waisting your time! :|

'spirit of sharing', Ken

In reply to Ken Task

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Susan Mangan -

Thanks Ken!  I did actually install a fresh version of the latest weekly 1.9.17 and got that running successfully on our new server prior to attempting the upgrade again.  Figured it was best to work with the latest and the greatest.

And yes.. this is a copy - we are testing the upgrade process.

Interesting idea though... I suppose starting fresh without userdata could work. Thanks for the idea... might try to see how that goes if I can't get past this next error.

Although backing up and restoring is always an option... even though we have hundreds and hundreds of courses..although I probably could have completed individual backup and restores by now for how long it has taken to try to upgrade sad

In reply to Susan Mangan

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, let me get this straight ... 'new server' means you are not only migrating but moving, that right?  Moving from what OS to what OS? and what are the 'particulars' in each ... PHP version, etc..

The Moodle docs say that the DB user not having permissions to change or create tables could result in the exception thrown.

Also, maybe I didn't explain clearly the process suggested ... IF you are moving, move the current 1.9.14 site to the new server and get it functioning.  Images/links might break if one has not edited the SQL for http://oldserver/path to http://newserver/path.  One should be able to fix those quickly with the global search and replace tool  That, for all practical purposes, is a copy.  Upgrade that site from 1.9.14 to the 1.9.17.  It's there one might discover issues.

If that goes well, make a complete/full backup of the 1.9.17 (that's then your fallback position).

Make a copy of the webroot and data directory of the 1.9.17 that's working and work on migration with that copy.

Check for known in-compatible blocks/mods in the copy of the upgraded 1.9.17 (those are blocks and mods that haven't made the trip to 2).  While one could leave them, think the idea is to have as clean ready to migrate copy as possible.

If there are add-ons that did make the trip, after installing a 2.2 via git or other method, get those compat add-ons for 2.2 and manually add them - place the zips in the appropriate directory, unzip, then change permissions.  One is just preparing the files/directories at this point and one has NOT really attempted the migration.

The biggest change will be to the data directory.  Gone are the course ID folders.  Making a hyperjump like this one will be stuck with "legacy".  So, to lessen the affects of that, I create a repository directory in what is at present a copy of the 1.9.7 data directory and in the repository directory I copy all the course ID folders into the manually created repository directory.

Print a report that shows the course titles etc. and the course ID number (there's an add-on for coursesizes for 1.9.x that I install to be able to do that easily).  Why?  Cause if the migration is successful, I'll need to create a repo for those courses that point to the copied course ID number.  (this is the only way I've found to lessen "legacy')

There are some things one does NOT need and just adds to the processing and setup of the new filing system.  The 1.9.x backups.  I manually (via command line using global commands) go into each course ID folder, backupdata, and remove the 1.9.x backup zips.  In those 'prepared' repository/[courseIDnumber]/ directories as well.

Clean up users in the copy of the 1.9.17.  Running the cron job via command line several times in the 1.9.17 will do some of that for you.

Once you've got the copy of the 1.9.17 cleaned up and prepared ...

then, fingers crossed, migrate the site to 2.2 - drop the 1.9.17 copy config.php file into the www root of the 2.2 site (set/check permissions), edit the config.php to point to the 'prepared' data directory etc. and hit the site with browser.

If all goes well, one might have a functioning 2.2 ... still might need some tweaks, however. :\

'spirit of sharing', Ken

In reply to Ken Task

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Monica Bokos -

Hi you wrote "I'll need to create a repo for those courses that point to the copied course ID number"

How will you do that? Connect the file with the ressource that contains the link to the file? In Moodle 2, of course

Thanks,

Monica

In reply to Monica Bokos

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Ken Task -
Picture of Particularly helpful Moodlers

Let's say that the old 1.9.x course was ID 5 and I know the title, instructor, etc.  In the Moodle 2 as the admin user, turn on File System repo.  Allow the creation of File System repos - this looks like Teachers can create them ... they can, but it takes a system admin and total access to the moodledata folder/repository to actually create the folder to which the Teacher can link. 

Go to the migrated course (old ID 5) and in the course.  There should be a Repositories link in the Course Admin Menu.  At first, that screen may only present one with an option to 'Create "File System" instance.  Click it.   One is then presented with a screen to 'name' the repo and a pick list of those course ID folders one moved into the repository directory prior to migration.  You can give it any name, but the pick list items are the "physical course ID folders".  So let's say the Teacher in old ID number 5 was Mrs. Jones.  We could name the repo "Mrs. Jones Files" and choose the number 5 folder.

I wish this would clean up the links to 'legacy' files, but it doesn't. sad  However, Mrs. Jones could re-link using her "Mrs. Jones Files" repo and eventually, Legacy for that course could be turned off.  Also, hopefully, all the references in the mdl_files table for the 'legacy' files in that course would be moved to the 'trash_dir' (because there is no link to them) and eventually removed from the system/DB - via cron job.  Has to make the DB smaller, doesn't it?

So this doesn't avoid legacy completely ... just lessens the affects of migration and Legacy - maybe less confusion for Teachers accustomed to the behavior of the old 1.9 filing system. 

A new course, BTW, doesn't use Legacy.

Hope all that makes sense. ;)

'spirit of sharing', Ken

In reply to Ken Task

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Monica Bokos -

Hi,

I finally tested what you described and now it makes sense smile however the problem with the server repositories is that you can not upload files via Moodle. So a teacher has to have some sort of ftp acces, and have the server file open in another window, it doesn't seem much to do but still...

I hope a search engine will be available soon in the file picker! those server file location wouldn't bother me so much. I counted today, in order to add a file one has to click 8 times!

In reply to Ken Task

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Susan Mangan -

Thanks again Ken, great info smile

Yes we are also migrating servers in addition to the upgrade to 2.2 and I have already done the majority of  steps listed in your response (get existing 1.9x working, global search and replace, etc. and then upgraded to latest 1.9.17, clean up users and run cron manually, etc.).

However, I did not remove ALL of the 3rd party modules.  In removing the modules we lose the data.  Was hoping to avoid that ... eg, we have a programmer working on nanogong filter for tinymce for 2x as we speak.

I am going to try to upgrade without user data - I am assuming the best way to do this is to manually remove users using bulk user options?  This method does not actually remove user quiz attempts though...

In reply to Susan Mangan

Re: Upgrade 1.9.14 - 2.2 DDL sql execution error - Duplicate entry '11862-auth...

by Monica Bokos -

Hi,


We had problems with deleting quiz attempts too. Sometimes it works if you reset the courses in two steps. First only reset the quizzes (make sure that you still have the users) and only afterwards the rest of the course.


And thanks Ken for the explanation, I will try to do this, see how it works.


My problem is that I can't figure out how to let teachers upload files in this repository directly from Moodle. I can't give them access to the server and it's not time efficient for me to do it every time they work. Besides they are all grown-ups and like to be independent. My teachers (in 1.9.12) are using a system wide repository so that everybody has access to all resources (it’s in the spirit of sharing smile ) and we would like to have the same behavior in Moodle 2. Does anybody have a solution?


Thanks,


Monica