Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
1731c16f
Commit
1731c16f
authored
Jun 15, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a lock on the adapter
To prevent modifying the set of instances while iterating over them.
parent
29091374
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
src/ZODB/mvccadapter.py
src/ZODB/mvccadapter.py
+17
-11
No files found.
src/ZODB/mvccadapter.py
View file @
1731c16f
...
...
@@ -61,12 +61,14 @@ class MVCCAdapter(Base):
def
__init__
(
self
,
storage
):
Base
.
__init__
(
self
,
storage
)
self
.
_instances
=
set
()
self
.
_lock
=
threading
.
Lock
()
if
hasattr
(
storage
,
'registerDB'
):
storage
.
registerDB
(
self
)
def
new_instance
(
self
):
instance
=
MVCCAdapterInstance
(
self
)
self
.
_instances
.
add
(
instance
)
with
self
.
_lock
:
self
.
_instances
.
add
(
instance
)
return
instance
def
before_instance
(
self
,
before
=
None
):
...
...
@@ -76,7 +78,8 @@ class MVCCAdapter(Base):
return
UndoAdapterInstance
(
self
)
def
_release
(
self
,
instance
):
self
.
_instances
.
remove
(
instance
)
with
self
.
_lock
:
self
.
_instances
.
remove
(
instance
)
closed
=
False
def
close
(
self
):
...
...
@@ -87,21 +90,24 @@ class MVCCAdapter(Base):
del
self
.
_storage
def
invalidateCache
(
self
):
for
instance
in
self
.
_instances
:
instance
.
_invalidateCache
()
with
self
.
_lock
:
for
instance
in
self
.
_instances
:
instance
.
_invalidateCache
()
def
invalidate
(
self
,
transaction_id
,
oids
,
version
=
''
):
for
instance
in
self
.
_instances
:
instance
.
_invalidate
(
oids
)
with
self
.
_lock
:
for
instance
in
self
.
_instances
:
instance
.
_invalidate
(
oids
)
def
_invalidate_finish
(
self
,
oids
,
committing_instance
):
with
self
.
_lock
:
for
instance
in
self
.
_instances
:
if
instance
is
not
committing_instance
:
instance
.
_invalidate
(
oids
)
references
=
serialize
.
referencesf
transform_record_data
=
untransform_record_data
=
lambda
self
,
data
:
data
def
_invalidate_finish
(
self
,
oids
,
committing_instance
):
for
instance
in
self
.
_instances
:
if
instance
is
not
committing_instance
:
instance
.
_invalidate
(
oids
)
def
pack
(
self
,
pack_time
,
referencesf
):
return
self
.
_storage
.
pack
(
pack_time
,
referencesf
)
...
...
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