rhmessaging commits: r4041 - in mgmt/newdata: rosemary/python/rosemary and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-06-18 13:47:08 -0400 (Fri, 18 Jun 2010)
New Revision: 4041
Modified:
mgmt/newdata/mint/python/mint/update.py
mgmt/newdata/rosemary/python/rosemary/model.py
Log:
Add a lower-case index of classes so mint can handle the mangled class names that qmf gives us
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-06-18 17:04:33 UTC (rev 4040)
+++ mgmt/newdata/mint/python/mint/update.py 2010-06-18 17:47:08 UTC (rev 4041)
@@ -275,10 +275,9 @@
raise PackageUnknown(name)
name = class_key.getClassName()
- name = name[0].upper() + name[1:] # /me shakes fist
try:
- cls = pkg._classes_by_name[name]
+ cls = pkg._classes_by_lowercase_name[name.lower()]
except KeyError:
raise ClassUnknown(name)
Modified: mgmt/newdata/rosemary/python/rosemary/model.py
===================================================================
--- mgmt/newdata/rosemary/python/rosemary/model.py 2010-06-18 17:04:33 UTC (rev 4040)
+++ mgmt/newdata/rosemary/python/rosemary/model.py 2010-06-18 17:47:08 UTC (rev 4041)
@@ -86,6 +86,7 @@
self._classes = list()
self._classes_by_name = dict()
+ self._classes_by_lowercase_name = dict()
self.sql_schema = SqlSchema(self._model.sql_model, self._name)
@@ -120,8 +121,9 @@
self._package._classes.append(self)
self._package._classes_by_name[self._name] = self
+ self._package._classes_by_lowercase_name[self._name.lower()] = self
- assert not hasattr(self._package, self._name), self.name
+ assert not hasattr(self._package, self._name), self._name
setattr(self._package, self._name, self)
15 years, 10 months
rhmessaging commits: r4040 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-06-18 13:04:33 -0400 (Fri, 18 Jun 2010)
New Revision: 4040
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/txn_map.cpp
store/trunk/cpp/lib/jrnl/txn_map.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
Log:
Further tidy-up of txn_map error handling
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-06-18 14:56:46 UTC (rev 4039)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-06-18 17:04:33 UTC (rev 4040)
@@ -700,11 +700,10 @@
assert(xidp != 0);
std::string xid((char*)xidp, er.xid_size());
_tmap.insert_txn_data(xid, txn_data(h._rid, 0, start_fid, true));
- if (_tmap.set_aio_compl(xid, h._rid)) // xid or rid not found
+ if (_tmap.set_aio_compl(xid, h._rid) < txn_map::TMAP_OK) // fail - xid or rid not found
{
std::ostringstream oss;
- oss << std::hex << "_tmap.set_aio_compl: txn_enq xid=\"" << xid;
- oss << "\" rid=0x" << h._rid;
+ oss << std::hex << "_tmap.set_aio_compl: txn_enq xid=\"" << xid << "\" rid=0x" << h._rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "jcntl", "rcvr_get_next_record");
}
std::free(xidp);
@@ -737,11 +736,10 @@
std::string xid((char*)xidp, dr.xid_size());
_tmap.insert_txn_data(xid, txn_data(dr.rid(), dr.deq_rid(), start_fid, false,
dr.is_txn_coml_commit()));
- if (_tmap.set_aio_compl(xid, dr.rid())) // xid or rid not found
+ if (_tmap.set_aio_compl(xid, dr.rid()) < txn_map::TMAP_OK) // fail - xid or rid not found
{
std::ostringstream oss;
- oss << std::hex << "_tmap.set_aio_compl: txn_deq xid=\"" << xid;
- oss << "\" rid=0x" << dr.rid();
+ oss << std::hex << "_tmap.set_aio_compl: txn_deq xid=\"" << xid << "\" rid=0x" << dr.rid();
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "jcntl", "rcvr_get_next_record");
}
std::free(xidp);
Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp 2010-06-18 14:56:46 UTC (rev 4039)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2010-06-18 17:04:33 UTC (rev 4040)
@@ -43,6 +43,13 @@
namespace journal
{
+// return/error codes
+int16_t txn_map::TMAP_RID_NOT_FOUND = -2;
+int16_t txn_map::TMAP_XID_NOT_FOUND = -1;
+int16_t txn_map::TMAP_OK = 0;
+int16_t txn_map::TMAP_NOT_SYNCED = 0;
+int16_t txn_map::TMAP_SYNCED = 1;
+
txn_data_struct::txn_data_struct(const u_int64_t rid, const u_int64_t drid, const u_int16_t pfid,
const bool enq_flag, const bool commit_flag):
_rid(rid),
@@ -158,13 +165,13 @@
return c;
}
-int8_t
+int16_t
txn_map::is_txn_synced(const std::string& xid)
{
slock s(_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // not found in map
- return -1;
+ return TMAP_XID_NOT_FOUND;
bool is_synced = true;
for (tdl_itr litr = itr->second.begin(); litr < itr->second.end(); litr++)
{
@@ -174,26 +181,26 @@
break;
}
}
- return is_synced ? 1 : 0;
+ return is_synced ? TMAP_SYNCED : TMAP_NOT_SYNCED;
}
-int8_t
+int16_t
txn_map::set_aio_compl(const std::string& xid, const u_int64_t rid)
{
slock s(_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // xid not found in map
- return -1;
+ return TMAP_XID_NOT_FOUND;
for (tdl_itr litr = itr->second.begin(); litr < itr->second.end(); litr++)
{
if (litr->_rid == rid)
{
litr->_aio_compl = true;
- return 0; // rid found
+ return TMAP_OK; // rid found
}
}
// xid present, but rid not found
- return -2;
+ return TMAP_RID_NOT_FOUND;
}
bool
Modified: store/trunk/cpp/lib/jrnl/txn_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.hpp 2010-06-18 14:56:46 UTC (rev 4039)
+++ store/trunk/cpp/lib/jrnl/txn_map.hpp 2010-06-18 17:04:33 UTC (rev 4040)
@@ -111,6 +111,14 @@
*/
class txn_map
{
+ public:
+ // return/error codes
+ static int16_t TMAP_RID_NOT_FOUND;
+ static int16_t TMAP_XID_NOT_FOUND;
+ static int16_t TMAP_OK;
+ static int16_t TMAP_NOT_SYNCED;
+ static int16_t TMAP_SYNCED;
+
private:
typedef std::pair<std::string, txn_data_list> xmap_param;
typedef std::map<std::string, txn_data_list> xmap;
@@ -133,8 +141,8 @@
bool in_map(const std::string& xid);
u_int32_t enq_cnt();
u_int32_t deq_cnt();
- int8_t is_txn_synced(const std::string& xid); // -1=xid not found; 0=not synced; 1=synced
- int8_t set_aio_compl(const std::string& xid, const u_int64_t rid); // -2=rid not found; -1=xid not found; 0=done
+ int16_t is_txn_synced(const std::string& xid); // -1=xid not found; 0=not synced; 1=synced
+ int16_t set_aio_compl(const std::string& xid, const u_int64_t rid); // -2=rid not found; -1=xid not found; 0=done
bool data_exists(const std::string& xid, const u_int64_t rid);
bool is_enq(const u_int64_t rid);
inline void clear() { _map.clear(); }
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2010-06-18 14:56:46 UTC (rev 4039)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2010-06-18 17:04:33 UTC (rev 4040)
@@ -810,7 +810,8 @@
bool
wmgr::is_txn_synced(const std::string& xid)
{
- if (_tmap.is_txn_synced(xid) == 0) // not synced
+ // Ignore xid not found error here
+ if (_tmap.is_txn_synced(xid) == txn_map::TMAP_NOT_SYNCED)
return false;
// Check for outstanding commit/aborts
std::set<std::string>::iterator it = _txn_pending_set.find(xid);
15 years, 10 months
rhmessaging commits: r4039 - mgmt/newdata/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-06-18 10:56:46 -0400 (Fri, 18 Jun 2010)
New Revision: 4039
Modified:
mgmt/newdata/cumin/python/cumin/grid/slot.strings
Log:
Pull slot data from com.redhat.grid and not mrg.grid
Modified: mgmt/newdata/cumin/python/cumin/grid/slot.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/slot.strings 2010-06-18 14:56:12 UTC (rev 4038)
+++ mgmt/newdata/cumin/python/cumin/grid/slot.strings 2010-06-18 14:56:46 UTC (rev 4039)
@@ -12,7 +12,7 @@
"Activity",
"State",
"LoadAvg"
-from "mrg.grid"."Slot"
+from "com.redhat.grid"."Slot"
{sql_where}
{sql_order_by}
{sql_limit}
15 years, 10 months
rhmessaging commits: r4038 - in mgmt/newdata/cumin/python/cumin: grid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-06-18 10:56:12 -0400 (Fri, 18 Jun 2010)
New Revision: 4038
Modified:
mgmt/newdata/cumin/python/cumin/grid/negotiator.py
mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
mgmt/newdata/cumin/python/cumin/model.py
Log:
Changes for new negotiator qmf calls
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-06-18 14:53:41 UTC (rev 4037)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-06-18 14:56:12 UTC (rev 4038)
@@ -5,7 +5,7 @@
from wooly.widgets import *
from cumin.formats import *
-from cumin.model import FetchRawConfig, FetchRawConfigSet
+from cumin.model import FetchRawConfigSet
from cumin.objectframe import *
from cumin.objectselector import *
from cumin.parameters import *
@@ -24,8 +24,8 @@
super(NegotiatorFrame, self).__init__(app, name, cls)
- self.start = DaemonStart(app, self, "NEGOTIATOR")
- self.stop = DaemonStop(app, self, "NEGOTIATOR")
+ #self.start = DaemonStart(app, self, "NEGOTIATOR")
+ #self.stop = DaemonStop(app, self, "NEGOTIATOR")
self.group_add = NegotiatorGroupAdd(app, self)
@@ -96,7 +96,7 @@
href = "%s" % self.user_task.get_href \
(session, (self.negotiator.get(session), data[0]))
else:
- href = self.task.get_href(session, self.negotiator.get(session))
+ href = self.task.get_href(session)
content = data[2][2] and str(data[1]) or "NOT SET"
return fmt_link(href, content, "", "", self.fmt_hover(data[0]))
@@ -216,7 +216,7 @@
class DynamicColumn(QmfGroupColumn):
def render_data(self, session, data):
- href = self.task.get_href(session, self.negotiator.get(session))
+ href = self.task.get_href(session)
content = "%s%%" % str(round(float(data[1]) * 100.0, 2))
return fmt_link(href, content, "", "", self.fmt_hover(data[0]))
@@ -273,15 +273,20 @@
self.negotiator = negotiator
- self.users = self.Users()
+ self.users = self.Users(app, "users")
+ self.add_attribute(self.users)
def get_group_names(self, session):
groups = self.groups.get(session)
if len(groups) == 0:
negotiator = self.negotiator.get(session)
-
- action = NewQmfCall(self.app, {'Value': None})
- results = action.qmf_call(negotiator, "GetRawConfig", ("GROUP_NAMES",))
+ default = {'Value': None}
+ action = QmfCall(self.app, default=default, timeout=10)
+ results = action.execute(negotiator, "GetRawConfig", "GROUP_NAMES")
+ # TODO: remove this temp workaround
+ # XXX temp work around for qmf call
+ if results.error:
+ results.data = {'Value': 'msg, grid, mgmt, rt'}
groups = results.data
try:
groups = self.split_group_names(groups['Value'])
@@ -310,7 +315,7 @@
groups = self.get_group_names(session)
negotiator = self.negotiator.get(session)
action = FetchRawConfigSet(self.app)
- raw_configs = action.execute(negotiator, groups, config, timeout=15)
+ raw_configs = action.execute(negotiator, groups, config)
for group in sorted(raw_configs):
res = raw_configs[group]
@@ -349,7 +354,11 @@
self.autoregroup, [""])
def get_users(self, session, groups):
- return self.users.get(session, groups)
+ try:
+ users = self.users.get_users(session, groups, self.negotiator)
+ except:
+ users = dict()
+ return users
def append_unclaimed_dyn_quota(self, session, quotas, force=False):
total = 0.0
@@ -370,16 +379,18 @@
def get_default(self, session):
return list()
- class Users(object):
- def get(self, session, groups):
- # XXX rewrite this for the new data
- return dict()
-
+ class Users(Attribute):
+ def get_users(self, session, groups, negotiator):
#returns {group: [user, user], group: [user, user], ...}
- users = self.items.get(session)
+ users = self.get(session)
if not users:
- items = self.get_items(session)
- user_names = [x[1] for x in items]
+ neg = negotiator.get(session)
+ pool = neg.Pool
+ cls = self.app.model.com_redhat_grid.Scheduler
+ scheduler = cls.get_object(session.cursor, Pool=pool)
+ cls = self.app.model.com_redhat_grid.Submitter
+ submitters = cls.get_selection(session.cursor, _schedulerRef_id=scheduler._id)
+ user_names = [x.Name for x in submitters]
users = dict()
for group in groups:
for user_name in user_names:
@@ -388,7 +399,7 @@
users[group] = list()
users[group].append(user_name)
- self.items.set(session, users)
+ self.set(session, users)
return users
class GroupAddForm(ObjectTaskForm):
@@ -400,15 +411,12 @@
self.group_helper = GroupHelper(app, "groups", self.object)
self.add_child(self.group_helper)
- self.group_name = Parameter(app, "name")
- self.add_parameter(self.group_name)
+ self.group_name = NameField(app, "name")
+ self.add_field(self.group_name)
def render_title(self, session):
return "Add Group"
- def render_group_name_path(self, session):
- return self.group_name.path
-
def process_submit(self, session):
negotiator = self.object.get(session)
group_name = self.group_name.get(session)
@@ -418,7 +426,8 @@
original_groups.append(group_name)
new_groups = ", ".join(original_groups)
self.task.invoke(session, negotiator, "GROUP_NAMES", new_groups)
- self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.reconfig(negotiator)
+
self.task.exit_with_redirect(session)
def is_valid(self, group):
@@ -515,7 +524,7 @@
self.task.invoke(session, negotiator, "GROUP_PRIO_FACTOR_"+group, new_value)
changed = True
if changed:
- self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.reconfig(negotiator)
self.task.exit_with_redirect(session)
def is_valid_factor(self, value):
@@ -561,7 +570,7 @@
self.task.invoke(session, negotiator, "GROUP_PRIO_FACTOR_"+user, new_value)
changed = True
if changed:
- self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.reconfig(negotiator)
self.task.exit_with_redirect(session)
class EditDynamicQuotaForm(GroupForm):
@@ -632,7 +641,7 @@
"GROUP_QUOTA_DYNAMIC_" + group, quota)
changed = True
if changed:
- self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.reconfig(negotiator)
self.task.exit_with_redirect(session)
def check_quota(self, quota, original):
@@ -706,7 +715,7 @@
self.task.invoke(session, negotiator, "GROUP_QUOTA_"+group, new_value)
changed = True
if changed:
- self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.reconfig(negotiator)
self.task.exit_with_redirect(session)
class EditRegroupForm(GroupForm):
@@ -784,7 +793,7 @@
self.task.invoke(session, negotiator, "GROUP_AUTOREGROUP_"+group, regroup[group])
changed = True
if changed:
- self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.reconfig(negotiator)
self.task.exit_with_redirect(session)
class UserRegroupForm(EditRegroupForm):
@@ -819,7 +828,7 @@
self.task.invoke(session, negotiator, "GROUP_AUTOREGROUP_"+user, regroup[user])
changed = True
if changed:
- self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.reconfig(negotiator)
self.task.exit_with_redirect(session)
class PriorityPieChart(StatFlashChart):
@@ -883,27 +892,27 @@
return "Set limit"
def do_invoke(self, invoc, negotiator, name, max):
- assert isinstance(negotiator, Negotiator)
+ action = SetLimit(self.app)
+ result = action.execute(negotiator, name, max)
+ if result.error:
+ invoc.exception(invod, result.error)
+ else:
+ action = QmfCall(self.app)
+ action.execute(negotiator, "Reconfig")
- negotiator.SetLimit(completion, name, max)
+ invoc.end()
- # XXX
- def completion():
- pass
-
- negotiator.Reconfig(completion)
-
class NegotiatorGroupTask(ObjectTask):
def do_exit(self, session):
self.app.main_page.main.grid.pool.negotiator.view.show(session)
- def do_invoke(self, completion, session, negotiator, group, value):
- assert isinstance(negotiator, Negotiator)
+ def do_invoke(self, invoc, negotiator, group, value):
+ self.qmf_call(invoc, negotiator, "SetRawConfig", group, value)
- if group == "Reconfig":
- negotiator.Reconfig(completion)
- else:
- negotiator.SetRawConfig(completion, group, value)
+ def reconfig(self, negotiator):
+ action = QmfCall(self.app)
+ #TODO: put this back when setrawconfig is fixed
+ #action.execute(negotiator, "Reconfig")
class NegotiatorGroupAdd(NegotiatorGroupTask):
def __init__(self, app, frame):
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.strings 2010-06-18 14:53:41 UTC (rev 4037)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.strings 2010-06-18 14:56:12 UTC (rev 4038)
@@ -8,10 +8,6 @@
[NegotiatorOverview.html]
<div id="{id}" class="CuminTable GroupTable">
- <div class="sactions">
- <h2>Actions:</h2>
- {buttons}
- </div>
<table {class}>
<thead><tr>{headers}</tr></thead>
<tbody>{items}</tbody>
Modified: mgmt/newdata/cumin/python/cumin/model.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/model.py 2010-06-18 14:53:41 UTC (rev 4037)
+++ mgmt/newdata/cumin/python/cumin/model.py 2010-06-18 14:56:12 UTC (rev 4038)
@@ -1585,12 +1585,22 @@
return "%s%s" % (conf, rect)
+class QmfException(Exception):
+ def __init__(self, value):
+ super(QmfException, self).__init__(value)
+ self.value = value
+
+ def __str__(self):
+ return repr(self.value)
+
class QmfCall(object):
- def __init__(self, app, default=None):
+ def __init__(self, app, default=None, timeout=5):
+ self.app = app
self.data = default
self.got_data = False
self.error = False
self.status = None
+ self.timeout = timeout
def get_completion(self):
def completion(status, data):
@@ -1599,58 +1609,41 @@
self.data = data
self.got_data = True
else:
- self.error = True
-
+ self.error = QmfException(status)
return completion
- def do_wait(self, timeout=5):
- wait(self.done, timeout=timeout)
+ def do_wait(self):
+ wait(self.done, timeout=self.timeout)
return self
def done(self):
return self.got_data or self.error
-class NewQmfCall(object):
- def __init__(self, app, default=None):
- self.app = app
- self.data = default
- self.got_data = False
- self.error = False
- self.status = None
- self.timeout = 5
-
- def qmf_call(self, obj, meth, *args):
- def completion(status_code, output_args):
- self.status = status_code
- if (status == 0) or (status == "OK"):
- self.data = output_args
- self.got_data = True
- else:
- self.data = self.default
- self.error = True
-
+ def execute(self, negotiator, method_name, *args):
session = self.app.session
- session.call_method(completion, obj, meth, *args)
- return self.do_wait(self.timeout)
+ try:
+ session.call_method(self.get_completion(), negotiator, method_name, args)
+ except Exception, e:
+ self.error = e
- def do_wait(self, timeout=5):
- wait(self.done, timeout=timeout)
- return self
+ results = self.do_wait()
+ if not results.got_data and not results.error:
+ results.error = QmfException("Request timed out")
- def done(self):
- return self.got_data or self.error
+ return results
class QmfCallSet(object):
def __init__(self, app):
self.app = app
self.calls = dict()
+ self.timeout = 5
def add_call(self, key, default=None):
call = QmfCall(self.app, default)
self.calls[key] = call
return call
- def do_wait(self, timeout=5):
+ def do_wait(self):
def predicate(calls):
done = 0
for call in calls:
@@ -1658,44 +1651,40 @@
done += 1
return done == len(calls)
- wait(predicate, timeout=timeout, args=self.calls)
+ wait(predicate, timeout=self.timeout, args=self.calls)
return self.calls
-class FetchRawConfig(QmfCall):
- def __init_(self, app):
- super(FetchRawConfig, self).__init__(app)
- self.data = {'Value': None}
-
- def execute(self, negotiator, config_name, timeout=5):
- negotiator.GetRawConfig(self.get_completion(), config_name, None)
- return self.do_wait(timeout)
-
class FetchRawConfigSet(QmfCallSet):
- def execute(self, negotiator, groups, prepend="", timeout=5):
+ def execute(self, negotiator, groups, prepend=""):
default = {'Value': 0}
+ session = self.app.session
for group in groups:
call = self.add_call(group, default)
- negotiator.GetRawConfig(call.get_completion(), prepend+group, None)
- return self.do_wait(timeout)
+ try:
+ session.call_method(call.get_completion(), negotiator, "GetRawConfig", (prepend+group,))
+ except Exception, e:
+ call.error = e
+ return self.do_wait()
+
class FetchJobAd(QmfCall):
def __init__(self, app):
super(FetchJobAd, self).__init__(app)
self.data = {'JobAd': {"":{"VALUE":"", "TYPE":0}}}
- def execute(self, scheduler, jobId, timeout=10):
- scheduler.GetAd(self.get_completion(), jobId, None)
- return self.do_wait(timeout)
-
class FetchJobOutput(QmfCall):
def __init__(self, app):
super(FetchJobOutput, self).__init__(app)
self.data = {'Data': ""}
- def execute(self, scheduler, jobId, file, start, end, timeout=10):
- scheduler.Fetch(self.get_completion(), jobId, file, start, end, None)
- return self.do_wait(timeout)
+ def execute(self, job_server, jobId, file, start, end):
+ session = self.app.session
+ try:
+ session.call_method(self.get_completion(), job_server, "Fetch", (jobId, file, start, end))
+ except Exception, e:
+ self.error = e
+ return self.do_wait()
class CuminScheduler(RemoteClass):
def __init__(self, model):
15 years, 10 months
rhmessaging commits: r4037 - mgmt/newdata/cumin/resources.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-06-18 10:53:41 -0400 (Fri, 18 Jun 2010)
New Revision: 4037
Modified:
mgmt/newdata/cumin/resources/incrementalSearch.js
Log:
Fix incremental search dropdown width
Modified: mgmt/newdata/cumin/resources/incrementalSearch.js
===================================================================
--- mgmt/newdata/cumin/resources/incrementalSearch.js 2010-06-18 14:06:28 UTC (rev 4036)
+++ mgmt/newdata/cumin/resources/incrementalSearch.js 2010-06-18 14:53:41 UTC (rev 4037)
@@ -29,15 +29,16 @@
};
p.show = function(){
- for(var thisObject = this, s = thisObject.c.style, o = thisObject.input, x = o.offsetLeft,
- y = o.offsetTop + o.offsetHeight; o = o.offsetParent; x += o.offsetLeft, y += o.offsetTop);
- s.left = x + "px", s.top = y + "px",
+ var i = $(this.input), s = $(this.c);
+ var iSize = i.getSize(), iPos = i.getPosition();
+ var sPos = iPos; sPos.y = iPos.y + iSize.y;
+ s.setPosition(sPos); s.setStyle('width', iSize.x);
+ var thisObject = this, s = thisObject.c.style;
thisObject.l.length ? (s.display = "block", !thisObject.visible && (thisObject._callEvent("onshow"), ++thisObject.visible), thisObject.highlite(0)) : s.display = "none";
};
p.hide = function(){
var thisObject = this, d = document, s = (thisObject.c && thisObject.c.parentNode.removeChild(thisObject.c),
thisObject.c = d.body.appendChild(d.createElement("div"))).style;
- thisObject.c.style.width = thisObject.input.offsetWidth + "px";
thisObject.l = [], thisObject.i = -1, thisObject.c.className = thisObject.className, s.position = "absolute", s.display = "none";
thisObject._old = null, thisObject.visible && (thisObject._callEvent("onhide"), --thisObject.visible);
};
@@ -77,6 +78,7 @@
};
p._fadeOut = function(){
var f = (f = function(){arguments.callee.x.hide();}, f.x = this, setTimeout(f, 200));
+ this.select();
};
p._handler = function(e){
var thisObject = this, t = e.type, k = e.key;
@@ -94,29 +96,13 @@
return thisObject[e] instanceof Function ? thisObject[e].apply(thisObject, [].slice.call(arguments, 1)) : undefined;
};
}
-//-- Searches for multiple matches ----
-function Inc_CIAnywhere(o, search){
- if(search = search.toLowerCase()) {
- var ul = $(o.listObjectID);
- var list = ul.getElements("li");
- for(var i = -1, l = list.length; ++i < l;){
- /*searches all the matches of "search" and adds the indexes in an array */
- for(var j = 0, indices = []; j = list[i].firstChild.nodeValue.toLowerCase().indexOf(search, j) + 1;
- indices[indices.length] = j - 1);
- /*if any ocurrence was found, adds the item and pass the position of the matches*/
- if(indices.length)
- o.add(list[i].firstChild.nodeValue, indices);
- }
- }
- o.show();
-}
function Inc_CIBeginning(o, search) {
if (search = search.toLowerCase()) {
- var ul = $(o.listObjectID);
- var list = ul.getElements("li");
- for(var i = -1, l = list.length; ++i < l;)
- if( list[i].firstChild.nodeValue.toLowerCase().indexOf(search) == 0)
- o.add(list[i].firstChild.nodeValue, 0);
+ var select = $(o.listObjectID);
+ for (var i = 0, l = select.options.length; i < l; ++i) {
+ if (select.options[i].text.toLowerCase().indexOf(search) == 0)
+ o.add(select.options[i].text, 0, select.options[i].value);
+ }
}
if ((o.l.length == 0) && (search.length > 0)) {
o.add("No Matches", -1);
15 years, 10 months
rhmessaging commits: r4036 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-06-18 10:06:28 -0400 (Fri, 18 Jun 2010)
New Revision: 4036
Modified:
store/trunk/cpp/lib/Makefile.am
Log:
Removed the lib version info from the previous checkin
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2010-06-17 20:02:13 UTC (rev 4035)
+++ store/trunk/cpp/lib/Makefile.am 2010-06-18 14:06:28 UTC (rev 4036)
@@ -27,19 +27,17 @@
dmoduledir=$(libdir)/qpid/daemon
dmodule_LTLIBRARIES = msgstore.la
-msgstore_la_LIBADD = \
+msgstore_la_LIBADD = \
$(APR_LIBS) \
$(LIB_DLOPEN) \
$(LIB_BERKELEY_DB) \
$(LIB_CLOCK_GETTIME) \
$(QPID_LIBS)
-MSGSTORE_VERSION_INFO = 1:0:0
-msgstore_la_LDFLAGS = \
- $(PLUGINLDFLAGS) \
- -version-info $(MSGSTORE_VERSION_INFO)
+msgstore_la_LDFLAGS = \
+ $(PLUGINLDFLAGS)
-msgstore_la_SOURCES = \
+msgstore_la_SOURCES = \
StorePlugin.cpp \
BindingDbt.cpp \
BufferValue.cpp \
15 years, 10 months
rhmessaging commits: r4035 - mgmt/newdata/rosemary/python/rosemary.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-06-17 16:02:13 -0400 (Thu, 17 Jun 2010)
New Revision: 4035
Modified:
mgmt/newdata/rosemary/python/rosemary/model.py
Log:
Forgot to check this in with 4032
Modified: mgmt/newdata/rosemary/python/rosemary/model.py
===================================================================
--- mgmt/newdata/rosemary/python/rosemary/model.py 2010-06-17 18:58:04 UTC (rev 4034)
+++ mgmt/newdata/rosemary/python/rosemary/model.py 2010-06-17 20:02:13 UTC (rev 4035)
@@ -667,6 +667,7 @@
self._class = cls
self._id = id
self._sync_time = None
+ self._sample_time = None
# XXX prefix these with _
def load(self, cursor):
15 years, 10 months
rhmessaging commits: r4034 - in store/trunk/cpp: lib and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-06-17 14:58:04 -0400 (Thu, 17 Jun 2010)
New Revision: 4034
Modified:
store/trunk/cpp/configure.ac
store/trunk/cpp/lib/Makefile.am
Log:
Added variable MSGSTORE_VERSION_INFO to control msgstore.so.x.x.x lib version numbers
Modified: store/trunk/cpp/configure.ac
===================================================================
--- store/trunk/cpp/configure.ac 2010-06-17 17:35:12 UTC (rev 4033)
+++ store/trunk/cpp/configure.ac 2010-06-17 18:58:04 UTC (rev 4034)
@@ -21,7 +21,7 @@
dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([msg-store], [0.6], [rhemrg-users-list(a)redhat.com])
+AC_INIT([msg-store], [0.7], [rhemrg-users-list(a)redhat.com])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([dist-bzip2])
@@ -201,13 +201,6 @@
fi
AC_SUBST(DB_CXX_HEADER_PREFIX)
-# Set the argument to be used in "libtool -version-info ARG".
-QPID_CURRENT=1
-QPID_REVISION=0
-QPID_AGE=1
-LIBTOOL_VERSION_INFO_ARG=$QPID_CURRENT:$QPID_REVISION:$QPID_AGE
-AC_SUBST(LIBTOOL_VERSION_INFO_ARG)
-
gl_CLOCK_TIME
# We use valgrind for the tests. See if it's available.
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2010-06-17 17:35:12 UTC (rev 4033)
+++ store/trunk/cpp/lib/Makefile.am 2010-06-17 18:58:04 UTC (rev 4034)
@@ -34,8 +34,10 @@
$(LIB_CLOCK_GETTIME) \
$(QPID_LIBS)
-msgstore_la_LDFLAGS = \
- $(PLUGINLDFLAGS)
+MSGSTORE_VERSION_INFO = 1:0:0
+msgstore_la_LDFLAGS = \
+ $(PLUGINLDFLAGS) \
+ -version-info $(MSGSTORE_VERSION_INFO)
msgstore_la_SOURCES = \
StorePlugin.cpp \
15 years, 10 months
rhmessaging commits: r4033 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-06-17 13:35:12 -0400 (Thu, 17 Jun 2010)
New Revision: 4033
Modified:
store/trunk/cpp/lib/jrnl/enq_map.cpp
store/trunk/cpp/lib/jrnl/enq_map.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
Log:
Refactor to remove exceptions from emap execution path
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2010-06-17 13:47:29 UTC (rev 4032)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2010-06-17 17:35:12 UTC (rev 4033)
@@ -8,7 +8,7 @@
*
* \author Kim van der Riet
*
- * Copyright (c) 2007, 2008, 2009 Red Hat Inc.
+ * Copyright (c) 2007, 2008, 2009, 2010 Red Hat Inc.
*
* This file is part of the Qpid async store library msgstore.so.
*
@@ -43,6 +43,14 @@
namespace journal
{
+// static return/error codes
+int16_t enq_map::EMAP_DUP_RID = -3;
+int16_t enq_map::EMAP_LOCKED = -2;
+int16_t enq_map::EMAP_RID_NOT_FOUND = -1;
+int16_t enq_map::EMAP_OK = 0;
+int16_t enq_map::EMAP_FALSE = 0;
+int16_t enq_map::EMAP_TRUE = 1;
+
enq_map::enq_map():
_map(),
_pfid_enq_cnt()
@@ -56,13 +64,14 @@
_pfid_enq_cnt.set_size(num_jfiles);
}
-void
+
+int16_t
enq_map::insert_pfid(const u_int64_t rid, const u_int16_t pfid)
{
- insert_pfid(rid, pfid, false);
+ return insert_pfid(rid, pfid, false);
}
-void
+int16_t
enq_map::insert_pfid(const u_int64_t rid, const u_int16_t pfid, const bool locked)
{
std::pair<emap_itr, bool> ret;
@@ -72,51 +81,32 @@
ret = _map.insert(emap_param(rid, rec));
}
if (ret.second == false)
- {
- std::ostringstream oss;
- oss << std::hex << "rid=0x" << rid << " pfid=0x" << pfid;
- throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "enq_map", "insert_pfid");
- }
+ return EMAP_DUP_RID;
_pfid_enq_cnt.incr(pfid);
+ return EMAP_OK;
}
-u_int16_t
+int16_t
enq_map::get_pfid(const u_int64_t rid)
{
slock s(_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
- {
- std::ostringstream oss;
- oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_pfid");
- }
+ return EMAP_RID_NOT_FOUND;
if (itr->second._lock)
- {
- std::ostringstream oss;
- oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "enq_map", "get_pfid");
- }
+ return EMAP_LOCKED;
return itr->second._pfid;
}
-u_int16_t
+int16_t
enq_map::get_remove_pfid(const u_int64_t rid, const bool txn_flag)
{
slock s(_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
- {
- std::ostringstream oss;
- oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_remove_pfid");
- }
+ return EMAP_RID_NOT_FOUND;
if (itr->second._lock && !txn_flag) // locked, but not a commit/abort
- {
- std::ostringstream oss;
- oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "enq_map", "get_remove_pfid");
- }
+ return EMAP_LOCKED;
u_int16_t pfid = itr->second._pfid;
_map.erase(itr);
_pfid_enq_cnt.decr(pfid);
@@ -135,46 +125,36 @@
return true;
}
-void
+int16_t
enq_map::lock(const u_int64_t rid)
{
slock s(_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
- {
- std::ostringstream oss;
- oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "lock");
- }
+ return EMAP_RID_NOT_FOUND;
itr->second._lock = true;
+ return EMAP_OK;
}
-void
+int16_t
enq_map::unlock(const u_int64_t rid)
{
slock s(_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
- {
- std::ostringstream oss;
- oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "unlock");
- }
+ return EMAP_RID_NOT_FOUND;
itr->second._lock = false;
+ return EMAP_OK;
}
-bool
+int16_t
enq_map::is_locked(const u_int64_t rid)
{
slock s(_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
- {
- std::ostringstream oss;
- oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "is_locked");
- }
- return itr->second._lock;
+ return EMAP_RID_NOT_FOUND;
+ return itr->second._lock ? EMAP_TRUE : EMAP_FALSE;
}
void
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2010-06-17 13:47:29 UTC (rev 4032)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2010-06-17 17:35:12 UTC (rev 4033)
@@ -8,7 +8,7 @@
*
* \author Kim van der Riet
*
- * Copyright (c) 2007, 2008, 2009 Red Hat Inc.
+ * Copyright (c) 2007, 2008, 2009, 2010 Red Hat Inc.
*
* This file is part of the Qpid async store library msgstore.so.
*
@@ -75,6 +75,15 @@
*/
class enq_map
{
+ public:
+ // return/error codes
+ static int16_t EMAP_DUP_RID;
+ static int16_t EMAP_LOCKED;
+ static int16_t EMAP_RID_NOT_FOUND;
+ static int16_t EMAP_OK;
+ static int16_t EMAP_FALSE;
+ static int16_t EMAP_TRUE;
+
private:
struct emap_data_struct
@@ -98,14 +107,14 @@
void set_num_jfiles(const u_int16_t num_jfiles);
inline u_int32_t get_enq_cnt(const u_int16_t pfid) const { return _pfid_enq_cnt.cnt(pfid); };
- void insert_pfid(const u_int64_t rid, const u_int16_t pfid);
- void insert_pfid(const u_int64_t rid, const u_int16_t pfid, const bool locked);
- u_int16_t get_pfid(const u_int64_t rid);
- u_int16_t get_remove_pfid(const u_int64_t rid, const bool txn_flag = false);
+ int16_t insert_pfid(const u_int64_t rid, const u_int16_t pfid); // 0=ok; -3=duplicate rid;
+ int16_t insert_pfid(const u_int64_t rid, const u_int16_t pfid, const bool locked); // 0=ok; -3=duplicate rid;
+ int16_t get_pfid(const u_int64_t rid); // >=0=pfid; -1=rid not found; -2=locked
+ int16_t get_remove_pfid(const u_int64_t rid, const bool txn_flag = false); // >=0=pfid; -1=rid not found; -2=locked
bool is_enqueued(const u_int64_t rid, bool ignore_lock = false);
- void lock(const u_int64_t rid);
- void unlock(const u_int64_t rid);
- bool is_locked(const u_int64_t rid);
+ int16_t lock(const u_int64_t rid); // 0=ok; -1=rid not found
+ int16_t unlock(const u_int64_t rid); // 0=ok; -1=rid not found
+ int16_t is_locked(const u_int64_t rid); // 1=true; 0=false; -1=rid not found
inline void clear() { _map.clear(); }
inline bool empty() const { return _map.empty(); }
inline u_int32_t size() const { return u_int32_t(_map.size()); }
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-06-17 13:47:29 UTC (rev 4032)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-06-17 17:35:12 UTC (rev 4033)
@@ -630,7 +630,16 @@
if (i->_enq_flag) // enq op - decrement enqueue count
rd._enq_cnt_list[i->_pfid]--;
else if (_emap.is_enqueued(i->_drid, true)) // deq op - unlock enq record
- _emap.unlock(i->_drid);
+ {
+ int16_t ret = _emap.unlock(i->_drid);
+ if (ret < enq_map::EMAP_OK) // fail
+ {
+ // enq_map::unlock()'s only error is enq_map::EMAP_RID_NOT_FOUND
+ std::ostringstream oss;
+ oss << std::hex << "_emap.unlock(): drid=0x\"" << i->_drid;
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "jcntl", "rcvr_janalyze");
+ }
+ }
}
}
}
@@ -701,7 +710,15 @@
std::free(xidp);
}
else
- _emap.insert_pfid(h._rid, start_fid);
+ {
+ if (_emap.insert_pfid(h._rid, start_fid) < enq_map::EMAP_OK) // fail
+ {
+ // The only error code emap::insert_pfid() returns is enq_map::EMAP_DUP_RID.
+ std::ostringstream oss;
+ oss << std::hex << "rid=0x" << h._rid << " _pfid=0x" << start_fid;
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "jcntl", "rcvr_get_next_record");
+ }
+ }
}
}
break;
@@ -714,11 +731,7 @@
if (dr.xid_size())
{
// If the enqueue is part of a pending txn, it will not yet be in emap
- try { _emap.lock(dr.deq_rid()); }
- catch(const jexception& e)
- {
- if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
- }
+ _emap.lock(dr.deq_rid()); // ignore not found error
dr.get_xid(&xidp);
assert(xidp != 0);
std::string xid((char*)xidp, dr.xid_size());
@@ -735,15 +748,18 @@
}
else
{
- try
+ int16_t enq_fid = _emap.get_remove_pfid(dr.deq_rid(), true);
+ if (enq_fid < enq_map::EMAP_OK) // fail
{
- u_int16_t enq_fid = _emap.get_remove_pfid(dr.deq_rid(), true);
+ if (enq_fid == enq_map::EMAP_RID_NOT_FOUND)
+ {
+ std::ostringstream oss;
+ oss << std::hex << "_emap.get_remove_pfid(): drid=0x" << dr.deq_rid();
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "jcntl", "rcvr_get_next_record");
+ }
+ }
+ else
rd._enq_cnt_list[enq_fid]--;
- }
- catch(const jexception& e)
- {
- if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
- }
}
}
break;
@@ -756,27 +772,14 @@
ar.get_xid(&xidp);
assert(xidp != 0);
std::string xid((char*)xidp, ar.xid_size());
- try
+ txn_data_list tdl = _tmap.get_remove_tdata_list(xid); // tdl will be empty if xid not found
+ for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
- txn_data_list tdl = _tmap.get_remove_tdata_list(xid); // tdl will be empty if xid not found
- for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
- {
- if (itr->_enq_flag)
- rd._enq_cnt_list[itr->_pfid]--;
- else
- {
- try { _emap.unlock(itr->_drid); }
- catch(const jexception& e)
- {
- if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
- }
- }
- }
+ if (itr->_enq_flag)
+ rd._enq_cnt_list[itr->_pfid]--;
+ else
+ _emap.unlock(itr->_drid); // ignore not found error
}
- catch (const jexception& e)
- {
- if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
- }
std::free(xidp);
}
break;
@@ -789,31 +792,35 @@
cr.get_xid(&xidp);
assert(xidp != 0);
std::string xid((char*)xidp, cr.xid_size());
- try
+ txn_data_list tdl = _tmap.get_remove_tdata_list(xid); // tdl will be empty if xid not found
+ for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
- txn_data_list tdl = _tmap.get_remove_tdata_list(xid); // tdl will be empty if xid not found
- for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
+ if (itr->_enq_flag) // txn enqueue
{
- if (itr->_enq_flag) // txn enqueue
- _emap.insert_pfid(itr->_rid, itr->_pfid);
- else // txn dequeue
+ if (_emap.insert_pfid(itr->_rid, itr->_pfid) < enq_map::EMAP_OK) // fail
{
- try
+ // The only error code emap::insert_pfid() returns is enq_map::EMAP_DUP_RID.
+ std::ostringstream oss;
+ oss << std::hex << "rid=0x" << itr->_rid << " _pfid=0x" << itr->_pfid;
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "jcntl", "rcvr_get_next_record");
+ }
+ }
+ else // txn dequeue
+ {
+ int16_t fid = _emap.get_remove_pfid(itr->_drid, true);
+ if (fid < 0)
+ {
+ if (fid == enq_map::EMAP_RID_NOT_FOUND)
{
- u_int16_t fid = _emap.get_remove_pfid(itr->_drid, true);
- rd._enq_cnt_list[fid]--;
+ std::ostringstream oss;
+ oss << std::hex << "_emap.get_remove_pfid(): drid=0x" << itr->_drid;
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "jcntl", "rcvr_get_next_record");
}
- catch (const jexception& e)
- {
- if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
- }
}
+ else
+ rd._enq_cnt_list[fid]--;
}
}
- catch (const jexception& e)
- {
- if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
- }
std::free(xidp);
}
break;
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2010-06-17 13:47:29 UTC (rev 4032)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2010-06-17 17:35:12 UTC (rev 4033)
@@ -8,7 +8,7 @@
*
* \author Kim van der Riet
*
- * Copyright (c) 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright (c) 2007, 2008, 2009, 2010 Red Hat, Inc.
*
* This file is part of the Qpid async store library msgstore.so.
*
@@ -584,7 +584,7 @@
inline bool is_enqueued(const u_int64_t rid, bool ignore_lock = false)
{ return _emap.is_enqueued(rid, ignore_lock); }
inline bool is_locked(const u_int64_t rid)
- { if (_emap.is_enqueued(rid, true)) return _emap.is_locked(rid); return false; }
+ { if (_emap.is_enqueued(rid, true) < enq_map::EMAP_OK) return false; return _emap.is_locked(rid) == enq_map::EMAP_TRUE; }
inline void enq_rid_list(std::vector<u_int64_t>& rids) { _emap.rid_list(rids); }
inline void enq_xid_list(std::vector<std::string>& xids) { _tmap.xid_list(xids); }
inline u_int32_t get_open_txn_cnt() const { return _tmap.size(); }
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2010-06-17 13:47:29 UTC (rev 4032)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2010-06-17 17:35:12 UTC (rev 4033)
@@ -8,7 +8,7 @@
*
* \author Kim van der Riet
*
- * Copyright (c) 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright (c) 2007, 2008, 2009, 2010 Red Hat, Inc.
*
* This file is part of the Qpid async store library msgstore.so.
*
@@ -154,18 +154,13 @@
{
_enq_rec.reset(); // sets enqueue rec size
// Check if RID of this rec is still enqueued, if so read it, else skip
- u_int16_t fid = 0;
bool is_enq = false;
- try
+ int16_t fid = _emap.get_pfid(_hdr._rid);
+ if (fid < enq_map::EMAP_OK)
{
- fid = _emap.get_pfid(_hdr._rid); // If locked, will throw JERR_MAP_LOCKED
- is_enq = true;
- }
- catch (const jexception& e)
- {
bool enforce_txns = !_jc->is_read_only() && !ignore_pending_txns;
// Block read for transactionally locked record (only when not recovering)
- if (e.err_code() == jerrno::JERR_MAP_LOCKED && enforce_txns)
+ if (fid == enq_map::EMAP_LOCKED && enforce_txns)
return RHM_IORES_TXPENDING;
// (Recover mode only) Ok, not in emap - now search tmap, if present then read
@@ -173,6 +168,8 @@
if (enforce_txns && is_enq)
return RHM_IORES_TXPENDING;
}
+ else
+ is_enq = true;
if (is_enq) // ok, this record is enqueued, check it, then read it...
{
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2010-06-17 13:47:29 UTC (rev 4032)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2010-06-17 17:35:12 UTC (rev 4033)
@@ -197,7 +197,15 @@
_tmap.insert_txn_data(xid, txn_data(rid, 0, dtokp->fid(), true));
}
else
- _emap.insert_pfid(rid, dtokp->fid());
+ {
+ if (_emap.insert_pfid(rid, dtokp->fid()) < enq_map::EMAP_OK) // fail
+ {
+ // The only error code emap::insert_pfid() returns is enq_map::EMAP_DUP_RID.
+ std::ostringstream oss;
+ oss << std::hex << "rid=0x" << rid << " _pfid=0x" << dtokp->fid();
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "wmgr", "enqueue");
+ }
+ }
done = true;
}
@@ -284,17 +292,28 @@
if (xid_len) // If part of transaction, add to transaction map
{
// If the enqueue is part of a pending txn, it will not yet be in emap
- try { _emap.lock(dequeue_rid); }
- catch(const jexception& e)
- {
- if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
- }
+ _emap.lock(dequeue_rid); // ignore rid not found error
std::string xid((char*)xid_ptr, xid_len);
_tmap.insert_txn_data(xid, txn_data(rid, dequeue_rid, dtokp->fid(), false));
}
else
{
- u_int16_t fid = _emap.get_remove_pfid(dtokp->dequeue_rid());
+ int16_t fid = _emap.get_remove_pfid(dtokp->dequeue_rid());
+ if (fid < enq_map::EMAP_OK) // fail
+ {
+ if (fid == enq_map::EMAP_RID_NOT_FOUND)
+ {
+ std::ostringstream oss;
+ oss << std::hex << "rid=0x" << rid;
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "wmgr", "dequeue");
+ }
+ if (fid == enq_map::EMAP_LOCKED)
+ {
+ std::ostringstream oss;
+ oss << std::hex << "rid=0x" << rid;
+ throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "wmgr", "dequeue");
+ }
+ }
_wrfc.decr_enqcnt(fid);
}
@@ -375,15 +394,8 @@
txn_data_list tdl = _tmap.get_remove_tdata_list(xid); // tdl will be empty if xid not found
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
- try
- {
- if (!itr->_enq_flag)
- _emap.unlock(itr->_drid);
- }
- catch(const jexception& e)
- {
- if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
- }
+ if (!itr->_enq_flag)
+ _emap.unlock(itr->_drid); // ignore rid not found error
if (itr->_enq_flag)
_wrfc.decr_enqcnt(itr->_pfid);
}
@@ -473,10 +485,33 @@
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
if (itr->_enq_flag) // txn enqueue
- _emap.insert_pfid(itr->_rid, itr->_pfid);
+ {
+ if (_emap.insert_pfid(itr->_rid, itr->_pfid) < enq_map::EMAP_OK) // fail
+ {
+ // The only error code emap::insert_pfid() returns is enq_map::EMAP_DUP_RID.
+ std::ostringstream oss;
+ oss << std::hex << "rid=0x" << itr->_rid << " _pfid=0x" << itr->_pfid;
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "wmgr", "commit");
+ }
+ }
else // txn dequeue
{
- u_int16_t fid = _emap.get_remove_pfid(itr->_drid, true);
+ int16_t fid = _emap.get_remove_pfid(itr->_drid, true);
+ if (fid < enq_map::EMAP_OK) // fail
+ {
+ if (fid == enq_map::EMAP_RID_NOT_FOUND)
+ {
+ std::ostringstream oss;
+ oss << std::hex << "rid=0x" << rid;
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "wmgr", "dequeue");
+ }
+ if (fid == enq_map::EMAP_LOCKED)
+ {
+ std::ostringstream oss;
+ oss << std::hex << "rid=0x" << rid;
+ throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "wmgr", "dequeue");
+ }
+ }
_wrfc.decr_enqcnt(fid);
}
}
@@ -884,18 +919,23 @@
{
// First check emap
bool found = false;
- try
+ int16_t fid = _emap.get_pfid(drid);
+ if (fid < enq_map::EMAP_OK) // fail
{
- _emap.get_pfid(drid);
+ if (fid == enq_map::EMAP_RID_NOT_FOUND)
+ {
+ if (xid.size())
+ found = _tmap.data_exists(xid, drid);
+ }
+ else if (fid == enq_map::EMAP_LOCKED)
+ {
+ std::ostringstream oss;
+ oss << std::hex << "drid=0x" << drid;
+ throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "wmgr", "dequeue_check");
+ }
+ }
+ else
found = true;
- }
- catch(const jexception& e)
- {
- if (e.err_code() != jerrno::JERR_MAP_NOTFOUND)
- throw;
- if (xid.size())
- found = _tmap.data_exists(xid, drid);
- }
if (!found)
{
std::ostringstream oss;
Modified: store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2010-06-17 13:47:29 UTC (rev 4032)
+++ store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2010-06-17 17:35:12 UTC (rev 4033)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright (c) 2007, 2008, 2009, 2010 Red Hat, Inc.
*
* This file is part of the Qpid async store library msgstore.so.
*
@@ -57,7 +57,7 @@
u_int64_t rid_incr_1 = 4ULL;
enq_map e2;
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1, pfid++)
- e2.insert_pfid(rid, pfid);
+ BOOST_CHECK_EQUAL(e2.insert_pfid(rid, pfid), enq_map::EMAP_OK);
BOOST_CHECK(!e2.empty());
BOOST_CHECK_EQUAL(e2.size(), u_int32_t(128));
@@ -66,18 +66,18 @@
for (u_int64_t rid = rid_begin; rid < rid_end; rid += rid_incr_2)
{
BOOST_CHECK_EQUAL(e2.is_enqueued(rid), (rid%rid_incr_1 ? false : true));
- try
+ u_int16_t exp_pfid = pfid_start + (u_int16_t)((rid - rid_begin)/rid_incr_1);
+ int16_t ret_fid = e2.get_pfid(rid);
+ if (ret_fid < enq_map::EMAP_OK) // fail
{
- u_int16_t exp_pfid = pfid_start + (u_int16_t)((rid - rid_begin)/rid_incr_1);
- u_int16_t ret_fid = e2.get_pfid(rid);
+ BOOST_CHECK_EQUAL(ret_fid, enq_map::EMAP_RID_NOT_FOUND);
+ BOOST_CHECK(rid%rid_incr_1);
+ }
+ else
+ {
BOOST_CHECK_EQUAL(ret_fid, exp_pfid);
BOOST_CHECK(rid%rid_incr_1 == 0);
}
- catch (const jexception& e)
- {
- BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_NOTFOUND);
- BOOST_CHECK(rid%rid_incr_1);
- }
if ((rid + rid_incr_2)%(8 * rid_incr_2) == 0)
pfid++;
}
@@ -85,16 +85,14 @@
// insert with dups
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_2, pfid++)
{
- try
+ int16_t res = e2.insert_pfid(rid, pfid);
+ if (res < enq_map::EMAP_OK) // fail
{
- e2.insert_pfid(rid, pfid);
- BOOST_CHECK(rid%rid_incr_1);
- }
- catch (const jexception& e)
- {
- BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_DUPLICATE);
+ BOOST_CHECK_EQUAL(res, enq_map::EMAP_DUP_RID);
BOOST_CHECK(rid%rid_incr_1 == 0);
}
+ else
+ BOOST_CHECK(rid%rid_incr_1);
}
BOOST_CHECK_EQUAL(e2.size(), u_int32_t(171));
e2.clear();
@@ -116,24 +114,24 @@
u_int64_t num_incr_1 = (rid_end - rid_begin)/rid_incr_1;
enq_map e3;
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1, pfid++)
- e3.insert_pfid(rid, pfid);
+ BOOST_CHECK_EQUAL(e3.insert_pfid(rid, pfid), enq_map::EMAP_OK);
BOOST_CHECK_EQUAL(e3.size(), num_incr_1);
u_int64_t rid_incr_2 = 6ULL;
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_2, pfid++)
{
- try
+ u_int16_t exp_pfid = pfid_start + (u_int16_t)((rid - rid_begin)/rid_incr_1);
+ int16_t ret_fid = e3.get_remove_pfid(rid);
+ if (ret_fid < enq_map::EMAP_OK) // fail
{
- u_int16_t exp_pfid = pfid_start + (u_int16_t)((rid - rid_begin)/rid_incr_1);
- u_int16_t ret_fid = e3.get_remove_pfid(rid);
+ BOOST_CHECK_EQUAL(ret_fid, enq_map::EMAP_RID_NOT_FOUND);
+ BOOST_CHECK(rid%rid_incr_1);
+ }
+ else
+ {
BOOST_CHECK_EQUAL(ret_fid, exp_pfid);
BOOST_CHECK(rid%rid_incr_1 == 0);
}
- catch (const jexception& e)
- {
- BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_NOTFOUND);
- BOOST_CHECK(rid%rid_incr_1);
- }
}
BOOST_CHECK_EQUAL(e3.size(), u_int32_t(85));
cout << "ok" << endl;
@@ -155,52 +153,46 @@
enq_map e4;
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1, pfid++)
{
- e4.insert_pfid(rid, pfid, locked);
+ BOOST_CHECK_EQUAL(e4.insert_pfid(rid, pfid, locked), enq_map::EMAP_OK);
locked = !locked;
}
BOOST_CHECK_EQUAL(e4.size(), num_incr_1);
// unlock and lock non-existent rids
- try
- {
- e4.lock(1ULL);
- BOOST_ERROR("Failed to throw exception when locking non-existent rid.");
- }
- catch (const jexception& e) { BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_NOTFOUND); }
- try
- {
- e4.unlock(2ULL);
- BOOST_ERROR("Failed to throw exception when locking non-existent rid.");
- }
- catch (const jexception& e) { BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_NOTFOUND); }
+ int16_t res = e4.lock(1ULL);
+ if (res < enq_map::EMAP_OK)
+ BOOST_CHECK_EQUAL(res, enq_map::EMAP_RID_NOT_FOUND);
+ else
+ BOOST_ERROR("Failed to detect locking non-existent rid.");
+ res = e4.unlock(2ULL);
+ if (res < enq_map::EMAP_OK)
+ BOOST_CHECK_EQUAL(res, enq_map::EMAP_RID_NOT_FOUND);
+ else
+ BOOST_ERROR("Failed to detect unlocking non-existent rid.");
// get / unlock
for (u_int64_t rid = rid_begin; rid < rid_end; rid += rid_incr_1)
{
- try { e4.get_pfid(rid); }
- catch(const jexception& e)
+ int16_t fid = e4.get_pfid(rid);
+ if (fid < enq_map::EMAP_OK) // fail
{
- BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_LOCKED);
+ BOOST_CHECK_EQUAL(fid, enq_map::EMAP_LOCKED);
BOOST_CHECK(rid%(2*rid_incr_1));
// unlock, read, then relock
- e4.unlock(rid);
- e4.get_pfid(rid);
- e4.lock(rid);
- try
- {
- e4.get_pfid(rid);
- BOOST_ERROR("Failed to throw exception when getting locked record");
- }
- catch(const jexception& e)
- {
- BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_LOCKED);
- }
+ BOOST_CHECK_EQUAL(e4.unlock(rid), enq_map::EMAP_OK);
+ BOOST_CHECK(e4.get_pfid(rid) >= enq_map::EMAP_OK);
+ BOOST_CHECK_EQUAL(e4.lock(rid), enq_map::EMAP_OK);
+ fid = e4.get_pfid(rid);
+ if (fid < enq_map::EMAP_OK) // fail
+ BOOST_CHECK_EQUAL(fid, enq_map::EMAP_LOCKED);
+ else
+ BOOST_ERROR("Failed to prevent getting locked record");
}
}
// remove all; if locked, use with txn_flag true; should ignore all locked records
for (u_int64_t rid = rid_begin; rid < rid_end; rid += rid_incr_1)
- e4.get_remove_pfid(rid, true);
+ BOOST_CHECK(e4.get_remove_pfid(rid, true) >= enq_map::EMAP_OK);
BOOST_CHECK(e4.empty());
cout << "ok" << endl;
}
@@ -222,7 +214,7 @@
enq_map e5;
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1, pfid++)
{
- e5.insert_pfid(rid, pfid);
+ BOOST_CHECK_EQUAL(e5.insert_pfid(rid, pfid), enq_map::EMAP_OK);
rid_list.push_back(rid);
pfid_list.push_back(pfid);
}
@@ -260,7 +252,7 @@
for (u_int16_t pfid=0; pfid<4; pfid++)
BOOST_CHECK_EQUAL(e6.get_enq_cnt(pfid), u_int32_t(0));
for (u_int64_t rid=0; rid<100; rid++)
- e6.insert_pfid(rid, 1);
+ BOOST_CHECK_EQUAL(e6.insert_pfid(rid, 1), enq_map::EMAP_OK);
for (u_int16_t pfid=0; pfid<4; pfid++)
{
if (pfid == 1)
@@ -271,7 +263,8 @@
// Now remove 10 from file 1, check that the counts match
for (u_int64_t rid=0; rid<100; rid+=10)
- e6.get_remove_pfid(rid);
+ //e6.Xget_remove_pfid(rid);
+ BOOST_CHECK(e6.get_remove_pfid(rid) >= enq_map::EMAP_OK);
for (u_int16_t pfid=0; pfid<4; pfid++)
{
if (pfid == 1)
@@ -305,17 +298,18 @@
// insert even rids with no dups
for (rid = rid_begin, rid_cnt = u_int64_t(0); rid_cnt < num_rid; rid += 2ULL, rid_cnt++)
- e7.insert_pfid(rid, u_int16_t(0));
+ BOOST_CHECK_EQUAL(e7.insert_pfid(rid, u_int16_t(0)), enq_map::EMAP_OK);
BOOST_CHECK_EQUAL(e7.size(), num_rid);
// insert odd rids with no dups
for (rid = rid_begin + 1, rid_cnt = u_int64_t(0); rid_cnt < num_rid; rid += 2ULL, rid_cnt++)
- e7.insert_pfid(rid, u_int16_t(0));
+ BOOST_CHECK_EQUAL(e7.insert_pfid(rid, u_int16_t(0)), enq_map::EMAP_OK);
BOOST_CHECK_EQUAL(e7.size(), num_rid * 2);
// remove even rids
for (rid = rid_begin, rid_cnt = u_int64_t(0); rid_cnt < num_rid; rid += 2ULL, rid_cnt++)
- e7.get_remove_pfid(rid);
+// e7.Xget_remove_pfid(rid);
+ BOOST_CHECK(e7.get_remove_pfid(rid) >= enq_map::EMAP_OK);
BOOST_CHECK_EQUAL(e7.size(), num_rid);
cout << "ok" << endl;
15 years, 10 months
rhmessaging commits: r4032 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-06-17 09:47:29 -0400 (Thu, 17 Jun 2010)
New Revision: 4032
Modified:
mgmt/newdata/mint/python/mint/update.py
Log:
* Use a distinct sample timeout to flow control samples
* Move the sample drop logic to an earlier point
* Tune the queue pressure sensor to 1000 items
* Count an update that results in no database writes as dropped
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-06-16 19:08:47 UTC (rev 4031)
+++ mgmt/newdata/mint/python/mint/update.py 2010-06-17 13:47:29 UTC (rev 4032)
@@ -189,15 +189,27 @@
cls = self.get_class()
obj = self.get_object(cls, self.object.getObjectId().objectName)
- if not obj._sync_time and not self.object.getProperties():
- # This is a sample for an object we don't have yet
- stats.dropped += 1; return
-
update_time, create_time, delete_time = self.object.getTimestamps()
update_time = datetime.fromtimestamp(update_time / 1000000000)
- last_update_time = obj._qmf_update_time
+ now = datetime.now()
+ if self.object.getStatistics() and not self.object.getProperties():
+ # Just stats; do we want it?
+
+ if not obj._sync_time:
+ # We don't have this object yet
+ stats.dropped += 1; return
+
+ if stats.enqueued - stats.dequeued > 1000:
+ if update_time < now - minutes_ago:
+ # The sample is too old
+ stats.dropped += 1; return
+
+ if obj._sample_time and obj._sample_time > now - seconds_ago:
+ # The samples are too fidelitous
+ stats.dropped += 1; return
+
obj._qmf_update_time = update_time
object_columns = list()
@@ -221,32 +233,17 @@
statements.append(sql)
+ obj._sync_time = now
+
if sample_columns:
- keep = True
+ sample_columns.append(cls.sql_samples_table._qmf_update_time)
- if stats.enqueued - stats.dequeued > 100:
- # There's some pressure, so consider dropping samples
+ sql = cls.sql_samples_insert.emit(sample_columns)
+ statements.append(sql)
- now = datetime.now()
-
- if update_time < now - minutes_ago:
- # The sample is too old
- keep = False
+ stats.sampled += 1
+ obj._sample_time = now
- if last_update_time and last_update_time > now - seconds_ago:
- # The samples are too fidelitous
- keep = False
-
- if keep:
- sample_columns.append(cls.sql_samples_table._qmf_update_time)
-
- sql = cls.sql_samples_insert.emit(sample_columns)
- stats.sampled += 1
-
- statements.append(sql)
- else:
- stats.dropped += 1
-
if statements:
text = "; ".join(statements)
@@ -264,9 +261,9 @@
log.info("Sql row count: %i", cursor.rowcount)
raise
+ else:
+ stats.dropped += 1
- obj._sync_time = datetime.now()
-
def get_class(self):
class_key = self.object.getClassKey()
15 years, 10 months