Author: justi9
Date: 2008-12-11 11:20:37 -0500 (Thu, 11 Dec 2008)
New Revision: 2971
Modified:
mgmt/trunk/mint/python/mint/sql.py
Log:
Second attempt to quash postgres deadlock
Modified: mgmt/trunk/mint/python/mint/sql.py
===================================================================
--- mgmt/trunk/mint/python/mint/sql.py 2008-12-11 15:44:55 UTC (rev 2970)
+++ mgmt/trunk/mint/python/mint/sql.py 2008-12-11 16:20:37 UTC (rev 2971)
@@ -151,22 +151,17 @@
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;
+ lock table %s in share row exclusive mode;
delete from %s
where qmf_update_time < now() - interval '%%(threshold)s seconds'
- """ % (table, table)
+ """ % (parent_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