feat: store split modulestore's course indexes in Django/MySQL
Split modulestore persists data in three MongoDB "collections": course_index (list of courses and the current version of each), structure (outline of the courses, and some XBlock fields), and definition (other XBlock fields). While "structure" and "definition" data can get very large, which is one of the reasons MongoDB was chosen for modulestore, the course index data is very small. By moving course index data to MySQL / a django model, we get these advantages: * Full history of changes to the course index data is now preserved * Includes a django admin view to inspect the list of courses and libraries * It's much easier to "reset" a corrupted course to a known working state, by using the simple-history revert tools from the django admin. * The remaining MongoDB collections (structure and definition) are essentially just used as key-value stores of large JSON data structures. This paves the way for future changes that allow migrating courses one at a time from MongoDB to S3, and thus eliminating any use of MongoDB by split modulestore, simplifying the stack.
This commit is contained in:
committed by
David Ormsbee
parent
d20a769f73
commit
96e5ff8dce
@@ -1014,9 +1014,9 @@ class TestTOC(ModuleStoreTestCase):
|
||||
# Split makes 2 queries to load the course to depth 2:
|
||||
# - 1 for the structure
|
||||
# - 1 for 5 definitions
|
||||
# Split makes 1 query to render the toc:
|
||||
# - 1 for the active version at the start of the bulk operation
|
||||
@ddt.data((ModuleStoreEnum.Type.mongo, 3, 0, 0), (ModuleStoreEnum.Type.split, 2, 0, 1))
|
||||
# Split makes 1 MySQL query to render the toc:
|
||||
# - 1 MySQL for the active version at the start of the bulk operation (no mongo calls)
|
||||
@ddt.data((ModuleStoreEnum.Type.mongo, 3, 0, 0), (ModuleStoreEnum.Type.split, 2, 0, 0))
|
||||
@ddt.unpack
|
||||
def test_toc_toy_from_chapter(self, default_ms, setup_finds, setup_sends, toc_finds):
|
||||
with self.store.default_store(default_ms):
|
||||
@@ -1054,9 +1054,9 @@ class TestTOC(ModuleStoreTestCase):
|
||||
# Split makes 2 queries to load the course to depth 2:
|
||||
# - 1 for the structure
|
||||
# - 1 for 5 definitions
|
||||
# Split makes 1 query to render the toc:
|
||||
# - 1 for the active version at the start of the bulk operation
|
||||
@ddt.data((ModuleStoreEnum.Type.mongo, 3, 0, 0), (ModuleStoreEnum.Type.split, 2, 0, 1))
|
||||
# Split makes 1 MySQL query to render the toc:
|
||||
# - 1 MySQL for the active version at the start of the bulk operation (no mongo calls)
|
||||
@ddt.data((ModuleStoreEnum.Type.mongo, 3, 0, 0), (ModuleStoreEnum.Type.split, 2, 0, 0))
|
||||
@ddt.unpack
|
||||
def test_toc_toy_from_section(self, default_ms, setup_finds, setup_sends, toc_finds):
|
||||
with self.store.default_store(default_ms):
|
||||
|
||||
@@ -389,7 +389,7 @@ class IndexQueryTestCase(ModuleStoreTestCase):
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.mongo, 10, 164),
|
||||
(ModuleStoreEnum.Type.split, 4, 160),
|
||||
(ModuleStoreEnum.Type.split, 3, 161),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_index_query_counts(self, store_type, expected_mongo_query_count, expected_mysql_query_count):
|
||||
|
||||
@@ -162,9 +162,9 @@ class RenderXBlockTestMixin(MasqueradeMixin, metaclass=ABCMeta):
|
||||
|
||||
@ddt.data(
|
||||
('vertical_block', ModuleStoreEnum.Type.mongo, 13),
|
||||
('vertical_block', ModuleStoreEnum.Type.split, 6),
|
||||
('vertical_block', ModuleStoreEnum.Type.split, 4),
|
||||
('html_block', ModuleStoreEnum.Type.mongo, 14),
|
||||
('html_block', ModuleStoreEnum.Type.split, 6),
|
||||
('html_block', ModuleStoreEnum.Type.split, 4),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_courseware_html(self, block_name, default_store, mongo_calls):
|
||||
@@ -192,7 +192,7 @@ class RenderXBlockTestMixin(MasqueradeMixin, metaclass=ABCMeta):
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.mongo, 5),
|
||||
(ModuleStoreEnum.Type.split, 5),
|
||||
(ModuleStoreEnum.Type.split, 4),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_success_enrolled_staff(self, default_store, mongo_calls):
|
||||
|
||||
Reference in New Issue
Block a user