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
e8cf2a30
Commit
e8cf2a30
authored
Aug 12, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an Event to wait for each WorkerThread to begin the commit process.
parent
385471c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
src/ZEO/tests/CommitLockTests.py
src/ZEO/tests/CommitLockTests.py
+19
-0
No files found.
src/ZEO/tests/CommitLockTests.py
View file @
e8cf2a30
...
...
@@ -13,6 +13,7 @@
##############################################################################
"""Tests of the distributed commit lock."""
import
threading
import
time
from
ZODB.Transaction
import
Transaction
...
...
@@ -38,6 +39,7 @@ class WorkerThread(TestThread):
self
.
storage
=
storage
self
.
trans
=
trans
self
.
method
=
method
self
.
ready
=
threading
.
Event
()
TestThread
.
__init__
(
self
,
testcase
)
def
testrun
(
self
):
...
...
@@ -49,6 +51,7 @@ class WorkerThread(TestThread):
oid
=
self
.
storage
.
new_oid
()
p
=
zodb_pickle
(
MinPO
(
"c"
))
self
.
storage
.
store
(
oid
,
ZERO
,
p
,
''
,
self
.
trans
)
self
.
ready
.
set
()
self
.
storage
.
tpc_vote
(
self
.
trans
)
if
self
.
method
==
"tpc_finish"
:
self
.
storage
.
tpc_finish
(
self
.
trans
)
...
...
@@ -106,6 +109,21 @@ class CommitLockTests:
# check the commit lock when a client attemps a transaction,
# but fails/exits before finishing the commit.
# The general flow of these tests is to start a transaction by
# calling tpc_begin(). Then begin one or more other
# connections that also want to commit. This causes the
# commit lock code to be exercised. Once the other
# connections are started, the first transaction completes.
# Either by commit or abort, depending on whether method_name
# is "tpc_finish."
# The tests are parameterized by method_name, dosetup(), and
# dowork(). The dosetup() function is called with a
# connectioned client storage, transaction, and timestamp.
# Any work it does occurs after the first transaction has
# started, but before it finishes. The dowork() function
# executes after the first transaction has completed.
# Start on transaction normally.
t
=
Transaction
()
self
.
_storage
.
tpc_begin
(
t
)
...
...
@@ -155,6 +173,7 @@ class CommitLockTests:
t
=
WorkerThread
(
self
,
storage
,
trans
)
self
.
_threads
.
append
(
t
)
t
.
start
()
t
.
ready
.
wait
()
def
_dowork2
(
self
,
method_name
):
for
t
in
self
.
_threads
:
...
...
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