Split Mongo supports an arbitrary number of branches, though only "draft" and "published" are currently used. Course version history is preserved as edits are made, allowing rollback to a previous course version. Course locators for Split courses are the new style supported by opaque_keys. For example, here's a serialized Split course locator:
course-v1:SQU+SQU101+2014_T1+branch@published+version@8c056ceea2f35a1d705bd4c13d79c15b495a0f53
https://github.com/edx/edx-platform/wiki/Split:-the-versioning,-structure-saving-DAO
https://github.com/edx/edx-platform/wiki/Split-mongo-architecture-and-rollout-options
http://edx.readthedocs.org/projects/edx-developer-guide/en/latest/modulestores/split-mongo.html
There are three Split Mongo collections in MongoDB:
active_versions
document.structures
_id.structures
document.structures
document.definitions
collection.common/lib/xmodule/xmodule/modulestore/split_mongo
To retrieve the entire published course structure, the modulestore queries a single document from active_versions
and another single document from structures
(by _id).
How to Recover from a Broken Split Course
A project was started to assist in determining information about the history of a Split course - and to rollback a course to an earlier version. It's here:
https://github.com/macdiesel/edx-split-utils
Issue this command at the MongoDB command line of the replica DB:
db.modulestore.active_versions.find().forEach( function(obj) { var published_id = obj["versions"]["published-branch"]; struct_obj = db.modulestore.structures.findOne(published_id); var curr = Object.bsonsize(struct_obj); print(curr + " :: " + obj["org"] + "/" + obj["course"] + "/" + obj["run"]); } ) |
rs.slaveOk(); var course_id = { "org": "HarvardX", "course": "SPU27x", "run": "2015_Q2"}; course_idx = db.modulestore.active_versions.findOne(course_id); print("Course Index:") printjson(course_idx); var pub_struct_id = course_idx["versions"]["draft-branch"]; /* Walk the draft structure version tree backwards. */ var curr_struct = db.modulestore.structures.findOne( { "_id": pub_struct_id }, {_id: 1, edited_on: 1, previous_version: 1} ); print("Current draft structure: " + curr_struct._id); print("Edited on: " + curr_struct.edited_on); var generation = 1; while ( curr_struct != null ) { curr_struct = db.modulestore.structures.findOne( { "_id": curr_struct.previous_version }, {_id: 1, edited_on: 1, previous_version: 1} ); print("Previous: " + curr_struct._id + " - Edited on: " + curr_struct.edited_on + " - generation: " + generation); generation++; } |