Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/asyncio' into server-sync
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGES.rst
  • Loading branch information
Jim Fulton committed Aug 5, 2016
2 parents c2d864f + 6b85a57 commit d0d8a85
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 14 deletions.
9 changes: 6 additions & 3 deletions .travis.yml
@@ -1,5 +1,9 @@
language: python
sudo: false
cache:
pip
directories:
- eggs
matrix:
include:
- os: linux
Expand All @@ -24,9 +28,8 @@ matrix:
python: 3.5
env: ZEO4_SERVER=1
install:
- pip install -U setuptools
- python bootstrap.py
- bin/buildout
- pip install -U zc.buildout
- buildout
script:
- bin/test -v1j99
notifications:
Expand Down
12 changes: 12 additions & 0 deletions CHANGES.rst
Expand Up @@ -6,6 +6,18 @@ Changelog
the beginning of transactions to wait for any outstanding
invalidations at the start of the transaction to be delivered.

- The ZEO server register method now returns the storage last
transaction, allowing the client to avoid an extra round trip during
cache verification.

- Client disconnect errors are now transient errors. When
applications retry jobs that raise transient errors, jobs (e.g. web
requests) with disconnect errors will be retried. Together with
blocking synchronous ZEO server calls for a limited time while
disconnected, this change should allow brief disconnections due to
server restart to avoid generating client-visible errors (e.g. 500
web responses).

- Fixed bugs in using the ZEO 5 client with ZEO 4 servers.

5.0.0a2 (2016-07-30)
Expand Down
6 changes: 2 additions & 4 deletions README.rst
Expand Up @@ -180,12 +180,10 @@ Which is a short-hand for::
connection = db.open()

If you exit the Python process, the storage exits as well, as it's run
in an in-process thread. It will leave behind it's configuration and
log file. This provides a handy way to get a configuration example.
in an in-process thread.

You shut down the server more cleanly by calling the stop function
returned by the ``ZEO.server`` function. This will remove the
temporary configuration file.
returned by the ``ZEO.server`` function.

To have data stored persistently, you can specify a file-storage path
name using a ``path`` parameter. If you want blob support, you can
Expand Down
17 changes: 12 additions & 5 deletions src/ZEO/Exceptions.py
Expand Up @@ -13,19 +13,26 @@
##############################################################################
"""Exceptions for ZEO."""

import transaction.interfaces

from ZODB.POSException import StorageError

class ClientStorageError(StorageError):
"""An error occurred in the ZEO Client Storage."""
"""An error occurred in the ZEO Client Storage.
"""

class UnrecognizedResult(ClientStorageError):
"""A server call returned an unrecognized result."""
"""A server call returned an unrecognized result.
"""

class ClientDisconnected(ClientStorageError):
"""The database storage is disconnected from the storage."""
class ClientDisconnected(ClientStorageError,
transaction.interfaces.TransientError):
"""The database storage is disconnected from the storage.
"""

class AuthError(StorageError):
"""The client provided invalid authentication credentials."""
"""The client provided invalid authentication credentials.
"""

class ProtocolError(ClientStorageError):
"""A client contacted a server with an incomparible protocol
Expand Down
2 changes: 2 additions & 0 deletions src/ZEO/StorageServer.py
Expand Up @@ -222,6 +222,8 @@ def register(self, storage_id, read_only):
self.stats = self.server.register_connection(storage_id, self)
self.lock_manager = self.server.lock_managers[storage_id]

return self.lastTransaction()

def get_info(self):
storage = self.storage

Expand Down
2 changes: 1 addition & 1 deletion src/ZEO/tests/forker.py
Expand Up @@ -139,6 +139,7 @@ def runner(config, qin, qout, timeout=None,
)
thread.setDaemon(True)
thread.start()
os.remove(config)

try:
qin.get(timeout=timeout) # wait for shutdown
Expand Down Expand Up @@ -181,7 +182,6 @@ def stop_runner(thread, config, qin, qout, stop_timeout=9, pid=None):
gc.collect()

thread.join(stop_timeout)
os.remove(config)

def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False,
path='Data.fs', protocol=None, blob_dir=None,
Expand Down
11 changes: 10 additions & 1 deletion src/ZEO/tests/testZEO.py
Expand Up @@ -831,7 +831,8 @@ def getInvalidationsAfterServerRestart():
>>> sv = StorageServer(None, dict(fs=fs))
>>> s = ZEOStorage(sv, sv.read_only)
>>> s.notify_connected(FauxConn())
>>> s.register('fs', False)
>>> s.register('fs', False) == fs.lastTransaction()
True
If we ask for the last transaction, we should get the last transaction
we saved:
Expand Down Expand Up @@ -1411,6 +1412,14 @@ def gracefully_handle_abort_while_storing_many_blobs():
"""

def ClientDisconnected_errors_are_TransientErrors():
"""
>>> from ZEO.Exceptions import ClientDisconnected
>>> from transaction.interfaces import TransientError
>>> issubclass(ClientDisconnected, TransientError)
True
"""

if sys.platform.startswith('win'):
Expand Down

0 comments on commit d0d8a85

Please sign in to comment.