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
b05992e1
Commit
b05992e1
authored
Mar 13, 2013
by
Albertas Agejevas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More trivial Py3 fixes.
parent
c19bae1d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
67 additions
and
61 deletions
+67
-61
src/ZEO/ClientStorage.py
src/ZEO/ClientStorage.py
+1
-1
src/ZEO/StorageServer.py
src/ZEO/StorageServer.py
+3
-1
src/ZEO/tests/ConnectionTests.py
src/ZEO/tests/ConnectionTests.py
+4
-4
src/ZEO/tests/InvalidationTests.py
src/ZEO/tests/InvalidationTests.py
+4
-4
src/ZEO/tests/client-config.test
src/ZEO/tests/client-config.test
+1
-1
src/ZEO/tests/drop_cache_rather_than_verify.txt
src/ZEO/tests/drop_cache_rather_than_verify.txt
+6
-6
src/ZEO/tests/registerDB.test
src/ZEO/tests/registerDB.test
+5
-5
src/ZEO/tests/testConnection.py
src/ZEO/tests/testConnection.py
+9
-9
src/ZEO/tests/testConversionSupport.py
src/ZEO/tests/testConversionSupport.py
+3
-3
src/ZEO/tests/zdoptions.test
src/ZEO/tests/zdoptions.test
+19
-15
src/ZEO/tests/zeo-fan-out.test
src/ZEO/tests/zeo-fan-out.test
+5
-5
src/ZEO/tests/zeo_blob_cache.test
src/ZEO/tests/zeo_blob_cache.test
+6
-6
src/ZEO/zrpc/connection.py
src/ZEO/zrpc/connection.py
+1
-1
No files found.
src/ZEO/ClientStorage.py
View file @
b05992e1
...
...
@@ -409,7 +409,7 @@ class ClientStorage(object):
if
blob_cache_size
is
not
None
:
assert
blob_cache_size_check
<
100
self
.
_blob_cache_size_check
=
(
blob_cache_size
*
blob_cache_size_check
/
100
)
blob_cache_size
*
blob_cache_size_check
/
/
100
)
self
.
_check_blob_size
()
self
.
_rpc_mgr
=
self
.
ConnectionManagerClass
(
addr
,
self
,
...
...
src/ZEO/StorageServer.py
View file @
b05992e1
...
...
@@ -1560,7 +1560,9 @@ class ZEOStorage308Adapter:
return
getattr
(
self
.
storage
,
name
)
def
_addr_label
(
addr
):
if
isinstance
(
addr
,
type
(
""
)):
if
isinstance
(
addr
,
six
.
binary_type
):
return
addr
.
decode
(
'ascii'
)
if
isinstance
(
addr
,
six
.
string_types
):
return
addr
else
:
host
,
port
=
addr
...
...
src/ZEO/tests/ConnectionTests.py
View file @
b05992e1
...
...
@@ -1166,7 +1166,7 @@ class MSTThread(threading.Thread):
# Begin a transaction
t
=
Transaction
()
for
c
in
clients
:
#print
"%s.%s.%s begin\n" % (tname, c.__name, i),
#print
("%s.%s.%s begin" % (tname, c.__name, i))
c
.
tpc_begin
(
t
)
for
j
in
range
(
testcase
.
nobj
):
...
...
@@ -1175,20 +1175,20 @@ class MSTThread(threading.Thread):
oid
=
c
.
new_oid
()
c
.
__oids
.
append
(
oid
)
data
=
MinPO
(
"%s.%s.t%d.o%d"
%
(
tname
,
c
.
__name
,
i
,
j
))
#print
data.value
#print
(data.value)
data
=
zodb_pickle
(
data
)
s
=
c
.
store
(
oid
,
ZERO
,
data
,
''
,
t
)
c
.
__serials
.
update
(
handle_all_serials
(
oid
,
s
))
# Vote on all servers and handle serials
for
c
in
clients
:
#print
"%s.%s.%s vote\n" % (tname, c.__name, i),
#print
("%s.%s.%s vote" % (tname, c.__name, i))
s
=
c
.
tpc_vote
(
t
)
c
.
__serials
.
update
(
handle_all_serials
(
None
,
s
))
# Finish on all servers
for
c
in
clients
:
#print
"%s.%s.%s finish\n" % (tname, c.__name, i),
#print
("%s.%s.%s finish\n" % (tname, c.__name, i))
c
.
tpc_finish
(
t
)
for
c
in
clients
:
...
...
src/ZEO/tests/InvalidationTests.py
View file @
b05992e1
...
...
@@ -194,7 +194,7 @@ class LargeUpdatesThread(FailableThread):
tree
=
cn
.
root
()[
"tree"
]
break
except
(
ConflictError
,
KeyError
):
# print
"%d getting tree abort" % self.threadnum
# print
("%d getting tree abort" % self.threadnum)
transaction
.
abort
()
keys_added
=
{}
# set of keys we commit
...
...
@@ -215,11 +215,11 @@ class LargeUpdatesThread(FailableThread):
try
:
tree
[
key
]
=
self
.
threadnum
except
(
ReadConflictError
,
ConflictError
)
as
msg
:
# print
"%d setting key %s" % (self.threadnum, msg
)
# print
("%d setting key %s" % (self.threadnum, msg)
)
transaction
.
abort
()
break
else
:
# print
"%d set #%d" % (self.threadnum, len(keys
))
# print
("%d set #%d" % (self.threadnum, len(keys)
))
transaction
.
get
().
note
(
"keys %s"
%
", "
.
join
(
map
(
str
,
keys
)))
try
:
transaction
.
commit
()
...
...
@@ -227,7 +227,7 @@ class LargeUpdatesThread(FailableThread):
if
self
.
sleep
:
time
.
sleep
(
self
.
sleep
)
except
ConflictError
as
msg
:
# print
"%d commit %s" % (self.threadnum, msg
)
# print
("%d commit %s" % (self.threadnum, msg)
)
transaction
.
abort
()
continue
for
k
in
keys
:
...
...
src/ZEO/tests/client-config.test
View file @
b05992e1
...
...
@@ -85,7 +85,7 @@ The simplest client configuration specified a server address:
>>>
storage
.
_blob_cache_size
1048576000
>>>
print
storage
.
_blob_cache_size_check
>>>
print
(
storage
.
_blob_cache_size_check
)
104857600
>>>
storage
.
close
()
src/ZEO/tests/drop_cache_rather_than_verify.txt
View file @
b05992e1
...
...
@@ -82,7 +82,7 @@ Now, let's verify our assertions above:
- Publishes a stale-cache event.
>>> for e in events:
... print
e
... print
(e)
(3, '', 'StaleCache')
Note that the length of the cache when the event handler was
...
...
@@ -105,7 +105,7 @@ Now, let's verify our assertions above:
- Logs a CRITICAL message.
>>> print
handler
>>> print
(handler)
ZEO.ClientStorage CRITICAL
test dropping stale cache
...
...
@@ -149,14 +149,14 @@ in the database, which is why we get 1, rather than 0 objects in the cache.)
- Publishes a stake-cache event.
>>> for e in events:
... print
e
... print
(e)
(2, '', 'StaleCache')
>>> del events[:]
- Logs a CRITICAL message.
>>> print
handler
>>> print
(handler)
ZEO.ClientStorage CRITICAL
test dropping stale cache
...
...
@@ -199,10 +199,10 @@ drop_cache_rather_verify option:
>>> wait_connected(db.storage)
>>> for e in events:
... print
e
... print
(e)
(4, '', 'StaleCache')
>>> print
handler
>>> print
(handler)
<BLANKLINE>
>>> len(db.storage._cache)
...
...
src/ZEO/tests/registerDB.test
View file @
b05992e1
...
...
@@ -52,15 +52,15 @@ stub that implements the client invalidation calls:
...
def
__init__
(
self
,
name
)
:
...
self
.
name
=
name
...
def
invalidateTransaction
(
self
,
tid
,
invalidated
)
:
...
print
'invalidateTransaction'
,
tid
,
self
.
name
...
print
invalidated
...
print
(
'invalidateTransaction'
,
tid
,
self
.
name
)
...
print
(
invalidated
)
>>>
class
Connection
:
...
def
__init__
(
self
,
mgr
,
obj
)
:
...
self
.
mgr
=
mgr
...
self
.
obj
=
obj
...
def
should_close
(
self
)
:
...
print
'closed'
,
self
.
obj
.
name
...
print
(
'closed'
,
self
.
obj
.
name
)
...
self
.
mgr
.
close_conn
(
self
)
...
def
poll
(
self
)
:
...
pass
...
...
@@ -101,7 +101,7 @@ Now, if we call invalidate, we'll see it propigate to the client:
The
storage
servers
queue
will
reflect
the
invalidations
:
>>>
for
tid
,
invalidated
in
server
.
invq
[
't'
]
:
...
print
repr
(
tid
),
invalidated
...
print
(
repr
(
tid
),
invalidated
)
'trans3'
[
'ob1'
,
'ob2'
]
'trans2'
[
'ob1'
,
'ob2'
]
'trans1'
[
'ob0'
,
'ob1'
]
...
...
@@ -119,6 +119,6 @@ The connections will then reopen and revalidate their caches.
The servers'
s
invalidation
queue
will
get
reset
>>>
for
tid
,
invalidated
in
server
.
invq
[
't'
]
:
...
print
repr
(
tid
),
invalidated
...
print
(
repr
(
tid
),
invalidated
)
'trans1'
[
'ob0'
,
'ob1'
]
'trans0'
[
'ob0'
]
src/ZEO/tests/testConnection.py
View file @
b05992e1
...
...
@@ -17,7 +17,7 @@ The actual tests are in ConnectionTests.py; this file provides the
platform-dependent scaffolding.
"""
from
__future__
import
with_statement
from
__future__
import
with_statement
,
print_function
from
ZEO.tests
import
ConnectionTests
,
InvalidationTests
from
zope.testing
import
setupstack
...
...
@@ -222,16 +222,16 @@ This tests tries to provoke this bug by:
... conn = db.open()
... for i in range(1000):
... if conn.root()[i].value != conn2.root()[i].value:
... print
'bad', c, i, conn.root()[i].value,
... print
conn2.root()[i].value
... print
('bad', c, i, conn.root()[i].value, end=" ")
... print
(conn2.root()[i].value)
... bad = True
... print
'client debug log with lock held'
... print
('client debug log with lock held')
... while handler.records:
... record = handler.records.pop(0)
... print
record.name, record.levelname,
... print
handler.format(record
)
... print
(record.name, record.levelname, end=' ')
... print
(handler.format(record)
)
... if bad:
... print
open('server-%s.log' % addr[1]).read(
)
... print
(open('server-%s.log' % addr[1]).read()
)
... #else:
... # logging.getLogger('ZEO').debug('GOOD %s' % c)
... db.close()
...
...
@@ -245,8 +245,8 @@ This tests tries to provoke this bug by:
>>> for record in handler.records:
... if record.levelno < logging.ERROR:
... continue
... print
record.name, record.levelname
... print
handler.format(record
)
... print
(record.name, record.levelname)
... print
(handler.format(record)
)
>>> handler.uninstall()
...
...
src/ZEO/tests/testConversionSupport.py
View file @
b05992e1
...
...
@@ -64,7 +64,7 @@ underlying storage.
>>> next = None
>>> while 1:
... oid, serial, data, next = zeo.record_iternext(next)
... print
oid
... print
(oid)
... if next is None:
... break
1
...
...
@@ -114,7 +114,7 @@ Now we'll have our way with it's private _server attr:
>>> next = None
>>> while 1:
... oid, serial, data, next = client.record_iternext(next)
... print
oid
... print
(oid)
... if next is None:
... break
1
...
...
@@ -143,7 +143,7 @@ stuff. I'd rather do a lame test than a really lame test, so here goes.
>>> next = None
>>> while 1:
... oid, serial, data, next = stub.record_iternext(next)
... print
oid
... print
(oid)
... if next is None:
... break
1
...
...
src/ZEO/tests/zdoptions.test
View file @
b05992e1
...
...
@@ -9,23 +9,27 @@ Storage Names
It
is
an
error
not
to
specify
any
storages
:
>>>
import
StringIO
,
sys
,
ZEO
.
runzeo
>>>
import
sys
,
ZEO
.
runzeo
>>>
try
:
...
from
StringIO
import
StringIO
...
except
ImportError
:
...
from
io
import
StringIO
>>>
stderr
=
sys
.
stderr
>>>
open
(
'config'
,
'w'
)
.
write
(
"""
>>>
r
=
open
(
'config'
,
'w'
)
.
write
(
"""
... <zeo>
... address 8100
... </zeo>
... """
)
>>>
sys
.
stderr
=
StringIO
.
StringIO
()
>>>
sys
.
stderr
=
StringIO
()
>>>
options
=
ZEO
.
runzeo
.
ZEOOptions
()
>>>
options
.
realize
(
'-C config'
.
split
())
Traceback
(
most
recent
call
last
)
:
...
SystemExit
:
2
>>>
print
sys
.
stderr
.
getvalue
(
)
# doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>>
print
(
sys
.
stderr
.
getvalue
()
)
# doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Error
:
not
enough
values
for
section
type
'zodb.storage'
;
0
found
,
1
required
...
...
...
@@ -33,7 +37,7 @@ It is an error not to specify any storages:
But
we
can
specify
a
storage
without
a
name
:
>>>
open
(
'config'
,
'w'
)
.
write
(
"""
>>>
r
=
open
(
'config'
,
'w'
)
.
write
(
"""
... <zeo>
... address 8100
... </zeo>
...
...
@@ -47,8 +51,8 @@ But we can specify a storage without a name:
We
can
't have multiple unnamed storages:
>>> sys.stderr = StringIO
.StringIO
()
>>> open('
config
', '
w
').write("""
>>> sys.stderr = StringIO()
>>>
r =
open('
config
', '
w
').write("""
... <zeo>
... address 8100
... </zeo>
...
...
@@ -63,14 +67,14 @@ We can't have multiple unnamed storages:
...
SystemExit: 2
>>> print
sys.stderr.getvalue(
) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> print
(sys.stderr.getvalue()
) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Error: No more than one storage may be unnamed.
...
Or an unnamed storage and one named '
1
':
>>> sys.stderr = StringIO
.StringIO
()
>>> open('
config
', '
w
').write("""
>>> sys.stderr = StringIO()
>>>
r =
open('
config
', '
w
').write("""
... <zeo>
... address 8100
... </zeo>
...
...
@@ -85,13 +89,13 @@ Or an unnamed storage and one named '1':
...
SystemExit: 2
>>> print
sys.stderr.getvalue(
) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> print
(sys.stderr.getvalue()
) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Error: Can'
t
have
an
unnamed
storage
and
a
storage
named
1.
...
But
we
can
have
multiple
storages
:
>>>
open
(
'config'
,
'w'
)
.
write
(
"""
>>>
r
=
open
(
'config'
,
'w'
)
.
write
(
"""
... <zeo>
... address 8100
... </zeo>
...
...
@@ -107,8 +111,8 @@ But we can have multiple storages:
As
long
as
the
names
are
unique
:
>>>
sys
.
stderr
=
StringIO
.
StringIO
()
>>>
open
(
'config'
,
'w'
)
.
write
(
"""
>>>
sys
.
stderr
=
StringIO
()
>>>
r
=
open
(
'config'
,
'w'
)
.
write
(
"""
... <zeo>
... address 8100
... </zeo>
...
...
@@ -123,7 +127,7 @@ As long as the names are unique:
...
SystemExit
:
2
>>>
print
sys
.
stderr
.
getvalue
(
)
# doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>>
print
(
sys
.
stderr
.
getvalue
()
)
# doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Error
:
section
names
must
not
be
re
-
used
within
the
same
container
:
'1'
...
...
...
src/ZEO/tests/zeo-fan-out.test
View file @
b05992e1
...
...
@@ -47,7 +47,7 @@ If we update c1, we'll eventually see the change in c2:
>>> r1[1].v = 1000
>>> r1[2] = persistent.mapping.PersistentMapping()
>>> r1[2].v = -1000
>>> r1[3] = ZODB.blob.Blob('x'*4111222)
>>> r1[3] = ZODB.blob.Blob(
b
'x'*4111222)
>>> for i in range(1000, 2000):
... r1[i] = persistent.mapping.PersistentMapping()
... r1[i].v = 0
...
...
@@ -97,14 +97,14 @@ Now, let's see if we can break it. :)
>>> while time.time() - start_time < 999:
... t = tm2.begin()
... if r2[1].v + r2[2].v:
... print
'oops', r2[1], r2[2]
... print
('oops', r2[1], r2[2])
... if r2[1].v == 800:
... break # we caught up
... path = s2.fshelper.getBlobFilename(*blob_id)
... if os.path.exists(path):
... ZODB.blob.remove_committed(path)
... s2._server.sendBlob(*blob_id)
... else: print
'Dang'
... else: print
('Dang')
>>> threadf.join()
...
...
@@ -129,11 +129,11 @@ invalidated:
... and
... (r2[2]._p_changed is None)
... ):
... print
'Cool'
... print
('Cool')
... break
... time.sleep(0.01)
... else:
... print
'Dang'
... print
('Dang')
Cool
Cleanup:
...
...
src/ZEO/tests/zeo_blob_cache.test
View file @
b05992e1
...
...
@@ -87,19 +87,19 @@ target:
>>> for i in range(1, 101):
... data = conn.root()[i].open().read()
... if data != chr(i)*100:
... print
'
bad
data
', `chr(i)`, `data`
... print
('
bad
data
', repr(chr(i)), repr(data))
>>> wait_until("size is reduced", check, 99, onfail)
>>> for i in range(1, 101):
... data = conn.root()[i].open().read()
... if data != chr(i)*100:
... print
'
bad
data
', `chr(i)`, `data`
... print
('
bad
data
', repr(chr(i)), repr(data))
>>> for i in range(1, 101):
... data = conn.root()[i].open('
c
').read()
... if data != chr(i)*100:
... print
'
bad
data
', `chr(i)`, `data`
... print
('
bad
data
', repr(chr(i)), repr(data))
>>> wait_until("size is reduced", check, 99, onfail)
...
...
@@ -116,11 +116,11 @@ provoke problems:
...
i
=
random
.
randint
(
1
,
100
)
...
data
=
conn
.
root
()[
i
]
.
open
()
.
read
()
...
if
data
!=
chr
(
i
)
*
100
:
...
print
'bad data'
,
`chr(i)`
,
`data`
...
print
(
'bad data'
,
repr
(
chr
(
i
)),
repr
(
data
))
...
i
=
random
.
randint
(
1
,
100
)
...
data
=
conn
.
root
()[
i
]
.
open
(
'c'
)
.
read
()
...
if
data
!=
chr
(
i
)
*
100
:
...
print
'bad data'
,
`chr(i)`
,
`data`
...
print
(
'bad data'
,
repr
(
chr
(
i
)),
repr
(
data
))
...
db
.
close
()
>>>
threads
=
[
threading
.
Thread
(
target
=
run
)
for
i
in
range
(
10
)]
...
...
@@ -131,7 +131,7 @@ provoke problems:
>>>
for
thread
in
threads
:
...
thread
.
join
(
99
)
...
if
thread
.
isAlive
()
:
...
print
"Can't join thread."
...
print
(
"Can't join thread."
)
>>>
wait_until
(
"size is reduced"
,
check
,
99
,
onfail
)
...
...
src/ZEO/zrpc/connection.py
View file @
b05992e1
...
...
@@ -831,4 +831,4 @@ class ManagedClientConnection(Connection):
def
send_reply
(
self
,
msgid
,
ret
):
# Whimper. Used to send heartbeat
assert
msgid
==
-
1
and
ret
is
None
self
.
message_output
(
'(J
\
xff
\
xff
\
xff
\
xff
K
\
x00
U
\
x06
.replyNt.'
)
self
.
message_output
(
b
'(J
\
xff
\
xff
\
xff
\
xff
K
\
x00
U
\
x06
.replyNt.'
)
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