[Zodb-checkins] CVS: ZODB3/ZEO - StorageServer.py:1.74.2.10.8.1
ServerStub.py:1.9.32.1 ClientStorage.py:1.73.2.27.2.1
Jeremy Hylton
jeremy at zope.com
Wed Aug 20 14:41:14 EDT 2003
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv25983/ZEO
Modified Files:
Tag: ZODB3-vote-backoff-branch
StorageServer.py ServerStub.py ClientStorage.py
Log Message:
Experimental version of non-blocking vote for ZEO.
Returns a special "VOTE_BACKOFF" response indicating that the client
should try again. Still need to handle cases where server does not
support vote_nb().
=== ZODB3/ZEO/StorageServer.py 1.74.2.10 => 1.74.2.10.8.1 ===
--- ZODB3/ZEO/StorageServer.py:1.74.2.10 Tue Apr 29 17:39:56 2003
+++ ZODB3/ZEO/StorageServer.py Wed Aug 20 13:41:13 2003
@@ -496,6 +496,13 @@
self.check_tid(id, exc=StorageTransactionError)
return self.strategy.tpc_vote()
+ def vote_nb(self, id):
+ self.check_tid(id, exc=StorageTransactionError)
+ if isinstance(self.strategy, DelayedCommitStrategy):
+ return self.strategy.tpc_vote_nb()
+ else:
+ return self.strategy.tpc_vote()
+
def abortVersion(self, src, id):
self.check_tid(id, exc=StorageTransactionError)
return self.strategy.abortVersion(src)
@@ -732,6 +739,12 @@
self.args = ()
return self.block()
+ def tpc_vote_nb(self):
+ if self.storage._transaction:
+ return "VOTE_BACKOFF"
+ else:
+ return self.tpc_vote()
+
def commitVersion(self, src, dest):
self.name = "commitVersion"
self.args = src, dest
@@ -751,6 +764,7 @@
# called by the storage when the storage is available
assert isinstance(new_strategy, ImmediateCommitStrategy)
new_strategy.tpc_begin(self.txn, self.tid, self.status)
+ print "restarting blocked txn", self.log.stores
loads, loader = self.log.get_loader()
for i in range(loads):
oid, serial, data, version = loader.load()
=== ZODB3/ZEO/ServerStub.py 1.9 => 1.9.32.1 ===
--- ZODB3/ZEO/ServerStub.py:1.9 Tue Oct 1 14:49:12 2002
+++ ZODB3/ZEO/ServerStub.py Wed Aug 20 13:41:13 2003
@@ -81,6 +81,9 @@
def vote(self, trans_id):
return self.rpc.call('vote', trans_id)
+ def vote_nb(self, trans_id):
+ return self.rpc.call('vote_nb', trans_id)
+
def tpc_finish(self, id):
return self.rpc.call('tpc_finish', id)
=== ZODB3/ZEO/ClientStorage.py 1.73.2.27 => 1.73.2.27.2.1 ===
--- ZODB3/ZEO/ClientStorage.py:1.73.2.27 Mon Aug 4 18:13:58 2003
+++ ZODB3/ZEO/ClientStorage.py Wed Aug 20 13:41:13 2003
@@ -727,7 +727,19 @@
"""Storage API: vote on a transaction."""
if transaction is not self._transaction:
return
- self._server.vote(self._serial)
+ backoff = 0.24
+ attempts = 0
+ while 1:
+ if self._server.vote_nb(self._serial) == "VOTE_BACKOFF":
+ time.sleep(backoff)
+ attempts += 1
+ backoff *= 2
+ backoff = min(backoff, 60)
+ if attempts > 70:
+ raise StorageSystemError("Timed out waiting to vote")
+ continue
+ else:
+ break
return self._check_serials()
def tpc_begin(self, transaction, tid=None, status=' '):
More information about the Zodb-checkins
mailing list