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
96659e2c
Commit
96659e2c
authored
Aug 02, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use ZODB.utils.maxtid rather than z64
parent
64635ddb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
23 deletions
+23
-23
src/ZEO/ClientStorage.py
src/ZEO/ClientStorage.py
+1
-4
src/ZEO/asyncio/tests.py
src/ZEO/asyncio/tests.py
+19
-16
src/ZEO/tests/testZEO.py
src/ZEO/tests/testZEO.py
+3
-3
No files found.
src/ZEO/ClientStorage.py
View file @
96659e2c
...
...
@@ -51,9 +51,6 @@ import ZEO.cache
logger
=
logging
.
getLogger
(
__name__
)
# max signed 64-bit value ~ infinity :) Signed cuz LBTree and TimeStamp
m64
=
b'
\
x7f
\
xff
\
xff
\
xff
\
xff
\
xff
\
xff
\
xff
'
def
tid2time
(
tid
):
return
str
(
TimeStamp
(
tid
))
...
...
@@ -498,7 +495,7 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage):
return
self
.
_call
(
'loadSerial'
,
oid
,
serial
)
def
load
(
self
,
oid
,
version
=
''
):
result
=
self
.
loadBefore
(
oid
,
m64
)
result
=
self
.
loadBefore
(
oid
,
utils
.
maxtid
)
if
result
is
None
:
raise
POSException
.
POSKeyError
(
oid
)
return
result
[:
2
]
...
...
src/ZEO/asyncio/tests.py
View file @
96659e2c
...
...
@@ -9,6 +9,7 @@ from zope.testing import setupstack
from
concurrent.futures
import
Future
import
mock
from
ZODB.POSException
import
ReadOnlyError
from
ZODB.utils
import
maxtid
import
collections
import
logging
...
...
@@ -16,7 +17,6 @@ import struct
import
unittest
from
..Exceptions
import
ClientDisconnected
,
ProtocolError
from
..ClientStorage
import
m64
from
.testing
import
Loop
from
.client
import
ClientRunner
,
Fallback
...
...
@@ -192,17 +192,18 @@ class ClientTests(Base, setupstack.TestCase, ClientRunner):
self
.
assertEqual
(
self
.
pop
(),
(
0
,
True
,
'bar'
,
(
3
,
4
)))
# Loading objects gets special handling to leverage the cache.
loaded
=
self
.
load_before
(
b'1'
*
8
,
m
64
)
loaded
=
self
.
load_before
(
b'1'
*
8
,
m
axtid
)
# The data wasn't in the cache, so we made a server call:
self
.
assertEqual
(
self
.
pop
(),
((
b'1'
*
8
,
m64
),
False
,
'loadBefore'
,
(
b'1'
*
8
,
m64
)))
self
.
assertEqual
(
self
.
pop
(),
((
b'1'
*
8
,
maxtid
),
False
,
'loadBefore'
,
(
b'1'
*
8
,
maxtid
)))
# Note load_before uses the oid as the message id.
self
.
respond
((
b'1'
*
8
,
m
64
),
(
b'data'
,
b'a'
*
8
,
None
))
self
.
respond
((
b'1'
*
8
,
m
axtid
),
(
b'data'
,
b'a'
*
8
,
None
))
self
.
assertEqual
(
loaded
.
result
(),
(
b'data'
,
b'a'
*
8
,
None
))
# If we make another request, it will be satisfied from the cache:
loaded
=
self
.
load_before
(
b'1'
*
8
,
m
64
)
loaded
=
self
.
load_before
(
b'1'
*
8
,
m
axtid
)
self
.
assertEqual
(
loaded
.
result
(),
(
b'data'
,
b'a'
*
8
,
None
))
self
.
assertFalse
(
transport
.
data
)
...
...
@@ -210,15 +211,16 @@ class ClientTests(Base, setupstack.TestCase, ClientRunner):
self
.
send
(
'invalidateTransaction'
,
b'b'
*
8
,
[
b'1'
*
8
])
# Now, if we try to load current again, we'll make a server request.
loaded
=
self
.
load_before
(
b'1'
*
8
,
m
64
)
loaded
=
self
.
load_before
(
b'1'
*
8
,
m
axtid
)
# Note that if we make another request for the same object,
# the requests will be collapsed:
loaded2
=
self
.
load_before
(
b'1'
*
8
,
m
64
)
loaded2
=
self
.
load_before
(
b'1'
*
8
,
m
axtid
)
self
.
assertEqual
(
self
.
pop
(),
((
b'1'
*
8
,
m64
),
False
,
'loadBefore'
,
(
b'1'
*
8
,
m64
)))
self
.
respond
((
b'1'
*
8
,
m64
),
(
b'data2'
,
b'b'
*
8
,
None
))
self
.
assertEqual
(
self
.
pop
(),
((
b'1'
*
8
,
maxtid
),
False
,
'loadBefore'
,
(
b'1'
*
8
,
maxtid
)))
self
.
respond
((
b'1'
*
8
,
maxtid
),
(
b'data2'
,
b'b'
*
8
,
None
))
self
.
assertEqual
(
loaded
.
result
(),
(
b'data2'
,
b'b'
*
8
,
None
))
self
.
assertEqual
(
loaded2
.
result
(),
(
b'data2'
,
b'b'
*
8
,
None
))
...
...
@@ -267,11 +269,12 @@ class ClientTests(Base, setupstack.TestCase, ClientRunner):
# If the protocol is disconnected, it will reconnect and will
# resolve outstanding requests with exceptions:
loaded
=
self
.
load_before
(
b'1'
*
8
,
m
64
)
loaded
=
self
.
load_before
(
b'1'
*
8
,
m
axtid
)
f1
=
self
.
call
(
'foo'
,
1
,
2
)
self
.
assertFalse
(
loaded
.
done
()
or
f1
.
done
())
self
.
assertEqual
(
self
.
pop
(),
[((
b'1'
*
8
,
m64
),
False
,
'loadBefore'
,
(
b'1'
*
8
,
m64
)),
self
.
assertEqual
(
self
.
pop
(),
[((
b'1'
*
8
,
maxtid
),
False
,
'loadBefore'
,
(
b'1'
*
8
,
maxtid
)),
(
6
,
False
,
'foo'
,
(
1
,
2
))],
)
exc
=
TypeError
(
43
)
...
...
src/ZEO/tests/testZEO.py
View file @
96659e2c
...
...
@@ -16,7 +16,7 @@ from __future__ import print_function
import
multiprocessing
import
re
from
ZEO.ClientStorage
import
ClientStorage
,
m64
from
ZEO.ClientStorage
import
ClientStorage
from
ZEO.tests
import
forker
,
Cache
,
CommitLockTests
,
ThreadTests
from
ZEO.tests
import
IterationTests
from
ZEO._compat
import
PY3
...
...
@@ -26,7 +26,7 @@ from ZODB.tests import StorageTestBase, BasicStorage, \
MTStorage
,
ReadOnlyStorage
,
IteratorStorage
,
RecoveryStorage
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.StorageTestBase
import
zodb_unpickle
from
ZODB.utils
import
p64
,
u64
,
z64
from
ZODB.utils
import
maxtid
,
p64
,
u64
,
z64
from
zope.testing
import
renormalizing
import
doctest
...
...
@@ -1401,7 +1401,7 @@ Now we'll try to use the connection, mainly to wait for everything to
get processed. Before we fixed this by making tpc_finish a synchronous
call to the server. we'd get some sort of error here.
>>> _ = client._call('loadBefore', b'\0'*8, m
64
)
>>> _ = client._call('loadBefore', b'\0'*8, m
axtid
)
>>> c.close()
...
...
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