rhmessaging commits: r3068 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2009-01-22 15:13:06 -0500 (Thu, 22 Jan 2009)
New Revision: 3068
Modified:
mgmt/trunk/cumin/python/cumin/tools.py
Log:
BZ475999 - mint not shutdown by iniscript; add SIGTERM signal handler
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2009-01-22 20:06:04 UTC (rev 3067)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2009-01-22 20:13:06 UTC (rev 3068)
@@ -428,6 +428,8 @@
def __init__(self, name):
super(CuminServerTool, self).__init__(name)
+ signal.signal(signal.SIGTERM, self.sigTermHandler)
+
self.description = "Cumin web server"
param = ConfigParameter(self.config, "addr", str)
@@ -450,6 +452,9 @@
opt = CommandOption(self, "ssl")
opt.description = "Serve web pages using SSL"
+ def sigTermHandler(self, signum, frame):
+ sys.exit(1)
+
class MintProcess(object):
def __init__(self):
self.proc = None
@@ -468,19 +473,21 @@
self.proc = Popen(args)
def stop(self):
- os.kill(self.proc.pid, signal.SIGTERM)
+ if self.proc.poll is not None:
+ os.kill(self.proc.pid, signal.SIGTERM)
for i in range(30):
code = self.proc.poll()
if code is not None:
+ log.debug("Mint subprocess %i terminated", self.proc.pid)
return
sleep(1)
os.kill(self.proc.pid, signal.SIGKILL)
- log.warn("Mint subprocess %i wouldn't go gracefully",
+ log.warn("Mint subprocess %i wouldn't go gracefully, killed",
self.proc.pid)
def do_run(self, opts, args):
15 years, 12 months
rhmessaging commits: r3067 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-01-22 15:06:04 -0500 (Thu, 22 Jan 2009)
New Revision: 3067
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jinf.cpp
store/trunk/cpp/lib/jrnl/jinf.hpp
store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
Log:
More preparation for auto-expand: Class jinf var renames.
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2009-01-22 16:41:49 UTC (rev 3066)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2009-01-22 20:06:04 UTC (rev 3067)
@@ -592,12 +592,12 @@
try
{
- rd._ffid = ji.get_first_fid();
- rd._lfid = ji.get_last_fid();
+ rd._ffid = ji.get_first_pfid();
+ rd._lfid = ji.get_last_pfid();
rd._owi = ji.get_initial_owi();
rd._frot = ji.get_frot();
rd._jempty = false;
- ji.get_normalized_fid_list(rd._fid_list);
+ ji.get_normalized_pfid_list(rd._fid_list); // _pfid_list
}
catch (const jexception& e)
{
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2009-01-22 16:41:49 UTC (rev 3066)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2009-01-22 20:06:04 UTC (rev 3067)
@@ -207,9 +207,9 @@
// If this is not the first rotation, all files should be in either early or late maps
if (!_frot) assert(early_map.size() + late_map.size() == _num_jfiles);
- _fidl.clear();
- late_map.get_pfid_list(_fidl);
- early_map.get_pfid_list(_fidl);
+ _pfid_list.clear();
+ late_map.get_pfid_list(_pfid_list);
+ early_map.get_pfid_list(_pfid_list);
_analyzed_flag = true;
}
@@ -234,44 +234,44 @@
}
u_int16_t
-jinf::get_first_fid()
+jinf::get_first_pfid()
{
if (!_analyzed_flag)
analyze();
- return *_fidl.begin();
+ return *_pfid_list.begin();
}
u_int16_t
-jinf::get_last_fid()
+jinf::get_last_pfid()
{
if (!_analyzed_flag)
analyze();
- return *_fidl.rbegin();
+ return *_pfid_list.rbegin();
}
-jinf::fid_list&
-jinf::get_fid_list()
+jinf::pfid_list&
+jinf::get_pfid_list()
{
if (!_analyzed_flag)
analyze();
- return _fidl;
+ return _pfid_list;
}
void
-jinf::get_normalized_fid_list(fid_list& fidl)
+jinf::get_normalized_pfid_list(pfid_list& pfid_list)
{
if (!_analyzed_flag)
analyze();
- fidl.clear();
- u_int16_t s = _fidl.size();
+ pfid_list.clear();
+ u_int16_t s = _pfid_list.size();
u_int16_t iz = 0; // index of 0 value
- while (_fidl[iz] && iz < s)
+ while (_pfid_list[iz] && iz < s)
iz++;
- assert(_fidl[iz] == 0);
+ assert(_pfid_list[iz] == 0);
for (u_int16_t i = iz; i < iz + s; i++)
- fidl.push_back(_fidl[i % s]);
- assert(fidl[0] == 0);
- assert(fidl.size() == s);
+ pfid_list.push_back(_pfid_list[i % s]);
+ assert(pfid_list[0] == 0);
+ assert(pfid_list.size() == s);
}
bool
Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp 2009-01-22 16:41:49 UTC (rev 3066)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp 2009-01-22 20:06:04 UTC (rev 3067)
@@ -48,8 +48,8 @@
class jinf
{
public:
- typedef std::vector<u_int16_t> fid_list; // pfids
- typedef fid_list::const_iterator fidl_citr;
+ typedef std::vector<u_int16_t> pfid_list; // pfids
+ typedef pfid_list::const_iterator pfidl_citr;
private:
u_int8_t _jver;
@@ -70,7 +70,7 @@
std::tm* _tm_ptr;
bool _valid_flag;
bool _analyzed_flag;
- fid_list _fidl;
+ pfid_list _pfid_list;
bool _initial_owi;
bool _frot;
@@ -105,10 +105,10 @@
inline u_int16_t wcache_num_pages() const { return _wcache_num_pages; }
inline u_int32_t rcache_pgsize_sblks() const { return _rcache_pgsize_sblks; }
inline u_int16_t rcache_num_pages() const { return _rcache_num_pages; }
- u_int16_t get_first_fid();
- u_int16_t get_last_fid();
- fid_list& get_fid_list();
- void get_normalized_fid_list(fid_list& fidl);
+ u_int16_t get_first_pfid();
+ u_int16_t get_last_pfid();
+ pfid_list& get_pfid_list();
+ void get_normalized_pfid_list(pfid_list& pfid_list);
bool get_initial_owi();
bool get_frot();
Modified: store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2009-01-22 16:41:49 UTC (rev 3066)
+++ store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2009-01-22 20:06:04 UTC (rev 3067)
@@ -292,10 +292,10 @@
*/
void check_analysis(jinf& ji) // jinf object under test after analyze() has been called
{
- BOOST_CHECK_EQUAL(ji.get_first_fid(), get_first_pfid());
- BOOST_CHECK_EQUAL(ji.get_last_fid(), get_last_pfid());
+ BOOST_CHECK_EQUAL(ji.get_first_pfid(), get_first_pfid());
+ BOOST_CHECK_EQUAL(ji.get_last_pfid(), get_last_pfid());
- jinf::fid_list& pfidl = ji.get_fid_list();
+ jinf::pfid_list& pfidl = ji.get_pfid_list();
const u_int16_t num_jfiles = _map.size();
const bool all_used = _num_used_files == num_jfiles;
BOOST_CHECK_EQUAL(pfidl.size(), _num_used_files);
15 years, 12 months
rhmessaging commits: r3066 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-01-22 11:41:49 -0500 (Thu, 22 Jan 2009)
New Revision: 3066
Modified:
mgmt/trunk/cumin/python/cumin/binding.py
Log:
Whitespace cleanup
Modified: mgmt/trunk/cumin/python/cumin/binding.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/binding.py 2009-01-21 19:48:22 UTC (rev 3065)
+++ mgmt/trunk/cumin/python/cumin/binding.py 2009-01-22 16:41:49 UTC (rev 3066)
@@ -15,7 +15,7 @@
self.exchange = None
self.instance_data = None
-
+
self.name_tmpl = Template(self, "name_html")
self.key_tmpl = Template(self, "key_html")
@@ -30,7 +30,7 @@
def get_args(self, session):
return (self.exchange,)
-
+
def get_exchange_info(self, session, exchange):
binding_info = self.form.bindings.dict_param.get(session)
if str(exchange.id) in binding_info:
@@ -41,7 +41,7 @@
if exchange_info:
if key in exchange_info:
return exchange_info[key]
-
+
def render_exchange_name(self, session, exchange):
return exchange.name
@@ -50,16 +50,16 @@
def render_name_path(self, session, *args):
return DictParameter.sep().join((self.instance_data, "name"))
-
+
def render_exchange_type(self, session, exchange):
return exchange.type
def render_exchange_type_path(self, session, exchange):
return DictParameter.sep().join((self.instance_data, "type"))
-
+
def render_exchange_id(self, session, exchange):
return exchange.id
-
+
def render_exchange_checked(self, session, exchange):
exchange_info = self.get_exchange_info(session, exchange)
if exchange_info:
@@ -70,21 +70,21 @@
writer = Writer()
self.name_tmpl.render(writer, session, exchange)
return writer.to_string()
-
+
def render_exchange_key_input(self, session, exchange):
writer = Writer()
self.key_tmpl.render(writer, session, exchange)
return writer.to_string()
-
+
def render_onclick(self, session, exchange):
pass
-
+
def render_list_error(self, session, exchange):
errors = self.parent.binding_errors.get(session)
if exchange.name in errors:
return "<ul class=\"errors\" style=\"margin:0; float:left;\"><li>%s</li></ul>" % \
"</li><li>".join(errors[exchange.name])
-
+
def render_dict_error(self, session, exchange, key):
errors = self.parent.binding_errors.get(session)
if exchange.name in errors:
@@ -92,11 +92,11 @@
if key in exchange_errors:
return "<ul class=\"errors\" style=\"margin:0; float:left;\"><li>%s</li></ul>" % \
"</li><li>".join(exchange_errors[key])
-
+
def set_instance_data(self, exchange, dict_key):
self.exchange = exchange
self.instance_data = dict_key
-
+
class FanoutExchangeInput(ExchangeInput):
pass
@@ -109,10 +109,10 @@
def render_key_error(self, session, exchange):
return self.render_list_error(session, exchange)
-
+
def render_key_value(self, session, exchange):
return self.get_exchange_info_for(session, exchange, "key")
-
+
class DirectExchangeInput(BindingKeyExchangeInput):
pass
@@ -125,24 +125,24 @@
def render_xquery_path(self, session, exchange):
return DictParameter.sep().join((self.instance_data, "xquery"))
-
+
def render_headers_class(self, session, exchange):
exchange_info = self.get_exchange_info(session, exchange)
- if not exchange_info or not "name" in exchange_info:
+ if not exchange_info or not "name" in exchange_info:
return "initial_header_state"
def render_key_error(self, session, exchange):
return self.render_dict_error(session, exchange, "key")
-
+
def render_onclick(self, session, exchange):
return "onclick=\"toggle_row(this, 'xml_extra.%s')\"" % str(exchange.id)
def render_xml_extra(self, session, exchange):
return "xml_extra.%s" % str(exchange.id)
-
+
def render_xquery_error(self, session, exchange):
return self.render_dict_error(session, exchange, "xquery")
-
+
def render_xquery_value(self, session, exchange):
return self.get_exchange_info_for(session, exchange, "xquery")
@@ -159,24 +159,24 @@
def render_mkey_path(self, session, exchange):
return DictParameter.sep().join((self.instance_data, "mkey"))
-
+
def render_headers_class(self, session, exchange):
exchange_info = self.get_exchange_info(session, exchange)
- if not exchange_info or not "name" in exchange_info:
+ if not exchange_info or not "name" in exchange_info:
return "initial_header_state"
def render_all_checked(self, session, exchange):
checked = self.render_any_checked(session, exchange)
if not checked:
return "checked=\"checked\""
-
+
def render_any_checked(self, session, exchange):
exchange_info = self.get_exchange_info(session, exchange)
if exchange_info:
if "x-match" in exchange_info:
if exchange_info["x-match"] == "any":
return "checked=\"checked\""
-
+
def render_mkey1_value(self, session, exchange):
return self.get_exchange_info_for(session, exchange, "mkey.1")
@@ -188,16 +188,16 @@
def render_mnv1_value(self, session, exchange):
return self.get_exchange_info_for(session, exchange, "mkey.1.nv")
-
+
def render_mnv2_value(self, session, exchange):
return self.get_exchange_info_for(session, exchange, "mkey.2.nv")
def render_mnv3_value(self, session, exchange):
return self.get_exchange_info_for(session, exchange, "mkey.3.nv")
-
+
def render_key_error(self, session, exchange):
return self.render_dict_error(session, exchange, "key")
-
+
def render_mkey1_error(self, session, exchange):
return self.render_dict_error(session, exchange, "mkey.1")
@@ -235,15 +235,15 @@
for m_info in this_exchange:
if m_info.startswith(match_info):
if m_info.endswith("nv"):
- return this_exchange[m_info]
-
+ return this_exchange[m_info]
+
class ExchangeState(SubmitSwitch):
def __init__(self, app, name):
super(ExchangeState, self).__init__(app, name)
self.add_state("c", "Active", bm="phase")
self.add_state("a", "All", bm="phase")
-
+
def is_all(self, session):
return self.get(session) == "a"
@@ -256,7 +256,7 @@
self.dict_param = DictParameter(app, "exchange")
self.add_parameter(self.dict_param)
-
+
self.direct_input = DirectExchangeInput(app, "direct")
self.add_child(self.direct_input)
@@ -271,9 +271,9 @@
self.headers_input = HeadersExchangeInput(app, "headers")
self.add_child(self.headers_input)
-
+
self.title = title
-
+
self.binding_errors = self.Errors(self, "binding_errors")
self.add_attribute(self.binding_errors)
@@ -283,14 +283,14 @@
def get_args(self, session):
reg = self.frame.get_ancestor("broker").get_object(session)
return (reg.getDefaultVhost(),)
-
+
class Errors(Attribute):
def get_default(self, session):
return dict()
def render_title(self, session, vhost):
return self.title
-
+
def render_exchanges(self, session, vhost):
sortedExchanges = sorted_by(vhost.exchanges)
@@ -320,9 +320,9 @@
elif exchange.type == "headers":
self.headers_input.set_instance_data(exchange, instance_key)
writer.write(self.headers_input.render(session))
-
+
return writer.to_string()
-
+
def get_binding_errors(self, session, queue_name):
form_binding_info = self.process_binding_info(session, queue_name)
@@ -360,9 +360,9 @@
if not name in berrs:
berrs.setdefault(name, dict())
berrs[name]["xquery"] = ["Missing xquery"]
-
+
return (len(berrs), form_binding_info)
-
+
def process_binding_info(self, session, queue_name):
""" Processes the raw binding_info from the DictParameter into
a "form_binding_info" dictionary that contains four keys:
15 years, 12 months
rhmessaging commits: r3065 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-01-21 14:48:22 -0500 (Wed, 21 Jan 2009)
New Revision: 3065
Modified:
mgmt/trunk/cumin/python/cumin/modelwidgets.py
Log:
Whitespace cleanup
Modified: mgmt/trunk/cumin/python/cumin/modelwidgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/modelwidgets.py 2009-01-21 17:20:46 UTC (rev 3064)
+++ mgmt/trunk/cumin/python/cumin/modelwidgets.py 2009-01-21 19:48:22 UTC (rev 3065)
@@ -22,7 +22,7 @@
if self.object:
object = self.object.get(session)
-
+
self.action.show(branch, object)
self.page.set_redirect_url(session, branch.marshal())
@@ -44,7 +44,7 @@
object = self.object.get(session)
self.action.show(session, object)
-
+
def render_content(self, session, *args):
return self.action.get_title(session)
@@ -127,7 +127,7 @@
self.actions.add_child(button)
self.add = None
-
+
if hasattr(self.cumin_class, "add"):
self.add = CuminActionLink(app, "add", self.cumin_class.add)
self.add.html_class = "action"
15 years, 12 months
rhmessaging commits: r3064 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-01-21 12:20:46 -0500 (Wed, 21 Jan 2009)
New Revision: 3064
Modified:
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/page.py
mgmt/trunk/cumin/python/cumin/system.strings
Log:
Fix for app error when cancelling Job Hold/Release/Remove from main and system pages.
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2009-01-21 16:50:17 UTC (rev 3063)
+++ mgmt/trunk/cumin/python/cumin/job.py 2009-01-21 17:20:46 UTC (rev 3064)
@@ -340,6 +340,15 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
+ self.jobs_hold = JobSetHold(app, "jobshold")
+ self.add_mode(self.jobs_hold)
+
+ self.jobs_release = JobSetRelease(app, "jobsrelease")
+ self.add_mode(self.jobs_release)
+
+ self.jobs_remove = JobSetRemove(app, "jobsremove")
+ self.add_mode(self.jobs_remove)
+
self.system = SystemFrame(app, "system")
self.add_mode(self.system)
@@ -424,7 +433,7 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- href = self.app.main_page.main.pool.jobs_remove.get_href(session, ids)
+ href = self.frame.jobs_remove.get_href(session, ids)
self.page.set_redirect_url(session, href)
def render_content(self, session):
@@ -443,7 +452,7 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- href = self.app.main_page.main.pool.jobs_hold.get_href(session, ids)
+ href = self.frame.jobs_hold.get_href(session, ids)
self.page.set_redirect_url(session, href)
def render_content(self, session):
@@ -462,7 +471,7 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- href = self.app.main_page.main.pool.jobs_release.get_href(session, ids)
+ href = self.frame.jobs_release.get_href(session, ids)
self.page.set_redirect_url(session, href)
def render_content(self, session):
@@ -1173,6 +1182,12 @@
else:
super(JobReasonBulkActionForm, self).process_submit(session, *args)
+ def process_return(self, session, *args):
+ branch = session.branch()
+ self.frame.show_view(branch)
+ self.page.set_current_frame(branch, self.frame)
+ self.page.set_redirect_url(session, branch.marshal())
+
def get_reason(self, session, verb):
""" returns <verb> by username[: <user input reason>] """
reason = [self.reason.get(session)]
Modified: mgmt/trunk/cumin/python/cumin/page.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.py 2009-01-21 16:50:17 UTC (rev 3063)
+++ mgmt/trunk/cumin/python/cumin/page.py 2009-01-21 17:20:46 UTC (rev 3064)
@@ -69,6 +69,15 @@
self.brokers_remove = BrokerSetRemove(app, "brokersremove")
self.add_mode(self.brokers_remove)
+ self.jobs_hold = JobSetHold(app, "jobshold")
+ self.add_mode(self.jobs_hold)
+
+ self.jobs_release = JobSetRelease(app, "jobsrelease")
+ self.add_mode(self.jobs_release)
+
+ self.jobs_remove = JobSetRemove(app, "jobsremove")
+ self.add_mode(self.jobs_remove)
+
action = self.app.model.broker_group.remove_set
item = BrokerGroupParameter(app, "item")
self.broker_groups_remove = CuminSetActionForm \
Modified: mgmt/trunk/cumin/python/cumin/system.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.strings 2009-01-21 16:50:17 UTC (rev 3063)
+++ mgmt/trunk/cumin/python/cumin/system.strings 2009-01-21 17:20:46 UTC (rev 3064)
@@ -158,12 +158,6 @@
<div class="rfloat">{phase}</div>
<form id="{id}" style="clear:right;" method="post" action="?">
- <div class="sactions">
- {job_search}
- <h2>Act on Selected Jobs:</h2>
- {hold} {release} {remove}
- </div>
-
<table class="mobjects">
<thead>
<tr>
16 years
rhmessaging commits: r3063 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-01-21 11:50:17 -0500 (Wed, 21 Jan 2009)
New Revision: 3063
Modified:
store/trunk/cpp/lib/jrnl/enq_map.cpp
store/trunk/cpp/lib/jrnl/enq_map.hpp
store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
Log:
Further preparation for auto-expand: Additional changed to class enq_map that were previously overlooked.
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2009-01-21 16:19:47 UTC (rev 3062)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2009-01-21 16:50:17 UTC (rev 3063)
@@ -78,7 +78,7 @@
{
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid << " pfid=0x" << pfid;
- throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "enq_map", "insert");
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "enq_map", "insert_pfid");
}
_pfid_enq_cnt.incr(pfid);
}
@@ -95,13 +95,13 @@
{
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_pfid");
}
if (itr->second._lock)
{
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "enq_map", "get_fid");
+ throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "enq_map", "get_pfid");
}
return itr->second._pfid;
}
@@ -115,13 +115,13 @@
{
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_remove_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_remove_pfid");
}
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_fid");
+ throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "enq_map", "get_remove_pfid");
}
u_int16_t pfid = itr->second._pfid;
_map.erase(itr);
@@ -150,7 +150,7 @@
{
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_remove_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "lock");
}
itr->second._lock = true;
}
@@ -164,7 +164,7 @@
{
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_remove_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "unlock");
}
itr->second._lock = false;
}
@@ -181,7 +181,7 @@
{
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "is_locked");
}
return itr->second._lock;
}
@@ -198,7 +198,7 @@
}
void
-enq_map::fid_list(std::vector<u_int16_t>& fv)
+enq_map::pfid_list(std::vector<u_int16_t>& fv)
{
fv.clear();
{
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2009-01-21 16:19:47 UTC (rev 3062)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2009-01-21 16:50:17 UTC (rev 3063)
@@ -109,7 +109,7 @@
inline bool empty() const { return _map.empty(); }
inline u_int32_t size() const { return u_int32_t(_map.size()); }
void rid_list(std::vector<u_int64_t>& rv);
- void fid_list(std::vector<u_int16_t>& fv);
+ void pfid_list(std::vector<u_int16_t>& fv);
};
} // namespace journal
Modified: store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2009-01-21 16:19:47 UTC (rev 3062)
+++ store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2009-01-21 16:50:17 UTC (rev 3063)
@@ -224,17 +224,17 @@
u_int64_t rid_incr_1 = 4ULL;
u_int64_t num_incr_1 = (rid_end - rid_begin)/rid_incr_1;
vector<u_int64_t> rid_list;
- vector<u_int16_t> fid_list;
+ vector<u_int16_t> pfid_list;
enq_map e5;
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1, pfid++)
{
e5.insert_pfid(rid, pfid);
rid_list.push_back(rid);
- fid_list.push_back(pfid);
+ pfid_list.push_back(pfid);
}
BOOST_CHECK_EQUAL(e5.size(), num_incr_1);
BOOST_CHECK_EQUAL(rid_list.size(), num_incr_1);
- BOOST_CHECK_EQUAL(fid_list.size(), num_incr_1);
+ BOOST_CHECK_EQUAL(pfid_list.size(), num_incr_1);
vector<u_int64_t> ret_rid_list;
e5.rid_list(ret_rid_list);
@@ -242,11 +242,11 @@
for (unsigned i=0; i<ret_rid_list.size(); i++)
BOOST_CHECK_EQUAL(rid_list[i], ret_rid_list[i]);
- vector<u_int16_t> ret_fid_list;
- e5.fid_list(ret_fid_list);
- BOOST_CHECK_EQUAL(ret_fid_list.size(), num_incr_1);
- for (unsigned i=0; i<ret_fid_list.size(); i++)
- BOOST_CHECK_EQUAL(fid_list[i], ret_fid_list[i]);
+ vector<u_int16_t> ret_pfid_list;
+ e5.pfid_list(ret_pfid_list);
+ BOOST_CHECK_EQUAL(ret_pfid_list.size(), num_incr_1);
+ for (unsigned i=0; i<ret_pfid_list.size(); i++)
+ BOOST_CHECK_EQUAL(pfid_list[i], ret_pfid_list[i]);
cout << "ok" << endl;
}
16 years
rhmessaging commits: r3062 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-01-21 11:19:47 -0500 (Wed, 21 Jan 2009)
New Revision: 3062
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
store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp
Log:
Further preparation for auto-expand: class txn_map - changed names using fid to pfid.
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -381,7 +381,7 @@
{
u_int16_t ffid = _wrfc.earliest_index();
u_int16_t fid = _wrfc.index();
- while ( _emap.get_enq_cnt(ffid) == 0 && _tmap.get_txn_fid_cnt(ffid) == 0 && ffid != fid)
+ while ( _emap.get_enq_cnt(ffid) == 0 && _tmap.get_txn_pfid_cnt(ffid) == 0 && ffid != fid)
{
if (++ffid >= _lpmgr.num_jfiles())
ffid = 0;
@@ -629,7 +629,7 @@
for (tdl_itr i=tdl.begin(); i<tdl.end(); i++)
{
if (i->_enq_flag) // enq op - decrement enqueue count
- rd._enq_cnt_list[i->_fid]--;
+ rd._enq_cnt_list[i->_pfid]--;
else if (_emap.is_enqueued(i->_drid, true)) // deq op - unlock enq record
_emap.unlock(i->_drid);
}
@@ -751,7 +751,7 @@
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
if (itr->_enq_flag)
- rd._enq_cnt_list[itr->_fid]--;
+ rd._enq_cnt_list[itr->_pfid]--;
else
{
try { _emap.unlock(itr->_drid); }
@@ -784,7 +784,7 @@
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
if (itr->_enq_flag) // txn enqueue
- _emap.insert_pfid(itr->_rid, itr->_fid);
+ _emap.insert_pfid(itr->_rid, itr->_pfid);
else // txn dequeue
{
try
Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -41,11 +41,11 @@
namespace journal
{
-txn_data_struct::txn_data_struct(const u_int64_t rid, const u_int64_t drid, const u_int16_t fid,
+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),
_drid(drid),
- _fid(fid),
+ _pfid(pfid),
_enq_flag(enq_flag),
_commit_flag(commit_flag),
_aio_compl(false)
@@ -53,7 +53,7 @@
txn_map::txn_map():
_map(),
- _fid_txn_cnt()
+ _pfid_txn_cnt()
{
pthread_mutex_init(&_mutex, 0);
}
@@ -66,7 +66,7 @@
void
txn_map::set_num_jfiles(const u_int16_t num_jfiles)
{
- _fid_txn_cnt.set_size(num_jfiles);
+ _pfid_txn_cnt.set_size(num_jfiles);
}
bool
@@ -85,7 +85,7 @@
}
else
itr->second.push_back(td);
- _fid_txn_cnt.incr(td._fid);
+ _pfid_txn_cnt.incr(td._pfid);
return ok;
}
@@ -123,7 +123,7 @@
txn_data_list list = itr->second;
_map.erase(itr);
for (tdl_itr i=list.begin(); i!=list.end(); i++)
- _fid_txn_cnt.decr(i->_fid);
+ _pfid_txn_cnt.decr(i->_pfid);
return list;
}
Modified: store/trunk/cpp/lib/jrnl/txn_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.hpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/lib/jrnl/txn_map.hpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -62,11 +62,11 @@
{
u_int64_t _rid; ///< Record id for this operation
u_int64_t _drid; ///< Dequeue record id for this operation
- u_int16_t _fid; ///< File id, to be used when transferring to emap on commit
+ u_int16_t _pfid; ///< Physical file id, to be used when transferring to emap on commit
bool _enq_flag; ///< If true, enq op, otherwise deq op
bool _commit_flag; ///< (2PC transactions) Records 2PC complete c/a mode
bool _aio_compl; ///< Initially false, set to true when record AIO returns
- txn_data_struct(const u_int64_t rid, const u_int64_t drid, const u_int16_t fid,
+ 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 = false);
};
typedef txn_data_struct txn_data;
@@ -89,7 +89,7 @@
*
* On transaction commit, then each operation is handled as follows:
*
- * If an enqueue (_enq_flag is true), then the rid and fid are transferred to the enq_map.
+ * If an enqueue (_enq_flag is true), then the rid and pfid are transferred to the enq_map.
* If a dequeue (_enq_flag is false), then the rid stored in the drid field is used to
* remove the corresponding record from the enq_map.
*
@@ -102,9 +102,9 @@
* <pre>
* key data
*
- * xid1 --- vector< [ rid, drid, fid, enq_flag, commit_flag, aio_compl ] >
- * xid2 --- vector< [ rid, drid, fid, enq_flag, commit_flag, aio_compl ] >
- * xid3 --- vector< [ rid, drid, fid, enq_flag, commit_flag, aio_compl ] >
+ * xid1 --- vector< [ rid, drid, pfid, enq_flag, commit_flag, aio_compl ] >
+ * xid2 --- vector< [ rid, drid, pfid, enq_flag, commit_flag, aio_compl ] >
+ * xid3 --- vector< [ rid, drid, pfid, enq_flag, commit_flag, aio_compl ] >
* ...
* </pre>
*/
@@ -117,15 +117,15 @@
xmap _map;
pthread_mutex_t _mutex;
- arr_cnt _fid_txn_cnt;
+ arr_cnt _pfid_txn_cnt;
public:
txn_map();
virtual ~txn_map();
void set_num_jfiles(const u_int16_t num_jfiles);
- inline u_int32_t get_txn_fid_cnt(const u_int16_t fid) const
- { return _fid_txn_cnt.cnt(fid); };
+ inline u_int32_t get_txn_pfid_cnt(const u_int16_t pfid) const
+ { return _pfid_txn_cnt.cnt(pfid); };
bool insert_txn_data(const std::string& xid, const txn_data& td);
const txn_data_list get_tdata_list(const std::string& xid);
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -467,7 +467,7 @@
if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
}
if (itr->_enq_flag)
- _wrfc.decr_enqcnt(itr->_fid);
+ _wrfc.decr_enqcnt(itr->_pfid);
}
std::pair<std::set<std::string>::iterator, bool> res = _txn_pending_set.insert(xid);
if (!res.second)
@@ -597,7 +597,7 @@
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
if (itr->_enq_flag) // txn enqueue
- _emap.insert_pfid(itr->_rid, itr->_fid);
+ _emap.insert_pfid(itr->_rid, itr->_pfid);
else // txn dequeue
{
u_int16_t fid = _emap.get_remove_pfid(itr->_drid, true);
Modified: store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -56,7 +56,7 @@
{
BOOST_CHECK_EQUAL(td1._rid, td2._rid);
BOOST_CHECK_EQUAL(td1._drid, td2._drid);
- BOOST_CHECK_EQUAL(td1._fid, td2._fid);
+ BOOST_CHECK_EQUAL(td1._pfid, td2._pfid);
BOOST_CHECK_EQUAL(td1._enq_flag, td2._enq_flag);
BOOST_CHECK_EQUAL(td1._aio_compl, td2._aio_compl);
}
@@ -68,12 +68,12 @@
cout << test_filename << ".constructor: " << flush;
const u_int64_t rid = 0x123456789abcdef0ULL;
const u_int64_t drid = 0xfedcba9876543210ULL;
- const u_int16_t fid = 0xfedcU;
+ const u_int16_t pfid = 0xfedcU;
const bool enq_flag = true;
- txn_data td(rid, drid, fid, enq_flag);
+ txn_data td(rid, drid, pfid, enq_flag);
BOOST_CHECK_EQUAL(td._rid, rid);
BOOST_CHECK_EQUAL(td._drid, drid);
- BOOST_CHECK_EQUAL(td._fid, fid);
+ BOOST_CHECK_EQUAL(td._pfid, pfid);
BOOST_CHECK_EQUAL(td._enq_flag, enq_flag);
BOOST_CHECK_EQUAL(td._aio_compl, false);
16 years
rhmessaging commits: r3061 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-01-21 11:14:57 -0500 (Wed, 21 Jan 2009)
New Revision: 3061
Modified:
mgmt/trunk/cumin/python/cumin/brokergroup.py
Log:
Whitespace cleanup
Modified: mgmt/trunk/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokergroup.py 2009-01-21 15:42:30 UTC (rev 3060)
+++ mgmt/trunk/cumin/python/cumin/brokergroup.py 2009-01-21 16:14:57 UTC (rev 3061)
@@ -29,7 +29,7 @@
item = BrokerGroupParameter(app, "item")
self.param = ListParameter(app, "param", item)
self.add_parameter(self.param)
-
+
def do_get_items(self, session, *args):
return BrokerGroup.select()
@@ -138,7 +138,7 @@
branch = session.branch()
self.page.main.view.show(branch)
self.page.set_redirect_url(session, branch.marshal())
-
+
def process_submit(self, session):
errors = self.validate(session)
16 years
rhmessaging commits: r3060 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-01-21 10:42:30 -0500 (Wed, 21 Jan 2009)
New Revision: 3060
Modified:
store/trunk/cpp/lib/jrnl/fcntl.cpp
store/trunk/cpp/lib/jrnl/fcntl.hpp
store/trunk/cpp/lib/jrnl/jerrno.cpp
store/trunk/cpp/lib/jrnl/jerrno.hpp
Log:
Possible fix for BZ 480964 - "JERR_FCNTL_CMPLOFFSOVFL during flow-to-disk". Checks for fcntl::add_rd_cmpl_cnt_dblks() and fcntl::add_wr_cmpl_cnt_dblks() exceeding their corresponding submit counts were removed.
Modified: store/trunk/cpp/lib/jrnl/fcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/fcntl.cpp 2009-01-21 14:58:32 UTC (rev 3059)
+++ store/trunk/cpp/lib/jrnl/fcntl.cpp 2009-01-21 15:42:30 UTC (rev 3060)
@@ -186,20 +186,6 @@
}
u_int32_t
-fcntl::add_rd_cmpl_cnt_dblks(u_int32_t a)
-{
- if (_rd_cmpl_cnt_dblks + a > _rd_subm_cnt_dblks)
- {
- std::ostringstream oss;
- oss << "pfid=" << _pfid << " lfid=" << _lfid << " rd_cmpl_cnt_dblks=" << _rd_cmpl_cnt_dblks << " incr=" << a;
- oss << " rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks;
- throw jexception(jerrno::JERR_FCNTL_CMPLOFFSOVFL, oss.str(), "fcntl", "add_rd_cmpl_cnt_dblks");
- }
- _rd_cmpl_cnt_dblks += a;
- return _rd_cmpl_cnt_dblks;
-}
-
-u_int32_t
fcntl::add_wr_subm_cnt_dblks(u_int32_t a)
{
if (_wr_subm_cnt_dblks + a > _ffull_dblks) // Allow for file header
@@ -213,20 +199,6 @@
return _wr_subm_cnt_dblks;
}
-u_int32_t
-fcntl::add_wr_cmpl_cnt_dblks(u_int32_t a)
-{
- if (_wr_cmpl_cnt_dblks + a > _wr_subm_cnt_dblks)
- {
- std::ostringstream oss;
- oss << "pfid=" << _pfid << " lfid=" << _lfid << " wr_cmpl_cnt_dblks=" << _wr_cmpl_cnt_dblks << " incr=" << a;
- oss << " wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
- throw jexception(jerrno::JERR_FCNTL_CMPLOFFSOVFL, oss.str(), "fcntl", "add_wr_cmpl_cnt_dblks");
- }
- _wr_cmpl_cnt_dblks += a;
- return _wr_cmpl_cnt_dblks;
-}
-
u_int16_t
fcntl::decr_aio_cnt()
{
Modified: store/trunk/cpp/lib/jrnl/fcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/fcntl.hpp 2009-01-21 14:58:32 UTC (rev 3059)
+++ store/trunk/cpp/lib/jrnl/fcntl.hpp 2009-01-21 15:42:30 UTC (rev 3060)
@@ -101,7 +101,7 @@
inline u_int32_t rd_cmpl_cnt_dblks() const { return _rd_cmpl_cnt_dblks; }
inline std::size_t rd_cmpl_offs() const { return _rd_cmpl_cnt_dblks * JRNL_DBLK_SIZE; }
- u_int32_t add_rd_cmpl_cnt_dblks(u_int32_t a);
+ inline u_int32_t add_rd_cmpl_cnt_dblks(u_int32_t a) { _rd_cmpl_cnt_dblks += a; return _rd_cmpl_cnt_dblks; }
inline u_int32_t wr_subm_cnt_dblks() const { return _wr_subm_cnt_dblks; }
inline std::size_t wr_subm_offs() const { return _wr_subm_cnt_dblks * JRNL_DBLK_SIZE; }
@@ -109,7 +109,7 @@
inline u_int32_t wr_cmpl_cnt_dblks() const { return _wr_cmpl_cnt_dblks; }
inline std::size_t wr_cmpl_offs() const { return _wr_cmpl_cnt_dblks * JRNL_DBLK_SIZE; }
- u_int32_t add_wr_cmpl_cnt_dblks(u_int32_t a);
+ inline u_int32_t add_wr_cmpl_cnt_dblks(u_int32_t a) { _wr_cmpl_cnt_dblks += a; return _wr_cmpl_cnt_dblks; }
inline u_int16_t aio_cnt() const { return _aio_cnt; }
inline u_int16_t incr_aio_cnt() { return ++_aio_cnt; }
Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2009-01-21 14:58:32 UTC (rev 3059)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2009-01-21 15:42:30 UTC (rev 3060)
@@ -82,8 +82,7 @@
const u_int32_t jerrno::JERR_FCNTL_WRITE = 0x0401;
const u_int32_t jerrno::JERR_FCNTL_CLOSE = 0x0402;
const u_int32_t jerrno::JERR_FCNTL_FILEOFFSOVFL = 0x0403;
-const u_int32_t jerrno::JERR_FCNTL_CMPLOFFSOVFL = 0x0404;
-const u_int32_t jerrno::JERR_FCNTL_RDOFFSOVFL = 0x0405;
+const u_int32_t jerrno::JERR_FCNTL_RDOFFSOVFL = 0x0404;
// class lfmgr
const u_int32_t jerrno::JERR_LFMGR_BADAEFNUMLIM = 0x0500;
@@ -172,7 +171,6 @@
_err_map[JERR_FCNTL_WRITE] = "JERR_FCNTL_WRITE: Unable to write to file.";
_err_map[JERR_FCNTL_CLOSE] = "JERR_FCNTL_CLOSE: File close failed.";
_err_map[JERR_FCNTL_FILEOFFSOVFL] = "JERR_FCNTL_FILEOFFSOVFL: Attempted increase file offset past file size.";
- _err_map[JERR_FCNTL_CMPLOFFSOVFL] = "JERR_FCNTL_CMPLOFFSOVFL: Attempted increase completed file offset past submitted offset.";
_err_map[JERR_FCNTL_RDOFFSOVFL] = "JERR_FCNTL_RDOFFSOVFL: Attempted increase read offset past write offset.";
// class lfmgr
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2009-01-21 14:58:32 UTC (rev 3059)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2009-01-21 15:42:30 UTC (rev 3060)
@@ -100,7 +100,6 @@
static const u_int32_t JERR_FCNTL_WRITE; ///< Unable to write to file
static const u_int32_t JERR_FCNTL_CLOSE; ///< File close failed
static const u_int32_t JERR_FCNTL_FILEOFFSOVFL; ///< Increased offset past file size
- static const u_int32_t JERR_FCNTL_CMPLOFFSOVFL; ///< Increased cmpl offs past subm offs
static const u_int32_t JERR_FCNTL_RDOFFSOVFL; ///< Increased read offs past write offs
// class lfmgr
16 years
rhmessaging commits: r3059 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-01-21 09:58:32 -0500 (Wed, 21 Jan 2009)
New Revision: 3059
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/rmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
Log:
Further preparation for auto-expand: class emap - changed names using fid to pfid.
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2009-01-20 17:42:23 UTC (rev 3058)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2009-01-21 14:58:32 UTC (rev 3059)
@@ -43,7 +43,7 @@
enq_map::enq_map():
_map(),
- _fid_enq_cnt()
+ _pfid_enq_cnt()
{
pthread_mutex_init(&_mutex, 0);
}
@@ -56,20 +56,20 @@
void
enq_map::set_num_jfiles(const u_int16_t num_jfiles)
{
- _fid_enq_cnt.set_size(num_jfiles);
+ _pfid_enq_cnt.set_size(num_jfiles);
}
void
-enq_map::insert_fid(const u_int64_t rid, const u_int16_t fid)
+enq_map::insert_pfid(const u_int64_t rid, const u_int16_t pfid)
{
- insert_fid(rid, fid, false);
+ insert_pfid(rid, pfid, false);
}
void
-enq_map::insert_fid(const u_int64_t rid, const u_int16_t fid, const bool locked)
+enq_map::insert_pfid(const u_int64_t rid, const u_int16_t pfid, const bool locked)
{
std::pair<emap_itr, bool> ret;
- fid_lock_pair rec(fid, locked);
+ emap_data_struct rec(pfid, locked);
{
slock s(&_mutex);
ret = _map.insert(emap_param(rid, rec));
@@ -77,14 +77,14 @@
if (ret.second == false)
{
std::ostringstream oss;
- oss << std::hex << "rid=0x" << rid << " fid=0x" << fid;
+ oss << std::hex << "rid=0x" << rid << " pfid=0x" << pfid;
throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "enq_map", "insert");
}
- _fid_enq_cnt.incr(fid);
+ _pfid_enq_cnt.incr(pfid);
}
u_int16_t
-enq_map::get_fid(const u_int64_t rid)
+enq_map::get_pfid(const u_int64_t rid)
{
emap_itr itr;
{
@@ -97,17 +97,17 @@
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_fid");
}
- if (itr->second.second) // locked
+ if (itr->second._lock)
{
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "enq_map", "get_fid");
}
- return itr->second.first;
+ return itr->second._pfid;
}
u_int16_t
-enq_map::get_remove_fid(const u_int64_t rid, const bool txn_flag)
+enq_map::get_remove_pfid(const u_int64_t rid, const bool txn_flag)
{
slock s(&_mutex);
emap_itr itr = _map.find(rid);
@@ -117,16 +117,16 @@
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_remove_fid");
}
- if (itr->second.second && !txn_flag) // locked, but not a commit/abort
+ 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_fid");
}
- u_int16_t fid = itr->second.first;
+ u_int16_t pfid = itr->second._pfid;
_map.erase(itr);
- _fid_enq_cnt.decr(fid);
- return fid;
+ _pfid_enq_cnt.decr(pfid);
+ return pfid;
}
bool
@@ -136,7 +136,7 @@
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
return false;
- if (!ignore_lock && itr->second.second) // locked
+ if (!ignore_lock && itr->second._lock) // locked
return false;
return true;
}
@@ -152,7 +152,7 @@
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_remove_fid");
}
- itr->second.second = true;
+ itr->second._lock = true;
}
void
@@ -166,7 +166,7 @@
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_remove_fid");
}
- itr->second.second = false;
+ itr->second._lock = false;
}
bool
@@ -183,7 +183,7 @@
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_fid");
}
- return itr->second.second;
+ return itr->second._lock;
}
void
@@ -204,7 +204,7 @@
{
slock s(&_mutex);
for (emap_itr itr = _map.begin(); itr != _map.end(); itr++)
- fv.push_back(itr->second.first);
+ fv.push_back(itr->second._pfid);
}
}
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2009-01-20 17:42:23 UTC (rev 3058)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2009-01-21 14:58:32 UTC (rev 3059)
@@ -54,47 +54,53 @@
/**
* \class enq_map
- * \brief Class for storing the file id (fid) and a transaction locked flag for each enqueued
+ * \brief Class for storing the physical file id (pfid) and a transaction locked flag for each enqueued
* data block using the record id (rid) as a key. This is the primary mechanism for
- * deterimining the enqueue low water mark: if an fid exists in this map, then there is
+ * deterimining the enqueue low water mark: if a pfid exists in this map, then there is
* at least one still-enqueued record in that file. (The transaction map must also be
* clear, however.)
*
- * Map keying rids against fid and lock status. As records ar enqueued, they are added to this
+ * Map rids against pfid and lock status. As records are enqueued, they are added to this
* map, and as they are dequeued, they are removed. An enqueue is locked when a transactional
- * dequeue is pending that has not been either committed or aborted.
+ * dequeue is pending that has been neither committed nor aborted.
* <pre>
* key data
*
- * rid1 --- [ fid, txn_lock ]
- * rid2 --- [ fid, txn_lock ]
- * rid3 --- [ fid, txn_lock ]
+ * rid1 --- [ pfid, txn_lock ]
+ * rid2 --- [ pfid, txn_lock ]
+ * rid3 --- [ pfid, txn_lock ]
* ...
* </pre>
*/
class enq_map
{
private:
- typedef std::pair<u_int16_t, bool> fid_lock_pair;
- typedef std::pair<u_int64_t, fid_lock_pair> emap_param;
- typedef std::map<u_int64_t, fid_lock_pair> emap;
+
+ struct emap_data_struct
+ {
+ u_int16_t _pfid;
+ bool _lock;
+ emap_data_struct(const u_int16_t pfid, const bool lock) : _pfid(pfid), _lock(lock) {}
+ };
+ typedef std::pair<u_int64_t, emap_data_struct> emap_param;
+ typedef std::map<u_int64_t, emap_data_struct> emap;
typedef emap::iterator emap_itr;
emap _map;
pthread_mutex_t _mutex;
- arr_cnt _fid_enq_cnt;
+ arr_cnt _pfid_enq_cnt;
public:
enq_map();
virtual ~enq_map();
void set_num_jfiles(const u_int16_t num_jfiles);
- inline u_int32_t get_enq_cnt(const u_int16_t fid) const { return _fid_enq_cnt.cnt(fid); };
+ inline u_int32_t get_enq_cnt(const u_int16_t pfid) const { return _pfid_enq_cnt.cnt(pfid); };
- void insert_fid(const u_int64_t rid, const u_int16_t fid);
- void insert_fid(const u_int64_t rid, const u_int16_t fid, const bool locked);
- u_int16_t get_fid(const u_int64_t rid);
- u_int16_t get_remove_fid(const u_int64_t rid, const bool txn_flag = false);
+ 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);
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);
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2009-01-20 17:42:23 UTC (rev 3058)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2009-01-21 14:58:32 UTC (rev 3059)
@@ -696,7 +696,7 @@
std::free(xidp);
}
else
- _emap.insert_fid(h._rid, start_fid);
+ _emap.insert_pfid(h._rid, start_fid);
}
}
break;
@@ -726,7 +726,7 @@
{
try
{
- u_int16_t enq_fid = _emap.get_remove_fid(dr.deq_rid(), true);
+ u_int16_t enq_fid = _emap.get_remove_pfid(dr.deq_rid(), true);
rd._enq_cnt_list[enq_fid]--;
}
catch(const jexception& e)
@@ -784,12 +784,12 @@
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
if (itr->_enq_flag) // txn enqueue
- _emap.insert_fid(itr->_rid, itr->_fid);
+ _emap.insert_pfid(itr->_rid, itr->_fid);
else // txn dequeue
{
try
{
- u_int16_t fid = _emap.get_remove_fid(itr->_drid, true);
+ u_int16_t fid = _emap.get_remove_pfid(itr->_drid, true);
rd._enq_cnt_list[fid]--;
}
catch (const jexception& e)
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2009-01-20 17:42:23 UTC (rev 3058)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2009-01-21 14:58:32 UTC (rev 3059)
@@ -156,7 +156,7 @@
bool is_enq = false;
try
{
- fid = _emap.get_fid(_hdr._rid); // If locked, will throw JERR_MAP_LOCKED
+ fid = _emap.get_pfid(_hdr._rid); // If locked, will throw JERR_MAP_LOCKED
is_enq = true;
}
catch (const jexception& e)
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2009-01-20 17:42:23 UTC (rev 3058)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2009-01-21 14:58:32 UTC (rev 3059)
@@ -195,7 +195,7 @@
_tmap.insert_txn_data(xid, txn_data(rid, 0, dtokp->fid(), true));
}
else
- _emap.insert_fid(rid, dtokp->fid());
+ _emap.insert_pfid(rid, dtokp->fid());
done = true;
}
@@ -334,7 +334,7 @@
}
else
{
- u_int16_t fid = _emap.get_remove_fid(dtokp->dequeue_rid());
+ u_int16_t fid = _emap.get_remove_pfid(dtokp->dequeue_rid());
_wrfc.decr_enqcnt(fid);
}
@@ -597,10 +597,10 @@
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
if (itr->_enq_flag) // txn enqueue
- _emap.insert_fid(itr->_rid, itr->_fid);
+ _emap.insert_pfid(itr->_rid, itr->_fid);
else // txn dequeue
{
- u_int16_t fid = _emap.get_remove_fid(itr->_drid, true);
+ u_int16_t fid = _emap.get_remove_pfid(itr->_drid, true);
_wrfc.decr_enqcnt(fid);
}
}
@@ -1004,7 +1004,7 @@
bool found = false;
try
{
- _emap.get_fid(drid);
+ _emap.get_pfid(drid);
found = true;
}
catch(const jexception& e)
Modified: store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2009-01-20 17:42:23 UTC (rev 3058)
+++ store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2009-01-21 14:58:32 UTC (rev 3059)
@@ -53,17 +53,17 @@
QPID_AUTO_TEST_CASE(insert_get)
{
cout << test_filename << ".insert_get: " << flush;
- u_int16_t fid;
+ u_int16_t pfid;
u_int64_t rid;
- u_int16_t fid_start = 0x2000U;
+ u_int16_t pfid_start = 0x2000U;
u_int64_t rid_begin = 0xffffffff00000000ULL;
u_int64_t rid_end = 0xffffffff00000200ULL;
// insert with no dups
u_int64_t rid_incr_1 = 4ULL;
enq_map e2;
- for (rid = rid_begin, fid = fid_start; rid < rid_end; rid += rid_incr_1, fid++)
- e2.insert_fid(rid, fid);
+ for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1, pfid++)
+ e2.insert_pfid(rid, pfid);
BOOST_CHECK(!e2.empty());
BOOST_CHECK_EQUAL(e2.size(), u_int32_t(128));
@@ -74,9 +74,9 @@
BOOST_CHECK_EQUAL(e2.is_enqueued(rid), (rid%rid_incr_1 ? false : true));
try
{
- u_int16_t exp_fid = fid_start + (u_int16_t)((rid - rid_begin)/rid_incr_1);
- u_int16_t ret_fid = e2.get_fid(rid);
- BOOST_CHECK_EQUAL(ret_fid, exp_fid);
+ 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, exp_pfid);
BOOST_CHECK(rid%rid_incr_1 == 0);
}
catch (const jexception& e)
@@ -85,15 +85,15 @@
BOOST_CHECK(rid%rid_incr_1);
}
if ((rid + rid_incr_2)%(8 * rid_incr_2) == 0)
- fid++;
+ pfid++;
}
// insert with dups
- for (rid = rid_begin, fid = fid_start; rid < rid_end; rid += rid_incr_2, fid++)
+ for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_2, pfid++)
{
try
{
- e2.insert_fid(rid, fid);
+ e2.insert_pfid(rid, pfid);
BOOST_CHECK(rid%rid_incr_1);
}
catch (const jexception& e)
@@ -112,27 +112,27 @@
QPID_AUTO_TEST_CASE(get_remove)
{
cout << test_filename << ".get_remove: " << flush;
- u_int16_t fid;
+ u_int16_t pfid;
u_int64_t rid;
- u_int16_t fid_start = 0x3000U;
+ u_int16_t pfid_start = 0x3000U;
u_int64_t rid_begin = 0xeeeeeeee00000000ULL;
u_int64_t rid_end = 0xeeeeeeee00000200ULL;
u_int64_t rid_incr_1 = 4ULL;
u_int64_t num_incr_1 = (rid_end - rid_begin)/rid_incr_1;
enq_map e3;
- for (rid = rid_begin, fid = fid_start; rid < rid_end; rid += rid_incr_1, fid++)
- e3.insert_fid(rid, fid);
+ for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1, pfid++)
+ e3.insert_pfid(rid, pfid);
BOOST_CHECK_EQUAL(e3.size(), num_incr_1);
u_int64_t rid_incr_2 = 6ULL;
- for (rid = rid_begin, fid = fid_start; rid < rid_end; rid += rid_incr_2, fid++)
+ for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_2, pfid++)
{
try
{
- u_int16_t exp_fid = fid_start + (u_int16_t)((rid - rid_begin)/rid_incr_1);
- u_int16_t ret_fid = e3.get_remove_fid(rid);
- BOOST_CHECK_EQUAL(ret_fid, exp_fid);
+ 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, exp_pfid);
BOOST_CHECK(rid%rid_incr_1 == 0);
}
catch (const jexception& e)
@@ -148,9 +148,9 @@
QPID_AUTO_TEST_CASE(lock)
{
cout << test_filename << ".lock: " << flush;
- u_int16_t fid;
+ u_int16_t pfid;
u_int64_t rid;
- u_int16_t fid_start = 0x4000U;
+ u_int16_t pfid_start = 0x4000U;
u_int64_t rid_begin = 0xdddddddd00000000ULL;
u_int64_t rid_end = 0xdddddddd00000200ULL;
@@ -159,9 +159,9 @@
u_int64_t num_incr_1 = (rid_end - rid_begin)/rid_incr_1;
bool locked = false;
enq_map e4;
- for (rid = rid_begin, fid = fid_start; rid < rid_end; rid += rid_incr_1, fid++)
+ for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1, pfid++)
{
- e4.insert_fid(rid, fid, locked);
+ e4.insert_pfid(rid, pfid, locked);
locked = !locked;
}
BOOST_CHECK_EQUAL(e4.size(), num_incr_1);
@@ -183,18 +183,18 @@
// get / unlock
for (u_int64_t rid = rid_begin; rid < rid_end; rid += rid_incr_1)
{
- try { e4.get_fid(rid); }
+ try { e4.get_pfid(rid); }
catch(const jexception& e)
{
BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_LOCKED);
BOOST_CHECK(rid%(2*rid_incr_1));
// unlock, read, then relock
e4.unlock(rid);
- e4.get_fid(rid);
+ e4.get_pfid(rid);
e4.lock(rid);
try
{
- e4.get_fid(rid);
+ e4.get_pfid(rid);
BOOST_ERROR("Failed to throw exception when getting locked record");
}
catch(const jexception& e)
@@ -206,7 +206,7 @@
// 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_fid(rid, true);
+ e4.get_remove_pfid(rid, true);
BOOST_CHECK(e4.empty());
cout << "ok" << endl;
}
@@ -214,9 +214,9 @@
QPID_AUTO_TEST_CASE(lists)
{
cout << test_filename << ".lists: " << flush;
- u_int16_t fid;
+ u_int16_t pfid;
u_int64_t rid;
- u_int16_t fid_start = 0x5000UL;
+ u_int16_t pfid_start = 0x5000UL;
u_int64_t rid_begin = 0xdddddddd00000000ULL;
u_int64_t rid_end = 0xdddddddd00000200ULL;
@@ -226,11 +226,11 @@
vector<u_int64_t> rid_list;
vector<u_int16_t> fid_list;
enq_map e5;
- for (rid = rid_begin, fid = fid_start; rid < rid_end; rid += rid_incr_1, fid++)
+ for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1, pfid++)
{
- e5.insert_fid(rid, fid);
+ e5.insert_pfid(rid, pfid);
rid_list.push_back(rid);
- fid_list.push_back(fid);
+ fid_list.push_back(pfid);
}
BOOST_CHECK_EQUAL(e5.size(), num_incr_1);
BOOST_CHECK_EQUAL(rid_list.size(), num_incr_1);
@@ -263,37 +263,37 @@
e6.set_num_jfiles(4);
// Add 100 enqueues to file 1, check that the counts match
- for (u_int16_t fid=0; fid<4; fid++)
- BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(0));
+ 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_fid(rid, 1);
- for (u_int16_t fid=0; fid<4; fid++)
+ e6.insert_pfid(rid, 1);
+ for (u_int16_t pfid=0; pfid<4; pfid++)
{
- if (fid == 1)
- BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(100));
+ if (pfid == 1)
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(pfid), u_int32_t(100));
else
- BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(0));
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(pfid), u_int32_t(0));
}
// Now remove 10 from file 1, check that the counts match
for (u_int64_t rid=0; rid<100; rid+=10)
- e6.get_remove_fid(rid);
- for (u_int16_t fid=0; fid<4; fid++)
+ e6.get_remove_pfid(rid);
+ for (u_int16_t pfid=0; pfid<4; pfid++)
{
- if (fid == 1)
- BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(90));
+ if (pfid == 1)
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(pfid), u_int32_t(90));
else
- BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(0));
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(pfid), u_int32_t(0));
}
// Now resize the file up and make sure the count in file 1 still exists
e6.set_num_jfiles(8);
- for (u_int16_t fid=0; fid<8; fid++)
+ for (u_int16_t pfid=0; pfid<8; pfid++)
{
- if (fid == 1)
- BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(90));
+ if (pfid == 1)
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(pfid), u_int32_t(90));
else
- BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(0));
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(pfid), u_int32_t(0));
}
cout << "ok" << endl;
@@ -311,17 +311,17 @@
// 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_fid(rid, u_int16_t(0));
+ e7.insert_pfid(rid, u_int16_t(0));
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_fid(rid, u_int16_t(0));
+ e7.insert_pfid(rid, u_int16_t(0));
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_fid(rid);
+ e7.get_remove_pfid(rid);
BOOST_CHECK_EQUAL(e7.size(), num_rid);
cout << "ok" << endl;
16 years