Commit 972ac119 authored by Jim Fulton's avatar Jim Fulton

Bug fixed:

- ZEO extension methods failed when a client reconnected to a
  storage. (https://bugs.launchpad.net/zodb/+bug/143344)
parent 442cc4d1
...@@ -15,6 +15,8 @@ Bugs fixed ...@@ -15,6 +15,8 @@ Bugs fixed
The objects' _p_oid and _p_jar variables weren't cleared, leading to The objects' _p_oid and _p_jar variables weren't cleared, leading to
surprizing errors. surprizing errors.
- ZEO extension methods failed when a client reconnected to a
storage. (https://bugs.launchpad.net/zodb/+bug/143344)
3.10.0b6 (2010-09-08) 3.10.0b6 (2010-09-08)
===================== =====================
......
...@@ -664,7 +664,10 @@ class ClientStorage(object): ...@@ -664,7 +664,10 @@ class ClientStorage(object):
def _handle_extensions(self): def _handle_extensions(self):
for name in self.getExtensionMethods().keys(): for name in self.getExtensionMethods().keys():
if not hasattr(self, name): 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): def set_server_addr(self, addr):
# Normalize server address and convert to string # Normalize server address and convert to string
......
...@@ -1568,6 +1568,31 @@ def sync_connect_doesnt_hang(): ...@@ -1568,6 +1568,31 @@ def sync_connect_doesnt_hang():
>>> ZEO.zrpc.client.ConnectThread = ConnectThread >>> ZEO.zrpc.client.ConnectThread = ConnectThread
""" """
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)
>>> wait_until('not connected',
... lambda : not conn.db().storage.is_connected())
>>> _ = start_server(addr=addr)
>>> 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 = [ slow_test_classes = [
BlobAdaptedFileStorageTests, BlobWritableCacheTests, BlobAdaptedFileStorageTests, BlobWritableCacheTests,
MappingStorageTests, DemoStorageTests, MappingStorageTests, DemoStorageTests,
......
...@@ -1275,7 +1275,15 @@ class FileStorage( ...@@ -1275,7 +1275,15 @@ class FileStorage(
return oid, tid, data, next_oid 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): def shift_transactions_forward(index, tindex, file, pos, opos):
"""Copy transactions forward in the data file """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