Issue Details (XML | Word | Printable)

Key: MDL-16002
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Petr Skoda
Reporter: Petr Skoda
Votes: 0
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

rewrite upgrade locking

Created: 12/Aug/08 03:54 PM   Updated: 18/Aug/08 06:26 AM
Return to search
Component/s: Administration
Affects Version/s: 1.9
Fix Version/s: 2.0

File Attachments: 1. Text File upgrade_locking_10.patch (49 kB)
2. Text File upgrade_locking_11.patch (48 kB)
3. Text File upgrade_locking_9.patch (49 kB)


Participants: Dan Poltawski, Eloy Lafuente (stronk7) and Petr Skoda
Security Level: None
Resolved date: 18/Aug/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
At present the upgrade lock is defined in active session, this is not enough because people often close browser is the upgrade takes too long which causes a lot of problems. ALso the site should not be accessible during the upgrade.

Solution is to store the upgrade flag in config table instead.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Petr Skoda added a comment - 12/Aug/08 05:31 PM
please review, I would like to get this into cvs asap

Petr Skoda made changes - 12/Aug/08 05:31 PM
Field Original Value New Value
Attachment upgrade_locking_9.patch [ 14801 ]
Petr Skoda made changes - 12/Aug/08 05:36 PM
Attachment upgrade_locking_10.patch [ 14802 ]
Petr Skoda made changes - 13/Aug/08 01:54 AM
Attachment upgrade_locking_11.patch [ 14809 ]
Dan Poltawski added a comment - 13/Aug/08 04:36 PM
I haven't had a chance to review the patch, but I read some chat about a locking technique used which is incompatible with NFS.

Please tread carefully with this as lots of sites with course data based on NFS!


Eloy Lafuente (stronk7) added a comment - 14/Aug/08 06:11 AM
Ah, this isn't using any filesystem locking, Dan. It's 100% DB semaphore. Just that.

I guess you hear about that when talking about new File API, and how we "lock" some files when iterating over them to be finally deleted. In that case, one flock() is used. And it really has problems under NFS.

Ciao


Eloy Lafuente (stronk7) added a comment - 15/Aug/08 07:19 AM
Some comments about the execution I've performed:
  • Big site with 150 courses and 1GB of moodledata.
  • Course files and blog files migrated ok, showing progress bars perfectly. I tried second browser and got "upgrade is running" message.
  • Got some strange feedback in assignment progress bar: "Migrated assignment submissions - 1820/1."
  • Later in the assignment upgrade, I got a lot of: Error: could not insert new context level "70", instance "XXX" and it ended with one exception: Unknown exception related to local files (Invalid contextid)
  • Immediately I opened another browser and it allowed me to run the modules upgrade. I guess the end of the script, deletes the semaphore properly, so this is correct.

So, initial tests look ok (although I haven't been able to end the process due to errors when upgrading assignments). Going to upgrade one small site now.

Ciao


Eloy Lafuente (stronk7) added a comment - 15/Aug/08 07:24 AM
Upgrading small site the upgrade ended ok. Only one notice was showed in some of the upgrade pages like:
  • messaging plugins.
  • quiz reports
  • portfolio type

The notice said:

Inccorect use of upgrade_log_start(), upgrade already logging.

  • line 893 of lib/adminlib.php: call to debugging()
  • line 320 of lib/adminlib.php: call to upgrade_log_start()
  • line 422 of admin/index.php: call to upgrade_plugins()

That's all. Ciao


Petr Skoda committed 85 files to 'Moodle CVS' - 16/Aug/08 08:16 PM
MDL-16002 rewritten upgrade locking and better upgrade progress tracking; MDL-16070 Do not use $a[0] syntax in lang packs + various other upgrade improvements and fixes
MODIFY mod/label/db/upgrade.php   Rev. 1.8    (+8 -12 lines)
MODIFY enrol/paypal/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY mod/quiz/Attic/pagelib.php   Rev. 1.18    (+2 -2 lines)
MODIFY lang/en_utf8/forum.php   Rev. 1.43    (+1 -3 lines)
MODIFY mod/chat/db/upgrade.php   Rev. 1.8    (+10 -9 lines)
MODIFY admin/settings/Attic/misc.php   Rev. 1.22    (+3 -3 lines)
MODIFY admin/Attic/cliupgrade.php   Rev. 1.25    (+0 -9 lines)
MODIFY lib/db/upgrade.php   Rev. 1.228    (+34 -29 lines)
MODIFY question/type/shortanswer/db/upgrade.php   Rev. 1.5    (+7 -4 lines)
MODIFY mod/lesson/db/upgrade.php   Rev. 1.20    (+6 -5 lines)
MODIFY blocks/search/config_global.html   Rev. 1.9    (+2 -3 lines)
MODIFY blocks/section_links/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY blocks/rss_client/db/upgrade.php   Rev. 1.5    (+7 -4 lines)
MODIFY lang/en_utf8/error.php   Rev. 1.124    (+10 -9 lines)
MODIFY mod/data/rate.php   Rev. 1.15    (+3 -3 lines)
MODIFY mod/quiz/report/statistics/db/upgrade.php   Rev. 1.5    (+2 -2 lines)
MODIFY lib/db/upgradelib.php   Rev. 1.19    (+9 -7 lines)
MODIFY blocks/social_activities/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY blocks/search_forums/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY question/type/numerical/db/upgrade.php   Rev. 1.9    (+7 -4 lines)
MODIFY admin/index.php   Rev. 1.335    (+156 -174 lines)
MODIFY mod/quiz/report/overview/db/upgrade.php   Rev. 1.2    (+3 -5 lines)
MODIFY message/output/popup/db/upgrade.php   Rev. 1.2    (+4 -4 lines)
MODIFY mod/survey/db/upgrade.php   Rev. 1.5    (+7 -13 lines)
MODIFY mod/hotpot/lib.php   Rev. 1.105    (+51 -40 lines)
MODIFY blocks/recent_activity/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY user/editlib.php   Rev. 1.26    (+3 -3 lines)
MODIFY mod/resource/db/upgrade.php   Rev. 1.10    (+7 -12 lines)
MODIFY blocks/course_list/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY lib/accesslib.php   Rev. 1.510    (+2 -2 lines)
MODIFY mod/quiz/lib.php   Rev. 1.313    (+45 -31 lines)
MODIFY lang/en_utf8/debug.php   Rev. 1.16    (+8 -9 lines)
MODIFY enrol/authorize/db/upgrade.php   Rev. 2.6    (+7 -4 lines)
MODIFY question/type/calculated/db/upgrade.php   Rev. 1.5    (+7 -4 lines)
MODIFY mod/hotpot/db/upgrade.php   Rev. 1.5    (+9 -15 lines)
MODIFY mod/wiki/db/upgrade.php   Rev. 1.5    (+7 -13 lines)
MODIFY blocks/calendar_upcoming/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY admin/auth_config.php   Rev. 1.23    (+1 -1 lines)
MODIFY mod/assignment/lib.php   Rev. 1.347    (+46 -27 lines)
MODIFY question/type/multianswer/db/upgrade.php   Rev. 1.8    (+7 -13 lines)
MODIFY blocks/online_users/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY question/type/randomsamatch/db/upgrade.php   Rev. 1.5    (+7 -4 lines)
MODIFY message/output/email/db/upgrade.php   Rev. 1.2    (+4 -4 lines)
MODIFY lib/blocklib.php   Rev. 1.146    (+3 -7 lines)
MODIFY lib/adminlib.php   Rev. 1.240    (+134 -83 lines)
MODIFY mod/scorm/lib.php   Rev. 1.100    (+41 -26 lines)
MODIFY mod/forum/db/upgrade.php   Rev. 1.22    (+7 -20 lines)
MODIFY blocks/news_items/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY blocks/course_summary/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY admin/lang.php   Rev. 1.122    (+4 -4 lines)
MODIFY course/format/README.txt   Rev. 1.3    (+1 -1 lines)
MODIFY blocks/participants/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY blocks/activity_modules/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY blocks/admin/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY blocks/calendar_month/db/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY message/output/jabber/db/upgrade.php   Rev. 1.2    (+4 -4 lines)
MODIFY lib/moodlelib.php   Rev. 1.1095    (+42 -3 lines)
MODIFY version.php   Rev. 1.768    (+1 -1 lines)
MODIFY question/type/match/db/upgrade.php   Rev. 1.5    (+7 -4 lines)
MODIFY lib/weblib.php   Rev. 1.1125    (+3 -3 lines)
MODIFY blocks/search/db/upgrade.php   Rev. 1.11    (+7 -4 lines)
MODIFY mod/glossary/db/upgrade.php   Rev. 1.12    (+7 -13 lines)
MODIFY mod/data/db/upgrade.php   Rev. 1.22    (+6 -5 lines)
MODIFY mod/lesson/lib.php   Rev. 1.55    (+46 -32 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.219    (+1 -0 lines)
MODIFY question/type/multichoice/db/upgrade.php   Rev. 1.9    (+7 -4 lines)
MODIFY question/type/truefalse/db/upgrade.php   Rev. 1.5    (+7 -4 lines)
MODIFY mod/glossary/lib.php   Rev. 1.222    (+43 -27 lines)
MODIFY search/query.php   Rev. 1.29    (+0 -3 lines)
MODIFY mod/assignment/db/upgrade.php   Rev. 1.19    (+10 -10 lines)
MODIFY mod/glossary/rate.php   Rev. 1.17    (+3 -3 lines)
MODIFY mod/data/lib.php   Rev. 1.194    (+46 -29 lines)
MODIFY mod/quiz/db/upgrade.php   Rev. 1.23    (+6 -5 lines)
MODIFY question/type/datasetdependent/db/Attic/upgrade.php   Rev. 1.2    (+7 -4 lines)
MODIFY mod/forum/rate.php   Rev. 1.29    (+3 -5 lines)
MODIFY lib/pagelib.php   Rev. 1.75    (+6 -6 lines)
MODIFY lib/setup.php   Rev. 1.245    (+10 -1 lines)
MODIFY mod/choice/db/upgrade.php   Rev. 1.5    (+7 -13 lines)
MODIFY mod/forum/lib.php   Rev. 1.703    (+46 -29 lines)
MODIFY backup/db/Attic/upgrade.php   Rev. 1.4    (+7 -4 lines)
MODIFY mod/feedback/db/upgrade.php   Rev. 1.20    (+6 -5 lines)
MODIFY lang/en_utf8/data.php   Rev. 1.77    (+1 -3 lines)
MODIFY question/type/essay/db/upgrade.php   Rev. 1.5    (+7 -4 lines)
MODIFY blocks/db/Attic/upgrade.php   Rev. 1.7    (+6 -5 lines)
MODIFY mod/scorm/db/upgrade.php   Rev. 1.19    (+7 -6 lines)
Mitsuhiro Yoshida committed 6 files to 'Lang CVS' - 17/Aug/08 04:50 PM
MDL-16002 Translated new strings for upgrade.
MDL-16070 Updated translated strings for upgrade based on lang/en_utf8 fix.
MODIFY ja_utf8/admin.php   Rev. 1.289    (+12 -11 lines)
MODIFY ja_utf8/README   Rev. 1.788    (+1 -1 lines)
MODIFY ja_utf8/error.php   Rev. 1.87    (+9 -6 lines)
MODIFY ja_utf8/forum.php   Rev. 1.74    (+3 -3 lines)
MODIFY ja_utf8/debug.php   Rev. 1.15    (+8 -4 lines)
MODIFY ja_utf8/data.php   Rev. 1.99    (+8 -8 lines)
Petr Skoda added a comment - 18/Aug/08 06:26 AM
committed into cvs, thanks
please reopen in case of any problems or file new issue

Petr Skoda made changes - 18/Aug/08 06:26 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
martignoni committed 1 file to 'Lang CVS' - 27/Aug/08 04:30 PM
MDL-16002 strings mods
MODIFY fr_utf8/admin.php   Rev. 1.292    (+2 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 27/Aug/08 07:50 PM
MDL-16002 Forgotten string
MODIFY fr_utf8/error.php   Rev. 1.130    (+2 -1 lines)