Commit 4438aef4 authored by Jim Fulton's avatar Jim Fulton

Go back to using the transactuon (and now transaction meta data) custom data api

parent 5c8e487a
...@@ -474,8 +474,11 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage): ...@@ -474,8 +474,11 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage):
raise POSException.ReadOnlyError() raise POSException.ReadOnlyError()
try: try:
buf = trans.__buf buf = trans.data(self)
except AttributeError: except KeyError:
buf = None
if buf is None:
raise POSException.StorageTransactionError( raise POSException.StorageTransactionError(
"Transaction not committing", meth, trans) "Transaction not committing", meth, trans)
...@@ -796,18 +799,26 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage): ...@@ -796,18 +799,26 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage):
raise POSException.ReadOnlyError() raise POSException.ReadOnlyError()
try: try:
tbuf = txn.__buf tbuf = txn.data(self)
except AttributeError: except AttributeError:
txn.__buf = tbuf = TransactionBuffer(self._connection_generation) # Gaaaa. This is a recovery transaction. Work around this
# until we can think of something better. XXX
tb = {}
txn.data = tb.__getitem__
txn.set_data = tb.__setitem__
except KeyError:
pass
else: else:
if tbuf is not None:
raise POSException.StorageTransactionError( raise POSException.StorageTransactionError(
"Duplicate tpc_begin calls for same transaction") "Duplicate tpc_begin calls for same transaction")
txn.set_data(self, TransactionBuffer(self._connection_generation))
# XXX we'd like to allow multiple transactions at a time at some point, # XXX we'd like to allow multiple transactions at a time at some point,
# but for now, due to server limitations, TCBOO. # but for now, due to server limitations, TCBOO.
self._commit_lock.acquire() self._commit_lock.acquire()
self._tbuf = tbuf self._tbuf = txn.data(self)
try: try:
self._async( self._async(
...@@ -818,13 +829,10 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage): ...@@ -818,13 +829,10 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage):
raise raise
def tpc_end(self, txn): def tpc_end(self, txn):
try: tbuf = txn.data(self)
tbuf = txn.__buf if tbuf is not None:
except AttributeError:
pass
else:
del txn.__buf
tbuf.close() tbuf.close()
txn.set_data(self, None)
self._commit_lock.release() self._commit_lock.release()
def lastTransaction(self): def lastTransaction(self):
...@@ -837,8 +845,8 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage): ...@@ -837,8 +845,8 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage):
they normally would.) they normally would.)
""" """
try: try:
tbuf = txn.__buf tbuf = txn.data(self)
except AttributeError: except KeyError:
return return
try: try:
......
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