Commit 398e9a4c authored by Jeremy Hylton's avatar Jeremy Hylton

Make tpc_begin() a read-only method.

The effect of this change will be to cause transactions to fail
immediately, rather than the first time they call store() or
abortVersion() or some other write-method.  Since the Connection now
treats empty transactions as a special case, this change will not
change the class of transactions that fail.
parent deee7c9e
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
""" """
# Do this portably in the face of checking out with -kv # Do this portably in the face of checking out with -kv
import string import string
__version__ = string.split('$Revision: 1.22 $')[-2:][0] __version__ = string.split('$Revision: 1.23 $')[-2:][0]
import ThreadLock, bpthread import ThreadLock, bpthread
import time, UndoLogCompatible import time, UndoLogCompatible
...@@ -122,6 +122,8 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible): ...@@ -122,6 +122,8 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
pass pass
def tpc_begin(self, transaction, tid=None, status=' '): def tpc_begin(self, transaction, tid=None, status=' '):
if self._is_read_only:
raise POSException.ReadOnlyError()
self._lock_acquire() self._lock_acquire()
try: try:
if self._transaction is transaction: if self._transaction is transaction:
......
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