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
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
Kirill Smelkov
ZEO
Commits
8ea8de5e
Commit
8ea8de5e
authored
Nov 18, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into msgpack
Conflicts: CHANGES.rst setup.py
parents
22f3dc47
fc06d153
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
66 additions
and
51 deletions
+66
-51
CHANGES.rst
CHANGES.rst
+14
-0
setup.py
setup.py
+3
-3
src/ZEO/ClientStorage.py
src/ZEO/ClientStorage.py
+1
-1
src/ZEO/StorageServer.py
src/ZEO/StorageServer.py
+2
-5
src/ZEO/scripts/timeout.py
src/ZEO/scripts/timeout.py
+2
-2
src/ZEO/scripts/zeoreplay.py
src/ZEO/scripts/zeoreplay.py
+2
-2
src/ZEO/tests/Cache.py
src/ZEO/tests/Cache.py
+3
-4
src/ZEO/tests/CommitLockTests.py
src/ZEO/tests/CommitLockTests.py
+3
-3
src/ZEO/tests/ConnectionTests.py
src/ZEO/tests/ConnectionTests.py
+7
-7
src/ZEO/tests/InvalidationTests.py
src/ZEO/tests/InvalidationTests.py
+3
-3
src/ZEO/tests/IterationTests.py
src/ZEO/tests/IterationTests.py
+10
-5
src/ZEO/tests/ThreadTests.py
src/ZEO/tests/ThreadTests.py
+2
-2
src/ZEO/tests/ZEO4/StorageServer.py
src/ZEO/tests/ZEO4/StorageServer.py
+2
-5
src/ZEO/tests/testZEO.py
src/ZEO/tests/testZEO.py
+12
-9
No files found.
CHANGES.rst
View file @
8ea8de5e
...
...
@@ -8,6 +8,20 @@ Changelog
servers to support Python 2 or 3 clients (but not both at the same
time) and may provide a small performance improvement.
5.0.4 (2016-11-18)
------------------
- Fixed: ZEO needed changes to work with recent transaction changes.
ZEO now works with the latest versions of ZODB and transaction
5.0.3 (2016-11-18)
------------------
- Temporarily require non-quite-current versions of ZODB and
transaction until we can sort out some recent breakage.
>>>>>>> origin/master
5.0.2 (2016-11-02)
------------------
...
...
setup.py
View file @
8ea8de5e
...
...
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
version
=
'5.0.
2
'
version
=
'5.0.
4
'
from
setuptools
import
setup
,
find_packages
import
os
...
...
@@ -26,9 +26,9 @@ if (3, 0) < sys.version_info < (3, 4):
sys
.
exit
(
1
)
install_requires
=
[
'ZODB >= 5.
0.0a5
'
,
'ZODB >= 5.
1.1
'
,
'six'
,
'transaction >= 2.0.
2
'
,
'transaction >= 2.0.
3
'
,
'persistent >= 4.1.0'
,
'zc.lockfile'
,
'ZConfig'
,
...
...
src/ZEO/ClientStorage.py
View file @
8ea8de5e
...
...
@@ -823,7 +823,7 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage):
try
:
self
.
_async
(
'tpc_begin'
,
id
(
txn
),
txn
.
user
,
txn
.
description
,
txn
.
_
extension
,
tid
,
status
)
txn
.
user
,
txn
.
description
,
txn
.
extension
,
tid
,
status
)
except
ClientDisconnected
:
self
.
tpc_end
(
txn
)
raise
...
...
src/ZEO/StorageServer.py
View file @
8ea8de5e
...
...
@@ -28,7 +28,6 @@ import sys
import
tempfile
import
threading
import
time
import
transaction
import
warnings
import
ZEO.asyncio.server
import
ZODB.blob
...
...
@@ -42,6 +41,7 @@ from ZEO._compat import Pickler, Unpickler, PY3, BytesIO
from
ZEO.Exceptions
import
AuthError
from
ZEO.monitor
import
StorageStats
from
ZEO.asyncio.server
import
Delay
,
MTDelay
,
Result
from
ZODB.Connection
import
TransactionMetaData
from
ZODB.loglevels
import
BLATHER
from
ZODB.POSException
import
StorageError
,
StorageTransactionError
from
ZODB.POSException
import
TransactionError
,
ReadOnlyError
,
ConflictError
...
...
@@ -308,11 +308,8 @@ class ZEOStorage:
raise
StorageTransactionError
(
"Multiple simultaneous tpc_begin"
" requests from one client."
)
t
=
transaction
.
Transaction
(
)
t
=
TransactionMetaData
(
user
,
description
,
ext
)
t
.
id
=
id
t
.
user
=
user
t
.
description
=
description
t
.
_extension
=
ext
self
.
serials
=
[]
self
.
conflicts
=
{}
...
...
src/ZEO/scripts/timeout.py
View file @
8ea8de5e
...
...
@@ -18,7 +18,7 @@ from __future__ import print_function
import
sys
import
time
from
ZODB.
Transaction
import
Transaction
from
ZODB.
Connection
import
TransactionMetaData
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.StorageTestBase
import
zodb_pickle
from
ZEO.ClientStorage
import
ClientStorage
...
...
@@ -57,7 +57,7 @@ def main():
revid
=
ZERO
data
=
MinPO
(
"timeout.py"
)
pickled_data
=
zodb_pickle
(
data
)
t
=
Transaction
()
t
=
Transaction
MetaData
()
t
.
user
=
"timeout.py"
storage
.
tpc_begin
(
t
)
storage
.
store
(
oid
,
revid
,
pickled_data
,
''
,
t
)
...
...
src/ZEO/scripts/zeoreplay.py
View file @
8ea8de5e
...
...
@@ -48,7 +48,7 @@ from ZODB.FileStorage import FileStorage
#from BDBStorage.BDBFullStorage import BDBFullStorage
#from Standby.primary import PrimaryStorage
#from Standby.config import RS_PORT
from
ZODB.
Transaction
import
Transaction
from
ZODB.
Connection
import
TransactionMetaData
from
ZODB.utils
import
p64
from
functools
import
reduce
...
...
@@ -149,7 +149,7 @@ class ReplayTxn(TxnStat):
def replay(self):
ZERO = '
\
0
'*8
t0 = now()
t = Transaction()
t = Transaction
MetaData
()
self._storage.tpc_begin(t)
for obj in self._objects:
oid = obj.oid
...
...
src/ZEO/tests/Cache.py
View file @
8ea8de5e
...
...
@@ -13,11 +13,10 @@
##############################################################################
"""Tests of the ZEO cache"""
from
ZODB.Connection
import
TransactionMetaData
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.StorageTestBase
import
zodb_unpickle
from
transaction
import
Transaction
class
TransUndoStorageWithCache
:
def
checkUndoInvalidation
(
self
):
...
...
@@ -35,8 +34,8 @@ class TransUndoStorageWithCache:
tid
=
info
[
0
][
'id'
]
# Now start an undo transaction
t
=
Transaction
()
t
.
note
(
'undo1'
)
t
=
Transaction
MetaData
()
t
.
note
(
u
'undo1'
)
oids
=
self
.
_begin_undos_vote
(
t
,
tid
)
# Make sure this doesn't load invalid data into the cache
...
...
src/ZEO/tests/CommitLockTests.py
View file @
8ea8de5e
...
...
@@ -17,7 +17,7 @@ import threading
import
time
from
persistent.TimeStamp
import
TimeStamp
import
transaction
from
ZODB.Connection
import
TransactionMetaData
from
ZODB.tests.StorageTestBase
import
zodb_pickle
,
MinPO
import
ZEO.ClientStorage
...
...
@@ -89,7 +89,7 @@ class CommitLockTests:
self
.
_storages
=
[]
def
_start_txn
(
self
):
txn
=
transaction
.
Transaction
()
txn
=
TransactionMetaData
()
self
.
_storage
.
tpc_begin
(
txn
)
oid
=
self
.
_storage
.
new_oid
()
self
.
_storage
.
store
(
oid
,
ZERO
,
zodb_pickle
(
MinPO
(
1
)),
''
,
txn
)
...
...
@@ -104,7 +104,7 @@ class CommitLockTests:
for
i
in
range
(
self
.
NUM_CLIENTS
):
storage
=
self
.
_duplicate_client
()
txn
=
transaction
.
Transaction
()
txn
=
TransactionMetaData
()
tid
=
self
.
_get_timestamp
()
t
=
WorkerThread
(
self
,
storage
,
txn
)
...
...
src/ZEO/tests/ConnectionTests.py
View file @
8ea8de5e
...
...
@@ -24,6 +24,7 @@ from ZEO.Exceptions import ClientDisconnected
from
ZEO.asyncio.marshal
import
encode
from
ZEO.tests
import
forker
from
ZODB.Connection
import
TransactionMetaData
from
ZODB.DB
import
DB
from
ZODB.POSException
import
ReadOnlyError
,
ConflictError
from
ZODB.tests.StorageTestBase
import
StorageTestBase
...
...
@@ -32,7 +33,6 @@ from ZODB.tests.StorageTestBase import zodb_pickle, zodb_unpickle
import
ZODB.tests.util
import
transaction
from
transaction
import
Transaction
from
.
import
testssl
...
...
@@ -863,7 +863,7 @@ class ReconnectionTests(CommonSetupTearDown):
self
.
_storage
=
self
.
openClientStorage
()
self
.
_dostore
()
oids
=
[
self
.
_storage
.
new_oid
()
for
i
in
range
(
5
)]
txn
=
Transaction
()
txn
=
Transaction
MetaData
()
self
.
_storage
.
tpc_begin
(
txn
)
for
oid
in
oids
:
data
=
zodb_pickle
(
MinPO
(
oid
))
...
...
@@ -957,7 +957,7 @@ class TimeoutTests(CommonSetupTearDown):
def
checkTimeout
(
self
):
self
.
_storage
=
storage
=
self
.
openClientStorage
()
txn
=
Transaction
()
txn
=
Transaction
MetaData
()
storage
.
tpc_begin
(
txn
)
storage
.
tpc_vote
(
txn
)
time
.
sleep
(
2
)
...
...
@@ -977,7 +977,7 @@ class TimeoutTests(CommonSetupTearDown):
def
checkTimeoutOnAbort
(
self
):
storage
=
self
.
openClientStorage
()
txn
=
Transaction
()
txn
=
Transaction
MetaData
()
storage
.
tpc_begin
(
txn
)
storage
.
tpc_vote
(
txn
)
storage
.
tpc_abort
(
txn
)
...
...
@@ -985,7 +985,7 @@ class TimeoutTests(CommonSetupTearDown):
def
checkTimeoutOnAbortNoLock
(
self
):
storage
=
self
.
openClientStorage
()
txn
=
Transaction
()
txn
=
Transaction
MetaData
()
storage
.
tpc_begin
(
txn
)
storage
.
tpc_abort
(
txn
)
storage
.
close
()
...
...
@@ -998,7 +998,7 @@ class TimeoutTests(CommonSetupTearDown):
oid
=
storage
.
new_oid
()
obj
=
MinPO
(
7
)
# Now do a store, sleeping before the finish so as to cause a timeout
t
=
Transaction
()
t
=
Transaction
MetaData
()
old_connection_count
=
storage
.
connection_count_for_tests
storage
.
tpc_begin
(
t
)
revid1
=
storage
.
store
(
oid
,
ZERO
,
zodb_pickle
(
obj
),
''
,
t
)
...
...
@@ -1051,7 +1051,7 @@ class MSTThread(threading.Thread):
c
.
__serials
=
{}
# Begin a transaction
t
=
Transaction
()
t
=
Transaction
MetaData
()
for
c
in
clients
:
#print("%s.%s.%s begin" % (tname, c.__name, i))
c
.
tpc_begin
(
t
)
...
...
src/ZEO/tests/InvalidationTests.py
View file @
8ea8de5e
...
...
@@ -83,7 +83,7 @@ class StressTask:
def
commit
(
self
):
cn
=
self
.
cn
key
=
self
.
startnum
self
.
tm
.
get
().
note
(
"add key %s"
%
key
)
self
.
tm
.
get
().
note
(
u
"add key %s"
%
key
)
try
:
self
.
tm
.
get
().
commit
()
except
ConflictError
as
msg
:
...
...
@@ -155,7 +155,7 @@ class StressThread(FailableThread):
while
not
self
.
stop
.
isSet
():
try
:
tree
[
key
]
=
self
.
threadnum
tm
.
get
().
note
(
"add key %s"
%
key
)
tm
.
get
().
note
(
u
"add key %s"
%
key
)
tm
.
commit
()
self
.
commitdict
[
self
]
=
1
if
self
.
sleep
:
...
...
@@ -218,7 +218,7 @@ class LargeUpdatesThread(FailableThread):
break
else
:
# print("%d set #%d" % (self.threadnum, len(keys)))
transaction
.
get
().
note
(
"keys %s"
%
", "
.
join
(
map
(
str
,
keys
)))
transaction
.
get
().
note
(
u
"keys %s"
%
", "
.
join
(
map
(
str
,
keys
)))
try
:
transaction
.
commit
()
self
.
commitdict
[
self
]
=
1
...
...
src/ZEO/tests/IterationTests.py
View file @
8ea8de5e
...
...
@@ -17,6 +17,8 @@ import transaction
import
six
import
gc
from
ZODB.Connection
import
TransactionMetaData
from
..asyncio.testing
import
AsyncRPC
class
IterationTests
:
...
...
@@ -28,14 +30,16 @@ class IterationTests:
# First, confirm that it ran
self
.
assertTrue
(
self
.
_storage
.
_iterators
.
_last_gc
>
0
)
gc_enabled
=
gc
.
isenabled
()
gc
.
disable
()
# make sure there's no race conditions cleaning out the weak refs
# make sure there's no race conditions cleaning out the weak refs
gc
.
disable
()
try
:
self
.
assertEquals
(
0
,
len
(
self
.
_storage
.
_iterator_ids
))
except
AssertionError
:
# Ok, we have ids. That should also mean that the
# weak dictionary has the same length.
self
.
assertEqual
(
len
(
self
.
_storage
.
_iterators
),
len
(
self
.
_storage
.
_iterator_ids
))
self
.
assertEqual
(
len
(
self
.
_storage
.
_iterators
),
len
(
self
.
_storage
.
_iterator_ids
))
# Now if we do a collection and re-ask for iterator_gc
# everything goes away as expected.
gc
.
enable
()
...
...
@@ -44,7 +48,8 @@ class IterationTests:
self
.
_storage
.
_iterator_gc
()
self
.
assertEqual
(
len
(
self
.
_storage
.
_iterators
),
len
(
self
.
_storage
.
_iterator_ids
))
self
.
assertEqual
(
len
(
self
.
_storage
.
_iterators
),
len
(
self
.
_storage
.
_iterator_ids
))
self
.
assertEquals
(
0
,
len
(
self
.
_storage
.
_iterator_ids
))
finally
:
if
gc_enabled
:
...
...
@@ -126,7 +131,7 @@ class IterationTests:
iid
=
list
(
self
.
_storage
.
_iterator_ids
)[
0
]
t
=
transaction
.
Transaction
()
t
=
TransactionMetaData
()
self
.
_storage
.
_iterators
.
_last_gc
=
-
1
self
.
_storage
.
tpc_begin
(
t
)
self
.
_storage
.
tpc_abort
(
t
)
...
...
@@ -143,7 +148,7 @@ class IterationTests:
six
.
advance_iterator
(
self
.
_storage
.
iterator
())
iid
=
list
(
self
.
_storage
.
_iterator_ids
)[
0
]
t
=
transaction
.
Transaction
()
t
=
TransactionMetaData
()
self
.
_storage
.
tpc_begin
(
t
)
# Show that after disconnecting, the client side GCs the iterators
# as well. I'm calling this directly to avoid accidentally
...
...
src/ZEO/tests/ThreadTests.py
View file @
8ea8de5e
...
...
@@ -15,7 +15,7 @@
import
threading
import
transaction
from
ZODB.Connection
import
TransactionMetaData
from
ZODB.tests.StorageTestBase
import
zodb_pickle
,
MinPO
import
ZEO.Exceptions
...
...
@@ -24,7 +24,7 @@ ZERO = '\0'*8
class
BasicThread
(
threading
.
Thread
):
def
__init__
(
self
,
storage
,
doNextEvent
,
threadStartedEvent
):
self
.
storage
=
storage
self
.
trans
=
transaction
.
Transaction
()
self
.
trans
=
TransactionMetaData
()
self
.
doNextEvent
=
doNextEvent
self
.
threadStartedEvent
=
threadStartedEvent
self
.
gotValueError
=
0
...
...
src/ZEO/tests/ZEO4/StorageServer.py
View file @
8ea8de5e
...
...
@@ -28,7 +28,6 @@ import sys
import
tempfile
import
threading
import
time
import
transaction
import
warnings
from
.zrpc.error
import
DisconnectedError
import
ZODB.blob
...
...
@@ -43,6 +42,7 @@ from ZEO.Exceptions import AuthError
from
.monitor
import
StorageStats
,
StatsServer
from
.zrpc.connection
import
ManagedServerConnection
,
Delay
,
MTDelay
,
Result
from
.zrpc.server
import
Dispatcher
from
ZODB.Connection
import
TransactionMetaData
from
ZODB.loglevels
import
BLATHER
from
ZODB.POSException
import
StorageError
,
StorageTransactionError
from
ZODB.POSException
import
TransactionError
,
ReadOnlyError
,
ConflictError
...
...
@@ -375,11 +375,8 @@ class ZEOStorage:
raise
StorageTransactionError
(
"Multiple simultaneous tpc_begin"
" requests from one client."
)
t
=
transaction
.
Transaction
(
)
t
=
TransactionMetaData
(
user
,
description
,
ext
)
t
.
id
=
id
t
.
user
=
user
t
.
description
=
description
t
.
_extension
=
ext
self
.
serials
=
[]
self
.
invalidated
=
[]
...
...
src/ZEO/tests/testZEO.py
View file @
8ea8de5e
...
...
@@ -20,6 +20,8 @@ from ZEO.ClientStorage import ClientStorage
from
ZEO.tests
import
forker
,
Cache
,
CommitLockTests
,
ThreadTests
from
ZEO.tests
import
IterationTests
from
ZEO._compat
import
PY3
from
ZODB.Connection
import
TransactionMetaData
from
ZODB.tests
import
StorageTestBase
,
BasicStorage
,
\
TransactionalUndoStorage
,
\
PackableStorage
,
Synchronization
,
ConflictResolution
,
RevisionStorage
,
\
...
...
@@ -551,7 +553,7 @@ class CommonBlobTests:
data
=
zodb_pickle
(
blob
)
self
.
assert_
(
os
.
path
.
exists
(
tfname
))
t
=
transaction
.
Transaction
()
t
=
TransactionMetaData
()
try
:
self
.
_storage
.
tpc_begin
(
t
)
self
.
_storage
.
storeBlob
(
oid
,
ZERO
,
data
,
tfname
,
''
,
t
)
...
...
@@ -590,7 +592,7 @@ class CommonBlobTests:
oid
=
self
.
_storage
.
new_oid
()
data
=
zodb_pickle
(
blob
)
t
=
transaction
.
Transaction
()
t
=
TransactionMetaData
()
try
:
self
.
_storage
.
tpc_begin
(
t
)
self
.
_storage
.
storeBlob
(
oid
,
ZERO
,
data
,
tfname
,
''
,
t
)
...
...
@@ -614,7 +616,7 @@ class CommonBlobTests:
oid
=
self
.
_storage
.
new_oid
()
with
open
(
'blob_file'
,
'wb'
)
as
f
:
f
.
write
(
b'I am a happy blob.'
)
t
=
transaction
.
Transaction
()
t
=
TransactionMetaData
()
self
.
_storage
.
tpc_begin
(
t
)
self
.
_storage
.
storeBlob
(
oid
,
ZODB
.
utils
.
z64
,
'foo'
,
'blob_file'
,
''
,
t
)
...
...
@@ -655,7 +657,7 @@ class BlobAdaptedFileStorageTests(FullGenericTests, CommonBlobTests):
data
=
zodb_pickle
(
blob
)
self
.
assert_
(
os
.
path
.
exists
(
tfname
))
t
=
transaction
.
Transaction
()
t
=
TransactionMetaData
()
try
:
self
.
_storage
.
tpc_begin
(
t
)
self
.
_storage
.
storeBlob
(
oid
,
ZERO
,
data
,
tfname
,
''
,
t
)
...
...
@@ -918,24 +920,25 @@ def tpc_finish_error():
>>> conn = db.open()
>>> conn.root.x = 1
>>> t = conn.transaction_manager.get()
>>> conn.
_storage.
tpc_begin(t)
>>> conn.tpc_begin(t)
>>> conn.commit(t)
>>> _ = client.tpc_vote(t)
>>> transaction_meta_data = t.data(conn)
>>> _ = client.tpc_vote(transaction_meta_data)
Cause some breakage by messing with the clients transaction
buffer, sadly, using implementation details:
>>> tbuf =
t.data(client
)
>>> tbuf =
client._check_trans(transaction_meta_data, 'test'
)
>>> tbuf.client_resolved = None
tpc_finish will fail:
>>> client.tpc_finish(t) # doctest: +ELLIPSIS
>>> client.tpc_finish(t
ransaction_meta_data
) # doctest: +ELLIPSIS
Traceback (most recent call last):
...
AttributeError: ...
>>> client.tpc_abort(t)
>>> client.tpc_abort(t
ransaction_meta_data
)
>>> t.abort()
But we can still load the saved data:
...
...
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