rhmessaging commits: r2980 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 13:52:13 -0500 (Thu, 11 Dec 2008)
New Revision: 2980
Modified:
mgmt/trunk/mint/python/mint/tools.py
Log:
Make debug conditional in the mint-bench tool
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2008-12-11 18:50:48 UTC (rev 2979)
+++ mgmt/trunk/mint/python/mint/tools.py 2008-12-11 18:52:13 UTC (rev 2980)
@@ -118,7 +118,7 @@
model = MintModel(opts.get("data", ddef),
int(opts.get("expire-frequency", freqDefault)),
int(opts.get("expire-threshold", thresholdDefault)),
- debug=True)
+ debug="debug" in opts)
model.pollRegistrations = False
model.check()
16 years
rhmessaging commits: r2979 - in mgmt/trunk/mint: sql and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-12-11 13:50:48 -0500 (Thu, 11 Dec 2008)
New Revision: 2979
Modified:
mgmt/trunk/mint/python/mint/schemaparser.py
mgmt/trunk/mint/sql/triggers.sql
Log:
try 'select ... for update' to deal with deadlocks
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-12-11 18:45:53 UTC (rev 2978)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-12-11 18:50:48 UTC (rev 2979)
@@ -236,13 +236,21 @@
CREATE OR REPLACE FUNCTION update_stats() RETURNS trigger AS '
DECLARE
parent_table varchar;
+ select_parent varchar;
update_parent varchar;
BEGIN
-- remove "_stats" suffix from table name
parent_table := substr(tg_relname, 0, char_length(tg_relname) - 5);
+
+ select_parent := ''SELECT id FROM '' || parent_table ||
+ '' WHERE id = (SELECT '' || parent_table || ''_id FROM '' || tg_relname || '' WHERE id = '' ||
+ new.id || '') FOR UPDATE'';
+
update_parent := ''UPDATE '' || parent_table ||
'' SET stats_prev_id = stats_curr_id, stats_curr_id = '' || new.id ||
- '' WHERE id = (SELECT '' || parent_table || ''_id FROM '' || tg_relname || '' WHERE id = '' || new.id || '')'';
+ '' WHERE id = (SELECT '' || parent_table || ''_id FROM '' || tg_relname || '' WHERE id = '' ||
+ new.id || '')'';
+ EXECUTE select_parent;
EXECUTE update_parent;
RETURN new;
END
Modified: mgmt/trunk/mint/sql/triggers.sql
===================================================================
--- mgmt/trunk/mint/sql/triggers.sql 2008-12-11 18:45:53 UTC (rev 2978)
+++ mgmt/trunk/mint/sql/triggers.sql 2008-12-11 18:50:48 UTC (rev 2979)
@@ -19,13 +19,21 @@
CREATE OR REPLACE FUNCTION update_stats() RETURNS trigger AS '
DECLARE
parent_table varchar;
+ select_parent varchar;
update_parent varchar;
BEGIN
-- remove "_stats" suffix from table name
parent_table := substr(tg_relname, 0, char_length(tg_relname) - 5);
+
+ select_parent := ''SELECT id FROM '' || parent_table ||
+ '' WHERE id = (SELECT '' || parent_table || ''_id FROM '' || tg_relname || '' WHERE id = '' ||
+ new.id || '') FOR UPDATE'';
+
update_parent := ''UPDATE '' || parent_table ||
'' SET stats_prev_id = stats_curr_id, stats_curr_id = '' || new.id ||
- '' WHERE id = (SELECT '' || parent_table || ''_id FROM '' || tg_relname || '' WHERE id = '' || new.id || '')'';
+ '' WHERE id = (SELECT '' || parent_table || ''_id FROM '' || tg_relname || '' WHERE id = '' ||
+ new.id || '')'';
+ EXECUTE select_parent;
EXECUTE update_parent;
RETURN new;
END
16 years
rhmessaging commits: r2978 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-12-11 13:45:53 -0500 (Thu, 11 Dec 2008)
New Revision: 2978
Modified:
mgmt/trunk/mint/python/mint/sql.py
Log:
try 'select ... for update' to deal with deadlocks
Modified: mgmt/trunk/mint/python/mint/sql.py
===================================================================
--- mgmt/trunk/mint/python/mint/sql.py 2008-12-11 18:38:09 UTC (rev 2977)
+++ mgmt/trunk/mint/python/mint/sql.py 2008-12-11 18:45:53 UTC (rev 2978)
@@ -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_create_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):
16 years
rhmessaging commits: r2977 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-12-11 13:38:09 -0500 (Thu, 11 Dec 2008)
New Revision: 2977
Modified:
mgmt/trunk/cumin/python/cumin/pool.py
Log:
Tweak wording on pool status box
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-12-11 18:26:21 UTC (rev 2976)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-12-11 18:38:09 UTC (rev 2977)
@@ -499,5 +499,5 @@
action = self.app.model.pool.poolstatus
record = action.get_stat_record(session, pool)
- return "<div><span>%i</span> of <span>%i</span> active</div>" % \
+ return "<div><span>%i</span> of <span>%i</span> slots active</div>" % \
(record["active"], record["all"])
16 years
rhmessaging commits: r2976 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 13:26:21 -0500 (Thu, 11 Dec 2008)
New Revision: 2976
Modified:
mgmt/trunk/cumin/python/cumin/system.py
mgmt/trunk/cumin/python/cumin/system.strings
Log:
Add more columns to the systems table
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-12-11 18:18:44 UTC (rev 2975)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-12-11 18:26:21 UTC (rev 2976)
@@ -21,6 +21,16 @@
self.add_column(col)
self.set_default_column(col)
+ col = self.KernelColumn(app, "kernel")
+ self.add_column(col)
+
+ col = self.ArchColumn(app, "arch")
+ self.add_column(col)
+
+ col = self.FreeMemoryColumn(app, "mem_free")
+ col.alignment = "right"
+ self.add_column(col)
+
col = self.LoadColumn(app, "load")
col.alignment = "right"
self.add_column(col)
@@ -37,12 +47,27 @@
href = self.page.main.system.get_href(session, system)
return fmt_link(href, fmt_shorten(data["name"]))
+ class KernelColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Kernel"
+
+ class ArchColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Arch"
+
+ class FreeMemoryColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Free Memory"
+
+ def render_content(self, session, data):
+ return "%i KB" % data["mem_free"]
+
class LoadColumn(SqlTableColumn):
def render_title(self, session, data):
return "Load Average"
def render_content(self, session, data):
- return "%0.3f" % data["load_average1_min"]
+ return "%0.3f" % data["load"]
class TopSystemSet(TopTable):
def __init__(self, app, name):
Modified: mgmt/trunk/cumin/python/cumin/system.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.strings 2008-12-11 18:18:44 UTC (rev 2975)
+++ mgmt/trunk/cumin/python/cumin/system.strings 2008-12-11 18:26:21 UTC (rev 2976)
@@ -1,5 +1,11 @@
[SystemSet.sql]
-select s.id, s.node_name as name, c.load_average1_min
+select
+ s.id,
+ s.node_name as name,
+ (s.os_name || ' ' || s.release) as kernel,
+ s.machine as arch,
+ c.mem_free,
+ c.load_average1_min as load
from sysimage as s
left outer join sysimage_stats as c on c.id = s.stats_curr_id
{sql_orderby}
16 years
rhmessaging commits: r2975 - in mgmt/trunk: mint/python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-12-11 13:18:44 -0500 (Thu, 11 Dec 2008)
New Revision: 2975
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/mint/python/mint/__init__.py
mgmt/trunk/mint/python/mint/dbexpire.py
mgmt/trunk/mint/python/mint/update.py
Log:
enqueue db expiration 'updates' into the update queue instead of having them in a separate thread, to avoid deadlocks
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-12-11 17:00:32 UTC (rev 2974)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-12-11 18:18:44 UTC (rev 2975)
@@ -27,6 +27,7 @@
debug=False)
self.data.updateObjects = False
+ self.data.dbExpiration = False
self.classes = list()
self.invocations = set()
Modified: mgmt/trunk/mint/python/mint/__init__.py
===================================================================
--- mgmt/trunk/mint/python/mint/__init__.py 2008-12-11 17:00:32 UTC (rev 2974)
+++ mgmt/trunk/mint/python/mint/__init__.py 2008-12-11 18:18:44 UTC (rev 2975)
@@ -325,6 +325,7 @@
self.debug = debug
self.updateObjects = True
self.pollRegistrations = True
+ self.dbExpiration = True
assert MintModel.staticInstance is None
MintModel.staticInstance = self
@@ -375,15 +376,19 @@
def start(self):
self.updateThread.start()
- self.dbExpireThread.start()
+ if self.dbExpiration:
+ self.dbExpireThread.start()
+
if self.pollRegistrations:
self.registrationThread.start()
def stop(self):
self.updateThread.stop()
- self.dbExpireThread.stop()
+ if self.dbExpiration:
+ self.dbExpireThread.stop()
+
if self.pollRegistrations:
self.registrationThread.stop()
Modified: mgmt/trunk/mint/python/mint/dbexpire.py
===================================================================
--- mgmt/trunk/mint/python/mint/dbexpire.py 2008-12-11 17:00:32 UTC (rev 2974)
+++ mgmt/trunk/mint/python/mint/dbexpire.py 2008-12-11 18:18:44 UTC (rev 2975)
@@ -16,43 +16,28 @@
self.threshold = threshold
self.keepCurrStats = keepCurrStats
- frequency_out, frequency_unit = self.convertTimeUnits(frequency)
- threshold_out, threshold_unit = self.convertTimeUnits(threshold)
+ self.ops = []
+ for cls in mint.schema.statsClasses:
+ self.ops.append(SqlExpire(eval(cls), self.keepCurrStats))
+ self.ops.append(SqlExpire(Job, self.keepCurrStats))
+
+ self.attrs = dict()
+ self.attrs["threshold"] = self.threshold
+
+ frequency_out, frequency_unit = self.__convertTimeUnits(frequency)
+ threshold_out, threshold_unit = self.__convertTimeUnits(threshold)
log.debug("Expiring database records older than %d %s, every %d %s" \
% (threshold_out, threshold_unit, frequency_out, frequency_unit))
def run(self):
- ops = []
- for cls in mint.schema.statsClasses:
- ops.append(SqlExpire(eval(cls), self.keepCurrStats))
- ops.append(SqlExpire(Job, self.keepCurrStats))
-
- attrs = dict()
- attrs["threshold"] = self.threshold
-
- conn = self.model.dbConn.getConnection()
-
while True:
- try:
- if self.stopRequested:
- break
+ if self.stopRequested:
+ break
+ up = mint.update.DBExpireUpdate(self.model)
+ self.model.updateThread.enqueue(up)
+ time.sleep(self.frequency)
- cursor = conn.cursor()
- rowcount = 0
- for op in ops:
- rowcount += op.execute(cursor, attrs)
- log.debug("%d records expired" % (rowcount))
- conn.commit()
-
- time.sleep(self.frequency)
- except:
- conn.rollback()
- log.exception("DB cleanup failed")
-
- def stop(self):
- self.stopRequested = True
-
- def convertTimeUnits(self, t):
+ def __convertTimeUnits(self, t):
if t / (24*3600) >= 1:
t_out = t / (24*3600)
t_unit = "days"
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-11 17:00:32 UTC (rev 2974)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-11 18:18:44 UTC (rev 2975)
@@ -375,3 +375,20 @@
if len(self.slots[slot]) > 0:
return self.slots[slot].popleft()
return None
+
+class DBExpireUpdate(ModelUpdate):
+ def __init__(self, model):
+ super(DBExpireUpdate, self).__init__(model, None, None)
+
+ def process(self, conn):
+ try:
+ cursor = conn.cursor()
+ rowcount = 0
+ attrs = self.model.dbExpireThread.attrs
+ for op in self.model.dbExpireThread.ops:
+ rowcount += op.execute(cursor, attrs)
+ log.debug("%d records expired" % (rowcount))
+ conn.commit()
+ except:
+ conn.rollback()
+ log.exception("DB cleanup failed")
16 years
rhmessaging commits: r2974 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 12:00:32 -0500 (Thu, 11 Dec 2008)
New Revision: 2974
Modified:
mgmt/trunk/mint/python/mint/sql.py
Log:
Revert the table locking
Modified: mgmt/trunk/mint/python/mint/sql.py
===================================================================
--- mgmt/trunk/mint/python/mint/sql.py 2008-12-11 16:59:56 UTC (rev 2973)
+++ mgmt/trunk/mint/python/mint/sql.py 2008-12-11 17:00:32 UTC (rev 2974)
@@ -151,10 +151,9 @@
if table.endswith("_stats"):
parent_table = table[0:table.find("_stats")]
sql = """
- lock table %s in share row exclusive mode;
delete from %s
where qmf_update_time < now() - interval '%%(threshold)s seconds'
- """ % (parent_table, table)
+ """ % table
if self.keepCurrStats:
sql += " and id not in (select stats_curr_id from %s)" % (parent_table)
else:
16 years
rhmessaging commits: r2973 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 11:59:56 -0500 (Thu, 11 Dec 2008)
New Revision: 2973
Modified:
mgmt/trunk/cumin/python/cumin/system.py
mgmt/trunk/cumin/python/cumin/system.strings
Log:
Add a load average column to the systems table
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-12-11 16:33:43 UTC (rev 2972)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-12-11 16:59:56 UTC (rev 2973)
@@ -20,6 +20,10 @@
col = self.NameColumn(app, "name")
self.add_column(col)
self.set_default_column(col)
+
+ col = self.LoadColumn(app, "load")
+ col.alignment = "right"
+ self.add_column(col)
def render_title(self, session, *args):
return "Systems %s" % fmt_count(self.get_item_count(session, *args))
@@ -33,6 +37,13 @@
href = self.page.main.system.get_href(session, system)
return fmt_link(href, fmt_shorten(data["name"]))
+ class LoadColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Load Average"
+
+ def render_content(self, session, data):
+ return "%0.3f" % data["load_average1_min"]
+
class TopSystemSet(TopTable):
def __init__(self, app, name):
super(TopSystemSet, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/system.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.strings 2008-12-11 16:33:43 UTC (rev 2972)
+++ mgmt/trunk/cumin/python/cumin/system.strings 2008-12-11 16:59:56 UTC (rev 2973)
@@ -1,6 +1,7 @@
[SystemSet.sql]
-select s.id, s.node_name as name
+select s.id, s.node_name as name, c.load_average1_min
from sysimage as s
+left outer join sysimage_stats as c on c.id = s.stats_curr_id
{sql_orderby}
{sql_limit}
16 years
rhmessaging commits: r2972 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-12-11 11:33:43 -0500 (Thu, 11 Dec 2008)
New Revision: 2972
Modified:
mgmt/trunk/cumin/python/cumin/limits.py
Log:
Avoid exception that happens when a negotiator doesn't have a statsCurr.
Modified: mgmt/trunk/cumin/python/cumin/limits.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.py 2008-12-11 16:20:37 UTC (rev 2971)
+++ mgmt/trunk/cumin/python/cumin/limits.py 2008-12-11 16:33:43 UTC (rev 2972)
@@ -36,12 +36,15 @@
if negotiator.qmfBrokerId:
if not most_recent:
most_recent = negotiator
- if negotiator.statsCurr.qmfUpdateTime > \
- most_recent.statsCurr.qmfUpdateTime:
- most_recent = negotiator
-
+ try:
+ if negotiator.statsCurr.qmfUpdateTime > \
+ most_recent.statsCurr.qmfUpdateTime:
+ most_recent = negotiator
+ except:
+ pass
+
return most_recent
-
+
def set_limit(self, session, limit):
negotiator = self.get_negotiator(session)
action = self.app.model.limit.setlimit
16 years
rhmessaging commits: r2971 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
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):
16 years