Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
60746157
Commit
60746157
authored
Feb 26, 2001
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged fix for non-subtransaction supporting jars from 2.3 branch
parent
aeab8c93
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
8 deletions
+42
-8
src/ZODB/Transaction.py
src/ZODB/Transaction.py
+42
-8
No files found.
src/ZODB/Transaction.py
View file @
60746157
...
@@ -84,8 +84,8 @@
...
@@ -84,8 +84,8 @@
##############################################################################
##############################################################################
"""Transaction management
"""Transaction management
$Id: Transaction.py,v 1.2
6 2001/02/15 20:01:12 jim
Exp $"""
$Id: Transaction.py,v 1.2
7 2001/02/26 20:33:50 brian
Exp $"""
__version__
=
'$Revision: 1.2
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
7
$'
[
11
:
-
2
]
import
time
,
sys
,
struct
,
POSException
import
time
,
sys
,
struct
,
POSException
from
struct
import
pack
from
struct
import
pack
...
@@ -103,7 +103,13 @@ class Transaction:
...
@@ -103,7 +103,13 @@ class Transaction:
_connections
=
None
_connections
=
None
_extension
=
None
_extension
=
None
_sub
=
None
# This is a subtrasaction flag
_sub
=
None
# This is a subtrasaction flag
_sub_no_partial_abort
=
None
# The _non_st_objects variable is either None or a list
# of jars that do not support subtransactions. This is used to
# manage non-subtransaction-supporting jars during subtransaction
# commits and aborts to ensure that they are correctly committed
# or aborted in the "outside" transaction.
_non_st_objects
=
None
def
__init__
(
self
,
id
=
None
):
def
__init__
(
self
,
id
=
None
):
self
.
_id
=
id
self
.
_id
=
id
...
@@ -138,7 +144,7 @@ class Transaction:
...
@@ -138,7 +144,7 @@ class Transaction:
entered two-phase commit yet, so no tpc_ messages are sent.
entered two-phase commit yet, so no tpc_ messages are sent.
'''
'''
if
subtransaction
and
self
.
_sub_no_partial_abort
:
if
subtransaction
and
(
self
.
_non_st_objects
is
not
None
)
:
raise
POSException
.
TransactionError
,
(
raise
POSException
.
TransactionError
,
(
"""Attempted to abort a sub-transaction, but a participating
"""Attempted to abort a sub-transaction, but a participating
data manager doesn't support partial abort.
data manager doesn't support partial abort.
...
@@ -149,12 +155,21 @@ class Transaction:
...
@@ -149,12 +155,21 @@ class Transaction:
subjars
=
()
subjars
=
()
if
not
subtransaction
:
if
not
subtransaction
:
# Must add in any non-subtransaction supporting objects that
# may have been stowed away from previous subtransaction
# commits.
if
self
.
_non_st_objects
is
not
None
:
append
=
self
.
_objects
.
append
for
object
in
self
.
_non_st_objects
:
append
(
object
)
self
.
_non_st_objects
=
None
if
subj
is
not
None
:
if
subj
is
not
None
:
# Abort of top-level transaction after commiting
# Abort of top-level transaction after commiting
# subtransactions.
# subtransactions.
subjars
=
subj
.
values
()
subjars
=
subj
.
values
()
self
.
_sub
=
None
self
.
_sub
=
None
self
.
_sub_no_partial_abort
=
None
try
:
try
:
# Abort the objects
# Abort the objects
...
@@ -199,6 +214,7 @@ class Transaction:
...
@@ -199,6 +214,7 @@ class Transaction:
jarsv
=
None
jarsv
=
None
subj
=
self
.
_sub
subj
=
self
.
_sub
subjars
=
()
subjars
=
()
if
subtransaction
:
if
subtransaction
:
if
subj
is
None
:
self
.
_sub
=
subj
=
{}
if
subj
is
None
:
self
.
_sub
=
subj
=
{}
else
:
else
:
...
@@ -209,7 +225,15 @@ class Transaction:
...
@@ -209,7 +225,15 @@ class Transaction:
objects
=
[]
objects
=
[]
subjars
=
subj
.
values
()
subjars
=
subj
.
values
()
self
.
_sub
=
None
self
.
_sub
=
None
self
.
_sub_no_partial_abort
=
None
# If not a subtransaction, then we need to add any non-
# subtransaction-supporting objects that may have been
# stowed away during subtransaction commits to _objects.
if
(
subtransaction
is
None
)
and
(
self
.
_non_st_objects
is
not
None
):
append
=
objects
.
append
for
object
in
self
.
_non_st_objects
:
append
(
object
)
self
.
_non_st_objects
=
None
t
=
v
=
tb
=
None
t
=
v
=
tb
=
None
...
@@ -255,12 +279,22 @@ class Transaction:
...
@@ -255,12 +279,22 @@ class Transaction:
if
not
jars
.
has_key
(
i
):
if
not
jars
.
has_key
(
i
):
jars
[
i
]
=
j
jars
[
i
]
=
j
if
subtransaction
:
if
subtransaction
:
# If a jar does not support subtransactions,
# we need to save it away to be committed in
# the outer transaction.
try
:
j
.
tpc_begin
(
self
,
subtransaction
)
try
:
j
.
tpc_begin
(
self
,
subtransaction
)
except
TypeError
:
except
TypeError
:
j
.
tpc_begin
(
self
)
j
.
tpc_begin
(
self
)
self
.
_sub_no_partial_abort
=
1
else
:
if
hasattr
(
j
,
'commit_sub'
)
:
subj
[
i
]
=
j
subj
[
i
]
=
j
else
:
if
self
.
_non_st_objects
is
None
:
self
.
_non_st_objects
=
[]
self
.
_non_st_objects
.
append
(
o
)
continue
else
:
else
:
j
.
tpc_begin
(
self
)
j
.
tpc_begin
(
self
)
j
.
commit
(
o
,
self
)
j
.
commit
(
o
,
self
)
...
...
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