Commit 1f9a2369 authored by Jeremy Hylton's avatar Jeremy Hylton

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.
parent e8cf2a30
...@@ -314,17 +314,17 @@ class ZEOStorage: ...@@ -314,17 +314,17 @@ class ZEOStorage:
if invalidated: if invalidated:
self.server.invalidate(self, self.__storage_id, self.server.invalidate(self, self.__storage_id,
invalidated, self.get_size_info()) invalidated, self.get_size_info())
if not self._handle_waiting(): self._transaction = None
self._transaction = None self.strategy = None
self.strategy = None self._handle_waiting()
def tpc_abort(self, id): def tpc_abort(self, id):
if not self._check_tid(id): if not self._check_tid(id):
return return
self.strategy.tpc_abort() self.strategy.tpc_abort()
if not self._handle_waiting(): self._transaction = None
self._transaction = None self.strategy = None
self.strategy = None self._handle_waiting()
# XXX handle new serialnos # XXX handle new serialnos
...@@ -363,7 +363,7 @@ class ZEOStorage: ...@@ -363,7 +363,7 @@ class ZEOStorage:
d = Delay() d = Delay()
self.__storage._waiting.append((d, self)) self.__storage._waiting.append((d, self))
self._log("Transaction blocked waiting for storage. " self._log("Transaction blocked waiting for storage. "
"%d clients waiting." % len(self.__storage._waiting)) "Clients waiting: %d." % len(self.__storage._waiting))
return d return d
else: else:
self.restart() self.restart()
...@@ -372,13 +372,13 @@ class ZEOStorage: ...@@ -372,13 +372,13 @@ class ZEOStorage:
while self.__storage._waiting: while self.__storage._waiting:
delay, zeo_storage = self.__storage._waiting.pop(0) delay, zeo_storage = self.__storage._waiting.pop(0)
if self._restart(zeo_storage, delay): if self._restart(zeo_storage, delay):
break if self.__storage._waiting:
if self.__storage._waiting: n = len(self.__storage._waiting)
n = len(self.__storage._waiting) self._log("Blocked transaction restarted. "
self._log("Blocked transaction restarted. " "Clients waiting: %d" % n)
"%d clients waiting." % n) else:
else: self._log("Blocked transaction restarted.")
self._log("Blocked transaction restarted.") return
def _restart(self, zeo_storage, delay): def _restart(self, zeo_storage, delay):
# Return True if the server restarted. # Return True if the server restarted.
......
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