Moodle

Groups related upgrade problem

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.8.5, 1.9.1
  • Fix Version/s: 1.8.7, 1.9.3
  • Component/s: General
  • Labels:
    None
  • Environment:
    Windows 2003 server running Moodle 1.8.5
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

When updating from 1.8.5+ (Build: 20080702) (2007081000) to 1.9.1+ (Build: 20080702) (2007101514)...

(mysql): ALTER TABLE mdl_groups MODIFY COLUMN password VARCHAR (50) NULL DEFAULT NULL after description

1054: Unknown column 'password' in 'mdl_groups'

There are 4 warnings with this error and at the bottom of the screen, you can select CONTINUE, but nothing ever happens. The same warning page is displayed. If I exit the screen and go back into Moodle, it lets me in and asks me to upgrade files again. The same thing displays and never goes further.

Issue Links

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

That's really strange. Do you get that error the FIRST time you tried to run the upgrade of AFTER the first time?

That field (groups->password) is renamed to groups->enrolmentkey as part of the upgrade to 1.9... perhaps that's the cause of the errors (not finding the field), but only because it has been renamed in the first upgrade.

Can you go back to 1.8.x and re-run the upgrade again? And report the structure of all your group/grouping tables + the errors you get the first time the upgrade is executed?

Assigning this to Petr... thanks! Ciao

Show
Eloy Lafuente (stronk7) added a comment - That's really strange. Do you get that error the FIRST time you tried to run the upgrade of AFTER the first time? That field (groups->password) is renamed to groups->enrolmentkey as part of the upgrade to 1.9... perhaps that's the cause of the errors (not finding the field), but only because it has been renamed in the first upgrade. Can you go back to 1.8.x and re-run the upgrade again? And report the structure of all your group/grouping tables + the errors you get the first time the upgrade is executed? Assigning this to Petr... thanks! Ciao
Hide
Petr Škoda (skodak) added a comment -

This looks like another failed groups upgrade during 1.7.x->1.8.x

Show
Petr Škoda (skodak) added a comment - This looks like another failed groups upgrade during 1.7.x->1.8.x
Hide
Petr Škoda (skodak) added a comment -

Could you please have a look into the upgrade logs stored in moodledata/upgradelogs/, try to find file with groups related upgrade 1.7.x -> 1.8.x and the one with the initial upgrade 1.8.5+ -> 1.9.1+ - this might give us a clue what happened.

Show
Petr Škoda (skodak) added a comment - Could you please have a look into the upgrade logs stored in moodledata/upgradelogs/, try to find file with groups related upgrade 1.7.x -> 1.8.x and the one with the initial upgrade 1.8.5+ -> 1.9.1+ - this might give us a clue what happened.
Hide
Robert Kern added a comment -

Dear Lafuente, Dear Skoda,

we will also update to 1.9 but have the same problem. In the logfile i see follow (from 1.7.4 -> 1.8):

------------------------------------------------------------------------------------

<h2 class="main">group</h2><hr />
(mysql): ALTER TABLE mdl_groups MODIFY COLUMN description TEXT NULL after name  
<hr />
<div class="notifysuccess" style="text-align:center">Erfolg</div><br />
<hr />
(mysql): ALTER TABLE mdl_groups CHANGE password enrolmentkey VARCHAR(50) NOT NULL DEFAULT ''  
<hr />
<div class="notifysuccess" style="text-align:center">Erfolg</div><br />
<hr />
(mysql): ALTER TABLE mdl_groups MODIFY COLUMN lang VARCHAR(30) NOT NULL DEFAULT 'en' after enrolmentkey  
<hr />
<div class="notifysuccess" style="text-align:center">Erfolg</div><br />
<hr />
(mysql): ALTER TABLE mdl_groups MODIFY COLUMN hidepicture TINYINT(1) unsigned NOT NULL DEFAULT 0 after picture  
<hr />
<div class="notifysuccess" style="text-align:center">Erfolg</div><br />
<hr />
(mysql): SHOW TABLES  
<hr />
-----------------------------------------------------------

Now from 1.8 to 1.9 i got the same errors how Lafuente:

-----------------------------------------------------------------------------
(mysql): ALTER TABLE mdl_groups MODIFY COLUMN password VARCHAR(50) NULL DEFAULT NULL after description
1054: Unknown column 'password' in 'mdl_groups'

ADOConnection._Execute(ALTER TABLE mdl_groups MODIFY COLUMN password VARCHAR(50) NULL DEFAULT NULL after description, false) % line 891, file: adodb.inc.php
ADOConnection.Execute(ALTER TABLE mdl_groups MODIFY COLUMN password VARCHAR(50) NULL DEFAULT NULL after description) % line 89, file: dmllib.php
execute_sql(ALTER TABLE mdl_groups MODIFY COLUMN password VARCHAR(50) NULL DEFAULT NULL after description, true) % line 2256, file: dmllib.php
execute_sql_arr(Array[1], true, true) % line 1127, file: ddllib.php
change_field_type(Object:XMLDBTable, Object:XMLDBField, true, true) % line 1175, file: ddllib.php
--------------------------------------------------------------------------

The problem i see the password column in mdl_groups will change in a previous Update (i think from 1.7 -> 1.8) in a column called enrolmentkey. Now in 1.9. he will Alter the column Password, but this will not exist (it called enrollmentkey now).

My solution was to change enrolmentkey in password again, but i dont now if it ok.

Show
Robert Kern added a comment - Dear Lafuente, Dear Skoda, we will also update to 1.9 but have the same problem. In the logfile i see follow (from 1.7.4 -> 1.8): ------------------------------------------------------------------------------------ <h2 class="main">group</h2><hr /> (mysql): ALTER TABLE mdl_groups MODIFY COLUMN description TEXT NULL after name   <hr /> <div class="notifysuccess" style="text-align:center">Erfolg</div><br /> <hr /> (mysql): ALTER TABLE mdl_groups CHANGE password enrolmentkey VARCHAR(50) NOT NULL DEFAULT ''   <hr /> <div class="notifysuccess" style="text-align:center">Erfolg</div><br /> <hr /> (mysql): ALTER TABLE mdl_groups MODIFY COLUMN lang VARCHAR(30) NOT NULL DEFAULT 'en' after enrolmentkey   <hr /> <div class="notifysuccess" style="text-align:center">Erfolg</div><br /> <hr /> (mysql): ALTER TABLE mdl_groups MODIFY COLUMN hidepicture TINYINT(1) unsigned NOT NULL DEFAULT 0 after picture   <hr /> <div class="notifysuccess" style="text-align:center">Erfolg</div><br /> <hr /> (mysql): SHOW TABLES   <hr /> ----------------------------------------------------------- Now from 1.8 to 1.9 i got the same errors how Lafuente: ----------------------------------------------------------------------------- (mysql): ALTER TABLE mdl_groups MODIFY COLUMN password VARCHAR(50) NULL DEFAULT NULL after description 1054: Unknown column 'password' in 'mdl_groups' ADOConnection._Execute(ALTER TABLE mdl_groups MODIFY COLUMN password VARCHAR(50) NULL DEFAULT NULL after description, false) % line 891, file: adodb.inc.php ADOConnection.Execute(ALTER TABLE mdl_groups MODIFY COLUMN password VARCHAR(50) NULL DEFAULT NULL after description) % line 89, file: dmllib.php execute_sql(ALTER TABLE mdl_groups MODIFY COLUMN password VARCHAR(50) NULL DEFAULT NULL after description, true) % line 2256, file: dmllib.php execute_sql_arr(Array[1], true, true) % line 1127, file: ddllib.php change_field_type(Object:XMLDBTable, Object:XMLDBField, true, true) % line 1175, file: ddllib.php -------------------------------------------------------------------------- The problem i see the password column in mdl_groups will change in a previous Update (i think from 1.7 -> 1.8) in a column called enrolmentkey. Now in 1.9. he will Alter the column Password, but this will not exist (it called enrollmentkey now). My solution was to change enrolmentkey in password again, but i dont now if it ok.
Hide
Petr Škoda (skodak) added a comment -

Hello,

1.7 - groups->password
1.8 - groups->enrolmentkey
1.9 - groups->enrolmentkey

the 1.9.x contains separate upgrade code for 1.7x and 1.8x
if (table_exists(new XMLDBTable('groups_groupings'))) { /// IF 'groups_groupings' table exists, this is for 1.8.* only. $result = $result && upgrade_18_groups(); } else { /// ELSE, 1.7.*/1.6.*/1.5.* - create 'groupings' and 'groupings_groups' + rename password to enrolmentkey $result = $result && upgrade_17_groups(); }

there might be a problem with 'groups_groupings' table, which could be caused by incomplete 1.8 upgrade

Show
Petr Škoda (skodak) added a comment - Hello, 1.7 - groups->password 1.8 - groups->enrolmentkey 1.9 - groups->enrolmentkey the 1.9.x contains separate upgrade code for 1.7x and 1.8x if (table_exists(new XMLDBTable('groups_groupings'))) { /// IF 'groups_groupings' table exists, this is for 1.8.* only. $result = $result && upgrade_18_groups(); } else { /// ELSE, 1.7.*/1.6.*/1.5.* - create 'groupings' and 'groupings_groups' + rename password to enrolmentkey $result = $result && upgrade_17_groups(); } there might be a problem with 'groups_groupings' table, which could be caused by incomplete 1.8 upgrade
Hide
Robert Kern added a comment -

Hi Petr,

yes same code we found for 30 minutes but the question is why he will update the groups_groupings incomplete. We will look tomorrow, and give a status comment. Two other question Petr:

1. When we finished the update (1.7>1.8>1.9) we found a next problem. We canot create any groups in a course. When we look in the mdl_groups table we have found the problem. The column courseid was missing. After we create this column, groups crating will work fine.

2. After this problems, we decided to upgrade directly to 1.9 (from 1.7). When we update from 1.7 to 1.9 directly all functions shows very good. The installation will finished without problems. There are any problems when we update directly? What you mean?

Thanks for help and we see us tomorrow
Best regards
Robert

Show
Robert Kern added a comment - Hi Petr, yes same code we found for 30 minutes but the question is why he will update the groups_groupings incomplete. We will look tomorrow, and give a status comment. Two other question Petr: 1. When we finished the update (1.7>1.8>1.9) we found a next problem. We canot create any groups in a course. When we look in the mdl_groups table we have found the problem. The column courseid was missing. After we create this column, groups crating will work fine. 2. After this problems, we decided to upgrade directly to 1.9 (from 1.7). When we update from 1.7 to 1.9 directly all functions shows very good. The installation will finished without problems. There are any problems when we update directly? What you mean? Thanks for help and we see us tomorrow Best regards Robert
Hide
Petr Škoda (skodak) added a comment -

Ah, yes this looks like a broken/incomplete groups upgrade in 1.8.x,
most probably the bug is not in 1.9.x

Show
Petr Škoda (skodak) added a comment - Ah, yes this looks like a broken/incomplete groups upgrade in 1.8.x, most probably the bug is not in 1.9.x
Hide
Dominik Anonymous added a comment -

i found the problem for that, i linked to my issue....

Show
Dominik Anonymous added a comment - i found the problem for that, i linked to my issue....
Hide
Matthew N added a comment -

I would just like to update the status of this issue by saying that this problem still exists in the weekly builds from yesterday. I just updated a 1.5.4 site to 1.6.7+ -> 1.8.6+ -> 1.9.2+ and received the same error. Looking at the mdl_groups table structure, I see the 'enrolmentkey' column.
I can confirm Robert's point #1 that I do not have the courseid column in mdl_groups table anymore.

I have DB backups & logs from every step of the upgrade if you would like them

Show
Matthew N added a comment - I would just like to update the status of this issue by saying that this problem still exists in the weekly builds from yesterday. I just updated a 1.5.4 site to 1.6.7+ -> 1.8.6+ -> 1.9.2+ and received the same error. Looking at the mdl_groups table structure, I see the 'enrolmentkey' column. I can confirm Robert's point #1 that I do not have the courseid column in mdl_groups table anymore. I have DB backups & logs from every step of the upgrade if you would like them
Hide
Helen Foster added a comment -

Another report of a groups related upgrade problem: http://moodle.org/mod/forum/discuss.php?d=104406

Show
Helen Foster added a comment - Another report of a groups related upgrade problem: http://moodle.org/mod/forum/discuss.php?d=104406
Hide
Brian Lockwood added a comment -

As a contributer to this issue, http://moodle.org/mod/forum/discuss.php?d=104406

I have noticed that a 1.7>1,8 upgrade rename password to enrolmentkey,
1.8>1.9 expected this to be still called password and so renaming it back to password allowed the 1.9 upgrade to proceed uneventfully.

Next, we end up with a missing courseid field in our upgraded mdl_groups (which is indexed) also the id and courseid are now bigint(10).

I am in the process of repopulating the courseid field with the data from my 1.7 installation.

Show
Brian Lockwood added a comment - As a contributer to this issue, http://moodle.org/mod/forum/discuss.php?d=104406 I have noticed that a 1.7>1,8 upgrade rename password to enrolmentkey, 1.8>1.9 expected this to be still called password and so renaming it back to password allowed the 1.9 upgrade to proceed uneventfully. Next, we end up with a missing courseid field in our upgraded mdl_groups (which is indexed) also the id and courseid are now bigint(10). I am in the process of repopulating the courseid field with the data from my 1.7 installation.
Hide
Brian Lockwood added a comment -

I have put a workaround in the forum which worked for me. Cooments welcomed in case it will subtly hose the database of all who use it!

I also have access to the 1.7, 1.8 and 1.9 database dumps from my version of this upgrade problem if this is helpful to anyone.

The workaround is at http://moodle.org/mod/forum/discuss.php?d=104406#p461485

Show
Brian Lockwood added a comment - I have put a workaround in the forum which worked for me. Cooments welcomed in case it will subtly hose the database of all who use it! I also have access to the 1.7, 1.8 and 1.9 database dumps from my version of this upgrade problem if this is helpful to anyone. The workaround is at http://moodle.org/mod/forum/discuss.php?d=104406#p461485
Hide
Petr Škoda (skodak) added a comment -

The 1.8.x groups upgrade should be finally fixed, all I needed in order to replicate this was to see the "groups_members duplicate key" error from upgrade logs
Thanks go to Brian Lockwood for mentioning it on moodle.org forum.

Description of the problem:
1/ this affects only sites with duplicates in groups_members table (not sure how these got there, probably duobleclicking or some unknown bug might have caused this)
2/ the 1.8 groups upgrade code should not continue if any error found, but unfortunately there is another bug that clears the error flag and at the end of the groups upgrade the courseid field gets removed from groups table
3/ groups stop working in 1.8.x
4/ uprade fails and can not continue in 1.9x

Solution:
a/ update 1.8.x from cvs (or wait for next weekly build), revert to 1.7.x preupgrade full sql backup and rerun upgrade (I am sure you all have it, right?)
b/ or upgrade to latest 1.9.x cvs or next weekly - please note that all groups will disappear because they can not be linked back to course automatically (you might add them manually)

Petr

Show
Petr Škoda (skodak) added a comment - The 1.8.x groups upgrade should be finally fixed, all I needed in order to replicate this was to see the "groups_members duplicate key" error from upgrade logs Thanks go to Brian Lockwood for mentioning it on moodle.org forum. Description of the problem: 1/ this affects only sites with duplicates in groups_members table (not sure how these got there, probably duobleclicking or some unknown bug might have caused this) 2/ the 1.8 groups upgrade code should not continue if any error found, but unfortunately there is another bug that clears the error flag and at the end of the groups upgrade the courseid field gets removed from groups table 3/ groups stop working in 1.8.x 4/ uprade fails and can not continue in 1.9x Solution: a/ update 1.8.x from cvs (or wait for next weekly build), revert to 1.7.x preupgrade full sql backup and rerun upgrade (I am sure you all have it, right?) b/ or upgrade to latest 1.9.x cvs or next weekly - please note that all groups will disappear because they can not be linked back to course automatically (you might add them manually) Petr
Hide
Brian Lockwood added a comment -

see my post here.

http://moodle.org/mod/forum/discuss.php?d=104724

I have actually fixed groups after a failed upgrade and I am pretty convinced in my own mind that the lack of autoincrement in the upgraded mdl-groups table is the culprit.

Show
Brian Lockwood added a comment - see my post here. http://moodle.org/mod/forum/discuss.php?d=104724 I have actually fixed groups after a failed upgrade and I am pretty convinced in my own mind that the lack of autoincrement in the upgraded mdl-groups table is the culprit.
Hide
Brian Lockwood added a comment -

Further to above, the lack of autoincrement apples to mdl_groups_members as well. I just add this here for completeness.

Show
Brian Lockwood added a comment - Further to above, the lack of autoincrement apples to mdl_groups_members as well. I just add this here for completeness.
Hide
Eloy Lafuente (stronk7) added a comment -

Closing.

Show
Eloy Lafuente (stronk7) added a comment - Closing.

Dates

  • Created:
    Updated:
    Resolved: