Skip to content

Instantly share code, notes, and snippets.

Statements run:
mysql> select * from course_groups_courseusergroup;
mysql> select * from course_groups_courseusergroup_users;
mysql> select * from course_groups_cohortmembership;
mysql> insert into course_groups_courseusergroup_users values (4, 1, 3);
edxapp@precise64:~/edx-platform$ ./manage.py lms --settings=devstack migrate course_groups
----clear database, at migration 0004----
Initial state, release as it currently runs. 2 cohorts have been enabled, and one user is in both of them simultaneously.
Database queries at that time
mysql> select * from course_groups_cohortmembership;
ERROR 1146 (42S02): Table 'edxapp.course_groups_cohortmembership' doesn't exist
mysql> select * from course_groups_courseusergroup_users;
+----+--------------------+---------+
| id | courseusergroup_id | user_id |
+----+--------------------+---------+
| 3 | 1 | 1 |
@efischer19
efischer19 / cohort_problems_sql.txt
Created November 24, 2015 14:27
SQL describing cohort problems after django 1.8 upgrade, and short term fix
What's going on:
-Users are not being removed from their course_groups_courseusergroup_user records when they should be
-CohortMemberships are working fine
Evidence:
-there are 34 affected users:
mysql> SELECT user_id FROM course_groups_courseusergroup_users WHERE ( courseusergroup_id, user_id ) NOT IN (SELECT course_user_group_id, user_id FROM course_groups_cohortmembership);
"show me all the users who appear to have an old-style memebrship record that is not tracked by a corresponding new-style record"
+---------+
| user_id |
Console Output
14:41:39 Started by upstream project "add-course-to-sandbox" build number 494
14:41:39 originally caused by:
14:41:39 Started by upstream project "set-ora2-version-on-sandbox" build number 466
14:41:39 originally caused by:
14:41:39 Started by user Eric Fischer
14:41:39 [EnvInject] - Loading node environment variables.
14:41:39 Building in workspace /var/lib/jenkins/jobs/ora2-acceptance-tests/workspace
14:41:39 > git rev-parse --is-inside-work-tree # timeout=10
mysql> select count(*) from submissions_submission;
+----------+
| count(*) |
+----------+
| 1457 |
+----------+
1 row in set (0.00 sec)
edxapp@precise64:~/edx-platform$ ./manage.py lms migrate submissions 0003 --settings=devstack
DEBUG:django.db.backends:(0.000) SET SQL_AUTO_IS_NULL = 0; args=None
ericfischer@dhcp-18-189-33-162:~/devstack/src/edx-ora2$ tar tvfz dist/ora2-0.2.8.tar.gz
drwxr-xr-x 0 ericfischer staff 0 Feb 24 15:46 ora2-0.2.8/
-rw-r--r-- 0 ericfischer staff 867 Feb 24 11:39 ora2-0.2.8/AUTHORS
-rw-r--r-- 0 ericfischer staff 35135 Feb 24 11:39 ora2-0.2.8/LICENSE
-rw-r--r-- 0 ericfischer staff 267 Feb 24 15:30 ora2-0.2.8/MANIFEST.in
drwxr-xr-x 0 ericfischer staff 0 Feb 24 15:46 ora2-0.2.8/openassessment/
-rw-r--r-- 0 ericfischer staff 0 Feb 24 11:39 ora2-0.2.8/openassessment/__init__.py
drwxr-xr-x 0 ericfischer staff 0 Feb 24 15:46 ora2-0.2.8/openassessment/assessment/
-rw-r--r-- 0 ericfischer staff 0 Feb 24 11:39 ora2-0.2.8/openassessment/assessment/__init__.py
-rw-r--r-- 0 ericfischer staff 5328 Feb 24 11:39 ora2-0.2.8/openassessment/assessment/admin.py
drwxr-xr-x 0 ericfischer staff 0 Feb 25 13:49 edx-ora2-0.2.8/
-rw-r--r-- 0 ericfischer staff 867 Feb 25 10:08 edx-ora2-0.2.8/AUTHORS
drwxr-xr-x 0 ericfischer staff 0 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/
-rw-r--r-- 0 ericfischer staff 1 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/dependency_links.txt
-rw-r--r-- 0 ericfischer staff 92 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/entry_points.txt
-rw-r--r-- 0 ericfischer staff 453 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/PKG-INFO
-rw-r--r-- 0 ericfischer staff 360 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/requires.txt
-rw-r--r-- 0 ericfischer staff 30920 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/SOURCES.txt
-rw-r--r-- 0 ericfischer staff 24 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/top_level.txt
-rw-r--r-- 0 ericfischer staff 35135 Feb 25 10:08 edx-ora2-0.2.8/LICENSE
drwxr-xr-x 0 ericfischer staff 0 Feb 25 13:49 edx-ora2-0.2.8/
-rw-r--r-- 0 ericfischer staff 867 Feb 25 10:08 edx-ora2-0.2.8/AUTHORS
drwxr-xr-x 0 ericfischer staff 0 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/
-rw-r--r-- 0 ericfischer staff 1 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/dependency_links.txt
-rw-r--r-- 0 ericfischer staff 92 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/entry_points.txt
-rw-r--r-- 0 ericfischer staff 453 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/PKG-INFO
-rw-r--r-- 0 ericfischer staff 360 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/requires.txt
-rw-r--r-- 0 ericfischer staff 30920 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/SOURCES.txt
-rw-r--r-- 0 ericfischer staff 24 Feb 25 13:49 edx-ora2-0.2.8/edx_ora2.egg-info/top_level.txt
-rw-r--r-- 0 ericfischer staff 35135 Feb 25 10:08 edx-ora2-0.2.8/LICENSE
#!/bin/bash
echo 'Before running this command, ensure there are no running processes using port 8000'
echo 'If a process appears in the following command, quit this script and kill that, then run script again'
echo 'sudo lsof -i :8000'
sudo lsof -i :8000
rm -rf ../devstack
mkdir ../devstack
curl -L https://raw.githubusercontent.com/edx/configuration/master/vagrant/release/devstack/Vagrantfile > Vagrantfile
cp VagrantFile ../devstack
cd ../devstack
ericfischer@Eric-Fischers-MacBook-Pro:~/scripts$ . ./reset_devstack.sh
Before running this command, ensure there are no running processes using port 8000
If a process appears in the following command, quit this script and kill that, then run script again
sudo lsof -i :8000
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6147 100 6147 0 0 62776 0 --:--:-- --:--:-- --:--:-- 63371
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Installed the plugin 'vagrant-vbguest (0.11.0)'!
Bringing machine 'default' up with 'virtualbox' provider...