Commit 645920e8 authored by Julien Muchembled's avatar Julien Muchembled

storage: move the commit at tpc_vote from the backends to the unique caller

parent eaa07e25
......@@ -396,13 +396,18 @@ class DatabaseManager(object):
@abstract
def storeTransaction(self, tid, object_list, transaction, temporary = True):
"""Store a transaction temporarily, if temporary is true. Note
that this transaction is not finished yet. The list of objects
contains tuples, each of which consists of an object ID,
a data_id and object serial.
"""Write transaction metadata
The list of objects contains tuples, each of which consists of
an object ID, a data_id and object serial.
The transaction is either None or a tuple of the list of OIDs,
user information, a description, extension information and transaction
pack state (True for packed)."""
pack state (True for packed).
If 'temporary', the transaction is stored into ttrans/tobj tables,
(instead of trans/obj). The caller is in charge of committing, which
is always the case at tpc_vote.
"""
@abstract
def _pruneData(self, data_id_list):
......
......@@ -465,8 +465,6 @@ class MySQLDatabaseManager(DatabaseManager):
q("REPLACE INTO %s VALUES (%s,%s,%s,'%s','%s','%s','%s',%s)" % (
trans_table, partition, 'NULL' if temporary else tid, packed,
e(''.join(oid_list)), e(user), e(desc), e(ext), u64(ttid)))
if temporary:
self.commit()
_structLL = struct.Struct(">LL")
_unpackLL = _structLL.unpack
......
......@@ -376,8 +376,6 @@ class SQLiteDatabaseManager(DatabaseManager):
(partition, None if temporary else tid,
packed, buffer(''.join(oid_list)),
buffer(user), buffer(desc), buffer(ext), u64(ttid)))
if temporary:
self.commit()
def _pruneData(self, data_id_list):
data_id_list = set(data_id_list).difference(self._uncommitted_data)
......
......@@ -174,7 +174,9 @@ class TransactionManager(object):
txn_info = oid_list, user, desc, ext, False, ttid
transaction.has_trans = True
# store metadata to temporary table
self._app.dm.storeTransaction(ttid, object_list, txn_info)
dm = self._app.dm
dm.storeTransaction(ttid, object_list, txn_info)
dm.commit()
def lock(self, ttid, tid):
"""
......
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