Commit 68a8fa51 authored by Jim Fulton's avatar Jim Fulton

Bugs Fixed

- ZEO extension methods failed when a client reconnected to a
  storage. (https://bugs.launchpad.net/zodb/+bug/143344)
parent 7dd8c5e4
......@@ -39,6 +39,9 @@ Bugs Fixed
The objects' _p_oid and _p_jar variables weren't cleared, leading to
surprizing errors.
- ZEO extension methods failed when a client reconnected to a
storage. (https://bugs.launchpad.net/zodb/+bug/143344)
- On Mac OS X, clients that connected and disconnected quickly could
cause a ZEO server to stop accepting connections, due to a failure
to catch errors in the initial part of the connection process.
......
......@@ -644,7 +644,10 @@ class ClientStorage(object):
def _handle_extensions(self):
for name in self.getExtensionMethods().keys():
if not hasattr(self, name):
setattr(self, name, self._server.extensionMethod(name))
def mklambda(mname):
return (lambda *args, **kw:
self._server.rpc.call(mname, *args, **kw))
setattr(self, name, mklambda(name))
def set_server_addr(self, addr):
# Normalize server address and convert to string
......
......@@ -1352,6 +1352,30 @@ def sync_connect_doesnt_hang():
"""
def lp143344_extension_methods_not_lost_on_server_restart():
r"""
Make sure we don't lose exension methods on server restart.
>>> addr, adminaddr = start_server(keep=True)
>>> conn = ZEO.connection(addr)
>>> conn.root.x = 1
>>> transaction.commit()
>>> conn.db().storage.answer_to_the_ultimate_question()
42
>>> stop_server(adminaddr)
>>> forker.wait_until('not connected',
... lambda : not conn.db().storage.is_connected())
>>> _ = start_server(addr=addr)
>>> forker.wait_until('connected', conn.db().storage.is_connected)
>>> conn.root.x
1
>>> conn.db().storage.answer_to_the_ultimate_question()
42
>>> conn.close()
"""
slow_test_classes = [
BlobAdaptedFileStorageTests, BlobWritableCacheTests,
......
......@@ -1331,7 +1331,15 @@ class FileStorage(
return oid, tid, data, next_oid
######################################################################
# The following 2 methods are for testing a ZEO extension mechanism
def getExtensionMethods(self):
return dict(answer_to_the_ultimate_question=None)
def answer_to_the_ultimate_question(self):
return 42
#
######################################################################
def shift_transactions_forward(index, tindex, file, pos, opos):
"""Copy transactions forward in the data file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment