Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
a205788c
Commit
a205788c
authored
Aug 26, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work around for split not having a coherent way to work with/track updated versions of structures
parent
e624ff3b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
11 deletions
+32
-11
cms/djangoapps/contentstore/tests/test_crud.py
+0
-2
common/lib/xmodule/xmodule/modulestore/split_migrator.py
+5
-2
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+25
-5
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+2
-2
No files found.
cms/djangoapps/contentstore/tests/test_crud.py
View file @
a205788c
...
...
@@ -208,8 +208,6 @@ class TemplateTests(unittest.TestCase):
# The draft course root has 2 revisions: the published revision, and then the subsequent
# changes to the draft revision
version_history
=
self
.
split_store
.
get_block_generations
(
test_course
.
location
)
# Base calculations on the draft revision, not the initial published revision
version_history
=
version_history
.
children
[
0
]
self
.
assertEqual
(
version_history
.
locator
.
version_guid
,
test_course
.
location
.
version_guid
)
self
.
assertEqual
(
len
(
version_history
.
children
),
1
)
self
.
assertEqual
(
version_history
.
children
[
0
]
.
children
,
[])
...
...
common/lib/xmodule/xmodule/modulestore/split_migrator.py
View file @
a205788c
...
...
@@ -67,11 +67,14 @@ class SplitMigrator(object):
**
kwargs
)
with
self
.
split_modulestore
.
bulk_write_operations
(
new_course
.
id
):
self
.
_copy_published_modules_to_course
(
new_course
,
original_course
.
location
,
source_course_key
,
user_id
,
**
kwargs
)
# TODO: This should be merged back into the above transaction, but can't be until split.py
# is refactored to have more coherent access patterns
with
self
.
split_modulestore
.
bulk_write_operations
(
new_course_key
):
# create a new version for the drafts
self
.
_add_draft_modules_to_course
(
new_course
.
location
,
source_course_key
,
user_id
,
**
kwargs
)
...
...
@@ -81,7 +84,7 @@ class SplitMigrator(object):
"""
Copy all of the modules from the 'direct' version of the course to the new split course.
"""
course_version_locator
=
new_course
.
id
course_version_locator
=
new_course
.
id
.
replace
(
version_guid
=
None
)
# iterate over published course elements. Wildcarding rather than descending b/c some elements are orphaned (e.g.,
# course about pages, conditionals)
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
a205788c
...
...
@@ -113,10 +113,6 @@ class BulkWriteRecord(object):
self
.
structures
=
{}
self
.
structures_in_db
=
set
()
# This stores the set of branches for whom version_structure
# has been called
self
.
dirty_branches
=
set
()
@property
def
active
(
self
):
"""
...
...
@@ -143,13 +139,37 @@ class BulkWriteRecord(object):
"""
return
self
.
_active_count
==
1
# TODO: This needs to track which branches have actually been modified/versioned,
# so that copying one branch to another doesn't update the original branch.
@property
def
dirty_branches
(
self
):
"""
Return a list of which branch version ids differ from what was stored
in the database at the beginning of this bulk operation.
"""
# If no course index has been set, then no branches have changed
if
self
.
index
is
None
:
return
[]
# If there was no index in the database to start with, then all branches
# are dirty by definition
if
self
.
initial_index
is
None
:
return
self
.
index
.
get
(
'versions'
,
{})
.
keys
()
# Return branches whose ids differ between self.index and self.initial_index
return
[
branch
for
branch
,
_id
in
self
.
index
.
get
(
'versions'
,
{})
.
items
()
if
self
.
initial_index
.
get
(
'versions'
,
{})
.
get
(
branch
)
!=
_id
]
def
structure_for_branch
(
self
,
branch
):
return
self
.
structures
.
get
(
self
.
index
.
get
(
'versions'
,
{})
.
get
(
branch
))
def
set_structure_for_branch
(
self
,
branch
,
structure
):
self
.
index
.
get
(
'versions'
,
{})[
branch
]
=
structure
[
'_id'
]
self
.
structures
[
structure
[
'_id'
]]
=
structure
self
.
dirty_branches
.
add
(
branch
)
def
__repr__
(
self
):
return
u"BulkWriteRecord<{!r}, {!r}, {!r}, {!r}, {!r}>"
.
format
(
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
a205788c
...
...
@@ -714,10 +714,10 @@ class TestMixedModuleStore(unittest.TestCase):
# - load vertical
# - load inheritance data
# TODO: LMS-11220: Document why draft send count is
5
# TODO: LMS-11220: Document why draft send count is
6
# TODO: LMS-11220: Document why draft find count is 18
# TODO: LMS-11220: Document why split find count is 16
@ddt.data
((
'draft'
,
[
19
,
5
],
0
),
(
'split'
,
[
2
,
2
],
0
))
@ddt.data
((
'draft'
,
[
19
,
6
],
0
),
(
'split'
,
[
2
,
2
],
0
))
@ddt.unpack
def
test_path_to_location
(
self
,
default_ms
,
num_finds
,
num_sends
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment