Commit 83fe64bf by Julien Muchembled

storage: fix pruning of data when deleting partial transactions during verification

1 parent daa83cb4
......@@ -562,14 +562,13 @@ class MySQLDatabaseManager(DatabaseManager):
getPartition = self._getPartition
q = self.query
sql = " FROM tobj WHERE tid=%d" % tid
data_id_list = [x for x, in q("SELECT data_id" + sql) if x]
self.releaseData(data_id_list)
data_id_set = {x for x, in q("SELECT data_id" + sql) if x}
self.releaseData(data_id_set)
q("DELETE" + sql)
q("""DELETE FROM ttrans WHERE tid = %d""" % tid)
q("""DELETE FROM trans WHERE `partition` = %d AND tid = %d""" %
(getPartition(tid), tid))
# delete from obj using indexes
data_id_set = set()
for oid in oid_list:
oid = u64(oid)
sql = " FROM obj WHERE `partition`=%d AND oid=%d AND tid=%d" \
......
......@@ -424,14 +424,13 @@ class SQLiteDatabaseManager(DatabaseManager):
getPartition = self._getPartition
q = self.query
sql = " FROM tobj WHERE tid=?"
data_id_list = [x for x, in q("SELECT data_id" + sql, (tid,)) if x]
self.releaseData(data_id_list)
data_id_set = {x for x, in q("SELECT data_id" + sql, (tid,)) if x}
self.releaseData(data_id_set)
q("DELETE" + sql, (tid,))
q("DELETE FROM ttrans WHERE tid=?", (tid,))
q("DELETE FROM trans WHERE partition=? AND tid=?",
(getPartition(tid), tid))
# delete from obj using indexes
data_id_set = set()
for oid in oid_list:
oid = u64(oid)
sql = " FROM obj WHERE partition=? AND oid=? AND tid=?"
......
......@@ -438,6 +438,14 @@ class Test(NEOThreadedTest):
finally:
cluster.stop()
cluster.reset()
di0 = s0.getDataLockInfo()
k, = (k for k, v in di0.iteritems() if v == 1)
di0[k] = 0 # r[2] = 'ok'
self.assertEqual(di0.values(), [0, 0, 0, 0, 0])
di1 = s1.getDataLockInfo()
k, = (k for k, v in di1.iteritems() if v == 1)
del di1[k] # x.value = 1
self.assertEqual(di1.values(), [0])
try:
cluster.start()
t, c = cluster.getTransaction()
......@@ -445,6 +453,8 @@ class Test(NEOThreadedTest):
self.assertEqual(r[0].value, 0)
self.assertEqual(r[1].value, 0)
self.assertEqual(r[2], 'ok')
self.assertEqual(di0, s0.getDataLockInfo())
self.assertEqual(di1, s1.getDataLockInfo())
finally:
cluster.stop()
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!