Skip to content

Commit

Permalink
Merge from master.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed May 14, 2013
2 parents 4895e57 + b92d880 commit 4e3a243
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
4 changes: 1 addition & 3 deletions .gitignore
@@ -1,8 +1,6 @@
*.pyc
__pycache__
src/*.egg-info
benchmark/*.egg-info

*.egg-info
.installed.cfg
.tox
bin
Expand Down
11 changes: 11 additions & 0 deletions .travis.yml
@@ -0,0 +1,11 @@
language: python
python:
- 2.6
- 2.7
install:
- python bootstrap.py
- bin/buildout
script:
- bin/test -v1
notifications:
email: false
38 changes: 21 additions & 17 deletions src/ZEO/ClientStorage.py
Expand Up @@ -1024,7 +1024,8 @@ def loadBlob(self, oid, serial):
else:
# We're using a server shared cache. If the file isn't
# here, it's not anywhere.
raise POSException.POSKeyError("No blob file", oid, serial)
raise POSException.POSKeyError(
"No blob file at %s" % blob_filename, oid, serial)

if os.path.exists(blob_filename):
return _accessed(blob_filename)
Expand Down Expand Up @@ -1112,19 +1113,20 @@ def tpc_begin(self, txn, tid=None, status=' '):
if self._is_read_only:
raise POSException.ReadOnlyError()
self._tpc_cond.acquire()
self._midtxn_disconnect = 0
while self._transaction is not None:
# It is allowable for a client to call two tpc_begins in a
# row with the same transaction, and the second of these
# must be ignored.
if self._transaction == txn:
self._tpc_cond.release()
raise POSException.StorageTransactionError(
"Duplicate tpc_begin calls for same transaction")

self._tpc_cond.wait(30)
self._transaction = txn
self._tpc_cond.release()
try:
self._midtxn_disconnect = 0
while self._transaction is not None:
# It is allowable for a client to call two tpc_begins in a
# row with the same transaction, and the second of these
# must be ignored.
if self._transaction == txn:
raise POSException.StorageTransactionError(
"Duplicate tpc_begin calls for same transaction")

self._tpc_cond.wait(30)
self._transaction = txn
finally:
self._tpc_cond.release()

try:
self._server.tpc_begin(id(txn), txn.user, txn.description,
Expand All @@ -1144,9 +1146,11 @@ def end_transaction(self):
# the right way to set self._transaction to None
# calls notify() on _tpc_cond in case there are waiting threads
self._tpc_cond.acquire()
self._transaction = None
self._tpc_cond.notify()
self._tpc_cond.release()
try:
self._transaction = None
self._tpc_cond.notify()
finally:
self._tpc_cond.release()

def lastTransaction(self):
return self._cache.getLastTid()
Expand Down

0 comments on commit 4e3a243

Please sign in to comment.