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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
42532c51
Commit
42532c51
authored
Jan 28, 2017
by
Jim Fulton
Committed by
GitHub
Jan 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #140 from zopefoundation/issue-139
Connection.new_oid delegates to its storage, not the DB.
parents
93baff53
177cfabe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
2 deletions
+18
-2
.coveragerc
.coveragerc
+1
-0
CHANGES.rst
CHANGES.rst
+7
-0
src/ZODB/Connection.py
src/ZODB/Connection.py
+3
-1
src/ZODB/DB.py
src/ZODB/DB.py
+7
-1
No files found.
.coveragerc
View file @
42532c51
...
@@ -8,5 +8,6 @@ omit =
...
@@ -8,5 +8,6 @@ omit =
[report]
[report]
exclude_lines =
exclude_lines =
pragma: nocover
pragma: nocover
pragma: no cover
if __name__ == ['"]__main__['"]:
if __name__ == ['"]__main__['"]:
assert False
assert False
CHANGES.rst
View file @
42532c51
...
@@ -2,6 +2,13 @@
...
@@ -2,6 +2,13 @@
Change History
Change History
================
================
5.1.2 (unreleased)
==================
- ``Connection.new_oid`` delegates to its storage, not the DB. This is
helpful for improving concurrency in MVCC storages like RelStorage.
See `issue 139 <https://github.com/zopefoundation/ZODB/issues/139`_.
5.1.1 (2016-11-18)
5.1.1 (2016-11-18)
==================
==================
...
...
src/ZODB/Connection.py
View file @
42532c51
...
@@ -126,7 +126,6 @@ class Connection(ExportImport, object):
...
@@ -126,7 +126,6 @@ class Connection(ExportImport, object):
storage
=
storage
.
new_instance
()
storage
=
storage
.
new_instance
()
self
.
_normal_storage
=
self
.
_storage
=
storage
self
.
_normal_storage
=
self
.
_storage
=
storage
self
.
new_oid
=
db
.
new_oid
self
.
_savepoint_storage
=
None
self
.
_savepoint_storage
=
None
# Do we need to join a txn manager?
# Do we need to join a txn manager?
...
@@ -200,6 +199,9 @@ class Connection(ExportImport, object):
...
@@ -200,6 +199,9 @@ class Connection(ExportImport, object):
self
.
_reader
=
ObjectReader
(
self
,
self
.
_cache
,
self
.
_db
.
classFactory
)
self
.
_reader
=
ObjectReader
(
self
,
self
.
_cache
,
self
.
_db
.
classFactory
)
def
new_oid
(
self
):
return
self
.
_storage
.
new_oid
()
def
add
(
self
,
obj
):
def
add
(
self
,
obj
):
"""Add a new object 'obj' to the database and assign it an oid."""
"""Add a new object 'obj' to the database and assign it an oid."""
if
self
.
opened
is
None
:
if
self
.
opened
is
None
:
...
...
src/ZODB/DB.py
View file @
42532c51
...
@@ -987,7 +987,13 @@ class DB(object):
...
@@ -987,7 +987,13 @@ class DB(object):
return
ContextManager
(
self
,
note
)
return
ContextManager
(
self
,
note
)
def
new_oid
(
self
):
def
new_oid
(
self
):
return
self
.
storage
.
new_oid
()
"""
Return a new oid from the storage.
Kept for backwards compatibility only. New oids should be
allocated in a transaction using an open Connection.
"""
return
self
.
storage
.
new_oid
()
# pragma: no cover
def
open_then_close_db_when_connection_closes
(
self
):
def
open_then_close_db_when_connection_closes
(
self
):
"""Create and return a connection.
"""Create and return a connection.
...
...
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