[Zodb-checkins] CVS: StandaloneZODB/ZEO - StorageServer.py:1.43
Jeremy Hylton
jeremy@zope.com
Mon, 12 Aug 2002 14:27:15 -0400
Update of /cvs-repository/StandaloneZODB/ZEO
In directory cvs.zope.org:/tmp/cvs-serv4696
Modified Files:
StorageServer.py
Log Message:
Fix two apparent bugs in logic to handle waiting transactions.
tpc_abort() and tpc_finish() should always reset _transaction and
strategy attributes before calling _handle_waiting(). XXX Not sure
that it actually makes a difference, but the code seems simpler.
Only issues the "blocked transaction restarted" method when _restart()
returns true.
=== StandaloneZODB/ZEO/StorageServer.py 1.42 => 1.43 ===
--- StandaloneZODB/ZEO/StorageServer.py:1.42 Fri Aug 9 17:11:52 2002
+++ StandaloneZODB/ZEO/StorageServer.py Mon Aug 12 14:27:14 2002
@@ -314,17 +314,17 @@
if invalidated:
self.server.invalidate(self, self.__storage_id,
invalidated, self.get_size_info())
- if not self._handle_waiting():
- self._transaction = None
- self.strategy = None
+ self._transaction = None
+ self.strategy = None
+ self._handle_waiting()
def tpc_abort(self, id):
if not self._check_tid(id):
return
self.strategy.tpc_abort()
- if not self._handle_waiting():
- self._transaction = None
- self.strategy = None
+ self._transaction = None
+ self.strategy = None
+ self._handle_waiting()
# XXX handle new serialnos
@@ -363,7 +363,7 @@
d = Delay()
self.__storage._waiting.append((d, self))
self._log("Transaction blocked waiting for storage. "
- "%d clients waiting." % len(self.__storage._waiting))
+ "Clients waiting: %d." % len(self.__storage._waiting))
return d
else:
self.restart()
@@ -372,13 +372,13 @@
while self.__storage._waiting:
delay, zeo_storage = self.__storage._waiting.pop(0)
if self._restart(zeo_storage, delay):
- break
- if self.__storage._waiting:
- n = len(self.__storage._waiting)
- self._log("Blocked transaction restarted. "
- "%d clients waiting." % n)
- else:
- self._log("Blocked transaction restarted.")
+ if self.__storage._waiting:
+ n = len(self.__storage._waiting)
+ self._log("Blocked transaction restarted. "
+ "Clients waiting: %d" % n)
+ else:
+ self._log("Blocked transaction restarted.")
+ return
def _restart(self, zeo_storage, delay):
# Return True if the server restarted.