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
326a1221
Commit
326a1221
authored
Nov 12, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove over optimization which didn't work correctly
Added story PLAT-293 to do it correctly. This fixes TNL-764
parent
d981f98b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+1
-5
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+2
-0
common/lib/xmodule/xmodule/modulestore/tests/test_publish.py
+8
-6
No files found.
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
326a1221
...
@@ -20,7 +20,6 @@ import re
...
@@ -20,7 +20,6 @@ import re
from
uuid
import
uuid4
from
uuid
import
uuid4
from
bson.son
import
SON
from
bson.son
import
SON
from
contracts
import
contract
,
new_contract
from
datetime
import
datetime
from
datetime
import
datetime
from
fs.osfs
import
OSFS
from
fs.osfs
import
OSFS
from
mongodb_proxy
import
MongoProxy
,
autoretry_read
from
mongodb_proxy
import
MongoProxy
,
autoretry_read
...
@@ -1237,10 +1236,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
...
@@ -1237,10 +1236,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
# update subtree edited info for ancestors
# update subtree edited info for ancestors
# don't update the subtree info for descendants of the publish root for efficiency
# don't update the subtree info for descendants of the publish root for efficiency
if
(
if
not
isPublish
or
(
isPublish
and
is_publish_root
):
(
not
isPublish
or
(
isPublish
and
is_publish_root
))
and
not
self
.
_is_in_bulk_operation
(
xblock
.
location
.
course_key
)
):
ancestor_payload
=
{
ancestor_payload
=
{
'edit_info.subtree_edited_on'
:
now
,
'edit_info.subtree_edited_on'
:
now
,
'edit_info.subtree_edited_by'
:
user_id
'edit_info.subtree_edited_by'
:
user_id
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
326a1221
...
@@ -1432,6 +1432,7 @@ class TestMixedModuleStore(CourseComparisonTest):
...
@@ -1432,6 +1432,7 @@ class TestMixedModuleStore(CourseComparisonTest):
self
.
assertLess
(
node
.
subtree_edited_on
,
subtree_before
)
self
.
assertLess
(
node
.
subtree_edited_on
,
subtree_before
)
self
.
assertEqual
(
node
.
subtree_edited_by
,
subtree_by
)
self
.
assertEqual
(
node
.
subtree_edited_by
,
subtree_by
)
with
self
.
store
.
bulk_operations
(
test_course
.
id
):
# Create a dummy vertical & html to test against
# Create a dummy vertical & html to test against
component
=
self
.
store
.
create_child
(
component
=
self
.
store
.
create_child
(
self
.
user_id
,
self
.
user_id
,
...
@@ -1461,6 +1462,7 @@ class TestMixedModuleStore(CourseComparisonTest):
...
@@ -1461,6 +1462,7 @@ class TestMixedModuleStore(CourseComparisonTest):
component
.
display_name
=
'Changed Display Name'
component
.
display_name
=
'Changed Display Name'
editing_user
=
self
.
user_id
-
2
editing_user
=
self
.
user_id
-
2
with
self
.
store
.
bulk_operations
(
test_course
.
id
):
# TNL-764 bulk ops disabled ancestor updates
component
=
self
.
store
.
update_item
(
component
,
editing_user
)
component
=
self
.
store
.
update_item
(
component
,
editing_user
)
after_edit
=
datetime
.
datetime
.
now
(
UTC
)
after_edit
=
datetime
.
datetime
.
now
(
UTC
)
check_node
(
component
.
location
,
after_create
,
after_edit
,
editing_user
,
after_create
,
after_edit
,
editing_user
)
check_node
(
component
.
location
,
after_create
,
after_edit
,
editing_user
,
after_create
,
after_edit
,
editing_user
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_publish.py
View file @
326a1221
...
@@ -24,20 +24,21 @@ class TestPublish(SplitWMongoCourseBoostrapper):
...
@@ -24,20 +24,21 @@ class TestPublish(SplitWMongoCourseBoostrapper):
# with bulk will delay all inheritance computations which won't be added into the mongo_calls
# with bulk will delay all inheritance computations which won't be added into the mongo_calls
with
self
.
draft_mongo
.
bulk_operations
(
self
.
old_course_key
):
with
self
.
draft_mongo
.
bulk_operations
(
self
.
old_course_key
):
# finds: 1 for parent to add child
# finds: 1 for parent to add child
and 2 to get ancestors
# sends: 1 for insert, 1 for parent (add child)
# sends: 1 for insert, 1 for parent (add child)
with
check_mongo_calls
(
1
,
2
):
with
check_mongo_calls
(
3
,
2
):
self
.
_create_item
(
'chapter'
,
'Chapter1'
,
{},
{
'display_name'
:
'Chapter 1'
},
'course'
,
'runid'
,
split
=
False
)
self
.
_create_item
(
'chapter'
,
'Chapter1'
,
{},
{
'display_name'
:
'Chapter 1'
},
'course'
,
'runid'
,
split
=
False
)
with
check_mongo_calls
(
2
,
2
):
with
check_mongo_calls
(
4
,
2
):
self
.
_create_item
(
'chapter'
,
'Chapter2'
,
{},
{
'display_name'
:
'Chapter 2'
},
'course'
,
'runid'
,
split
=
False
)
self
.
_create_item
(
'chapter'
,
'Chapter2'
,
{},
{
'display_name'
:
'Chapter 2'
},
'course'
,
'runid'
,
split
=
False
)
# For each vertical (2) created:
# For each vertical (2) created:
# - load draft
# - load draft
# - load non-draft
# - load non-draft
# - get last error
# - get last error
# - load parent
# - load parent
# - get ancestors
# - load inheritable data
# - load inheritable data
with
check_mongo_calls
(
7
,
4
):
with
check_mongo_calls
(
15
,
6
):
self
.
_create_item
(
'vertical'
,
'Vert1'
,
{},
{
'display_name'
:
'Vertical 1'
},
'chapter'
,
'Chapter1'
,
split
=
False
)
self
.
_create_item
(
'vertical'
,
'Vert1'
,
{},
{
'display_name'
:
'Vertical 1'
},
'chapter'
,
'Chapter1'
,
split
=
False
)
self
.
_create_item
(
'vertical'
,
'Vert2'
,
{},
{
'display_name'
:
'Vertical 2'
},
'chapter'
,
'Chapter1'
,
split
=
False
)
self
.
_create_item
(
'vertical'
,
'Vert2'
,
{},
{
'display_name'
:
'Vertical 2'
},
'chapter'
,
'Chapter1'
,
split
=
False
)
# For each (4) item created
# For each (4) item created
...
@@ -48,8 +49,9 @@ class TestPublish(SplitWMongoCourseBoostrapper):
...
@@ -48,8 +49,9 @@ class TestPublish(SplitWMongoCourseBoostrapper):
# - load parent
# - load parent
# - load inheritable data
# - load inheritable data
# - load parent
# - load parent
# - load ancestors
# count for updates increased to 16 b/c of edit_info updating
# count for updates increased to 16 b/c of edit_info updating
with
check_mongo_calls
(
16
,
8
):
with
check_mongo_calls
(
40
,
16
):
self
.
_create_item
(
'html'
,
'Html1'
,
"<p>Goodbye</p>"
,
{
'display_name'
:
'Parented Html'
},
'vertical'
,
'Vert1'
,
split
=
False
)
self
.
_create_item
(
'html'
,
'Html1'
,
"<p>Goodbye</p>"
,
{
'display_name'
:
'Parented Html'
},
'vertical'
,
'Vert1'
,
split
=
False
)
self
.
_create_item
(
self
.
_create_item
(
'discussion'
,
'Discussion1'
,
'discussion'
,
'Discussion1'
,
...
@@ -77,7 +79,7 @@ class TestPublish(SplitWMongoCourseBoostrapper):
...
@@ -77,7 +79,7 @@ class TestPublish(SplitWMongoCourseBoostrapper):
split
=
False
split
=
False
)
)
with
check_mongo_calls
(
0
,
2
):
with
check_mongo_calls
(
2
,
2
):
# 2 finds b/c looking for non-existent parents
# 2 finds b/c looking for non-existent parents
self
.
_create_item
(
'static_tab'
,
'staticuno'
,
"<p>tab</p>"
,
{
'display_name'
:
'Tab uno'
},
None
,
None
,
split
=
False
)
self
.
_create_item
(
'static_tab'
,
'staticuno'
,
"<p>tab</p>"
,
{
'display_name'
:
'Tab uno'
},
None
,
None
,
split
=
False
)
self
.
_create_item
(
'course_info'
,
'updates'
,
"<ol><li><h2>Sep 22</h2><p>test</p></li></ol>"
,
{},
None
,
None
,
split
=
False
)
self
.
_create_item
(
'course_info'
,
'updates'
,
"<ol><li><h2>Sep 22</h2><p>test</p></li></ol>"
,
{},
None
,
None
,
split
=
False
)
...
...
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