Author: justi9
Date: 2008-12-10 17:10:54 -0500 (Wed, 10 Dec 2008)
New Revision: 2968
Modified:
mgmt/trunk/mint/python/mint/sql.py
Log:
A potential solution for deadlocks from deletes
Modified: mgmt/trunk/mint/python/mint/sql.py
===================================================================
--- mgmt/trunk/mint/python/mint/sql.py 2008-12-10 20:49:13 UTC (rev 2967)
+++ mgmt/trunk/mint/python/mint/sql.py 2008-12-10 22:10:54 UTC (rev 2968)
@@ -151,16 +151,22 @@
if table.endswith("_stats"):
parent_table = table[0:table.find("_stats")]
sql = """
+ select * from %s
+ where qmf_update_time < now() - interval '%%(threshold)s seconds'
+ for update;
delete from %s
where qmf_update_time < now() - interval '%%(threshold)s seconds'
- """ % (table)
+ """ % (table, table)
if self.keepCurrStats:
sql += " and id not in (select stats_curr_id from %s)" %
(parent_table)
else:
sql = """
+ select * from %s
+ where qmf_update_time < now() - interval '%%(threshold)s seconds'
+ for update;
delete from %s
where qmf_create_time < now() - interval '%%(threshold)s seconds'
- """ % (table)
+ """ % (table, table)
return sql
class SqlGetBrokerRegistration(SqlOperation):
Show replies by date