Issue Details (XML | Word | Printable)

Key: MDL-9217
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Petr Škoda (skodak)
Reporter: Gustav W Delius
Votes: 0
Watchers: 5
Operations

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

Upgrade from 1.6.3 to 1.8 reports missing table groups_courses_groups

Created: 05/Apr/07 03:59 PM   Updated: 08/Jan/08 07:26 AM
Component/s: Installation
Affects Version/s: 1.8
Fix Version/s: 1.8.1

File Attachments: 1. Text File groups_upgrade.patch (10 kB)

Issue Links:
Dependency
 
Relates
 

Participants: Daniel Miksik, Eloy Lafuente (stronk7), Gustav W Delius, Martin Dougiamas, Nicolas Connault, Petr Škoda (skodak) and Rahim Virani
Security Level: None
Resolved date: 29/Apr/07
Affected Branches: MOODLE_18_STABLE
Fixed Branches: MOODLE_18_STABLE


 Description  « Hide
While upgrading a Moodle installation from version 1.6.3 (2006050530) to 1.8 (2007021501) I repeatedly get the error message

Table 'mathsmoodle18.mdl_groups_courses_groups' doesn't exist

SELECT g.id, gm.userid FROM mdl_groups_members gm INNER JOIN mdl_groups g ON gm.groupid = g.id INNER JOIN mdl_groups_courses_groups cg ON g.id = cg.groupid WHERE cg.courseid = '304' AND gm.userid = '26'

This occurs during the processing of the role assignments. Apparently the roles assignments are processed before the groups tables are updated.

The debug output also gives something like:

  • line 677 of lib\dmllib.php: call to debugging()
  • line 918 of lib\dmllib.php: call to get_recordset_sql()
  • line 110 of group\db\dbbasicgrouplib.php: call to get_records_sql()
  • line 81 of group\lib\basicgrouplib.php: call to groups_db_get_groups_for_user()
  • line 54 of group\lib\legacylib.php: call to groups_get_groups_for_user()
  • line 2256 of lib\accesslib.php: call to get_groups()
  • line 2110 of lib\moodlelib.php: call to role_unassign()
  • line 2191 of lib\accesslib.php: call to sync_metacourse()
  • line 1498 of lib\accesslib.php: call to role_assign()
  • line 324 of admin\index.php: call to moodle_install_roles()


 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Petr Škoda (skodak) added a comment - 05/Apr/07 04:27 PM
this was the exact reason why I proposed MDL-8251, groups are used from core, they must be IMO upgraded/installed together with core.

Nicolas Connault added a comment - 05/Apr/07 04:30 PM
Yu and I have been searching through the entire Moodle codebase for an explanation, and so far we've been unlucky. But we found a function in group/db/dbsetup.php that creates all the tables. However we couldn't find any single call to this function anywhere.

Our first hypothetical conclusion is that the function has been written, but the creator forgot/neglected to put a call to it in group/db/upgrade.php for upgrading versions below a certain number (including 1.6.3). We are conducting some tests to investigate this hypothesis.


Martin Dougiamas added a comment - 28/Apr/07 09:28 PM
This is a very serious blocker for anyone upgrading from 1.6.

I totally agree with Petr about moving groups back into core for 1.9 .... for now he's going to try making the groups upgrade happen before roles in admin/index.php in 1.8.1 ... hopefully this will not cause more regressions ...


Petr Škoda (skodak) added a comment - 29/Apr/07 07:47 PM
should be fixed in cvs, please report any trouble here or reopen.

thanks for the report!!


Daniel Miksik added a comment - 06/Oct/07 10:29 AM
I ran into the very same problem during an upgrade from 1.6.3 (2006050530) to 1.8.2+ (2007021520). In my case the table 'groups_courses_groups' was not created in the previous step of the upgrade because there were duplicate rows in table 'groups_members':

CREATE UNIQUE INDEX mdl_groumemb_grouse_uix ON mdl_groups_members (groupid, userid)
resulted in
1062: Duplicate entry '0-677' for key 2
and the following part of the group upgrade code was not executed.

I had to remove the duplicate entries and then run the upgrade again.

(When looking – in Moodle – into the groups with duplicate rows (groupid, userid) in the 'groups_members' table, there seems to be nothing wrong with them. I have no idea where the duplicate rows have come from.)

After the second upgrade – with no warnings – two tables are not present in the db: mdl_groups_members_temp and mdl_groups_temp (when compared to a clean installation of Moodle 1.8.2+ (2007021520)). Should I be worried?


Rahim Virani added a comment - 08/Jan/08 02:47 AM
We have upgraded to Moodle 1.8.3 and are having the same issue, we have also had the issue outlined in:
http://tracker.moodle.org/browse/MDL-11879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

Groups are currently broken and we have noticed this days after upgrading (we upgrade while all the students and faculty are away).

There has been mention of fixes but no details to any of it.

We were on Moodle 1.6.5+ and we moved to 1.8.3, we did an intermediary upgrade to Moodle 1.7.3 to get there.

The instance is rather large (10K+ users 500+ courses). Please let me know what needs to be done. Someone apparently named 'eloy' helped somone named 'jwatkins' fix this issue.

Daniel, if I were you I would be worried.

Hope someone responds soon!

Kind Regards,

R.


Eloy Lafuente (stronk7) added a comment - 08/Jan/08 07:26 AM
Hi Rahim,

and... do you have one backup of your 1.6.5+ database? It would be great to have one snapshot of the structure (better if it contains real data) in order to be able to reproduce the problem.

In the related bug MDL-11879, the problem was one table not having one field, so I (Eloy) helped a bit to Jeffrey in order to rebuild as many groups as possible "manually" (he hadn't a backup of the site!).

I remember we have tested a lot of upgrades of groups between 1.6, 1.7 and 1.8 and haven't been able to reproduce the problem. For sure, something in your DB is "different" and causes the problem. It's only a matter of detecting it (to be able to fix it).

Ciao