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
5ed86a50
Commit
5ed86a50
authored
Jul 12, 2005
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert internal uses of subtxns to use savepoints instead.
I suspect BTrees/convert.py should be removed instead.
parent
b9cded14
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
NEWS.txt
NEWS.txt
+35
-0
src/BTrees/convert.py
src/BTrees/convert.py
+7
-2
src/ZODB/ExportImport.py
src/ZODB/ExportImport.py
+2
-2
No files found.
NEWS.txt
View file @
5ed86a50
...
...
@@ -28,6 +28,41 @@ Savepoints
marked a savepoint as invalid after its first use. The implementation has
been repaired, to match the docs.
Subtransactions
---------------
- (3.4.1a5) Internal uses of subtransactions (transaction ``commit()`` or
``abort()`` passing a true argument) were rewritten to use savepoints
instead. Application code is strongly encouraged to do this too:
subtransactions are weaker, will be deprecated soon, and do not mix well
with savepoints (when you do a subtransaction commit, all current
savepoints are made unusable). In general, a subtransaction commit
done just to free memory can be changed from::
transaction.commit(1)
to::
transaction.savepoint()
That is, make a savepoint, and forget it. In rarer cases, a
subtransaction commit is followed later by a subtransaction abort. In
that case, change the initial::
transaction.commit(1)
to::
sp = transaction.savepoint()
and in place of the subtransaction abort::
transaction.abort(1)
roll back the savepoint instead::
sp.rollback()
FileStorage
-----------
...
...
src/BTrees/convert.py
View file @
5ed86a50
...
...
@@ -12,6 +12,11 @@
#
##############################################################################
# TODO: does this script still serve a purpose? Writing this in 2005,
# "old btree" doesn't mean much to me.
import
transaction
def
convert
(
old
,
new
,
threshold
=
200
,
f
=
None
):
"Utility for converting old btree to new"
n
=
0
...
...
@@ -20,9 +25,9 @@ def convert(old, new, threshold=200, f=None):
new
[
k
]
=
v
n
=
n
+
1
if
n
>
threshold
:
transaction
.
commit
(
1
)
transaction
.
savepoint
(
)
old
.
_p_jar
.
cacheMinimize
()
n
=
0
transaction
.
commit
(
1
)
transaction
.
savepoint
(
)
old
.
_p_jar
.
cacheMinimize
()
src/ZODB/ExportImport.py
View file @
5ed86a50
...
...
@@ -56,7 +56,7 @@ class ExportImport:
# This is tricky, because we need to work in a transaction!
if
isinstance
(
f
,
str
):
f
=
open
(
f
,
'rb'
)
f
=
open
(
f
,
'rb'
)
magic
=
f
.
read
(
4
)
if
magic
!=
'ZEXP'
:
...
...
@@ -72,7 +72,7 @@ class ExportImport:
return_oid_list
=
[]
self
.
_import
=
f
,
return_oid_list
self
.
_register
()
t
.
commit
(
1
)
t
.
savepoint
(
)
# Return the root imported object.
if
return_oid_list
:
return
self
.
get
(
return_oid_list
[
0
])
...
...
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