rhmessaging commits: r998 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-10 13:04:51 -0400 (Wed, 10 Oct 2007)
New Revision: 998
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/widgets.py
Log:
Adds an all-servers link to the browser. Makes link and mlink a
little more generic.
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-10 16:02:30 UTC (rev 997)
+++ mgmt/cumin/python/cumin/page.py 2007-10-10 17:04:51 UTC (rev 998)
@@ -218,6 +218,13 @@
def render_title(self, session, model):
return "Servers (%i)" % len(model.get_servers())
+ def render_show_all_link(self, session, model):
+ class_ = self.param.get(session) is None and "selected"
+
+ branch = session.branch()
+ self.param.set(branch, None)
+ return link(branch.marshal(), "Show All", class_)
+
class BrowserGroups(ItemSet):
def __init__(self, app, name):
super(ServerBrowser.BrowserGroups, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-10 16:02:30 UTC (rev 997)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-10 17:04:51 UTC (rev 998)
@@ -422,6 +422,10 @@
[ServerBrowser.html]
<div class="ServerBrowser groups">
-{groups}
+ {show_all_link}
+
+ <br/><br/>
+
+ {groups}
</div>
<div class="ServerBrowser servers">{servers}</div>
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-10 16:02:30 UTC (rev 997)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-10 17:04:51 UTC (rev 998)
@@ -4,12 +4,12 @@
strings = StringCatalog(__file__)
-def link(href, name):
- return "<a href=\"%s\">%s</a>" % (href, name)
+def link(href, content, class_=""):
+ return "<a %s href=\"%s\">%s</a>" % \
+ (class_ and "class=\"%s\"" % class_ or "", href, content)
def mlink(href, variety, name, selected=False):
- return "<a %s href=\"%s\">%s</a>" % \
- (selected and "class=\"selected\"" or "", href, name)
+ return link(href, name, selected and "selected")
def none():
return "<span class=\"none\">None</span>"
17 years, 2 months
rhmessaging commits: r997 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-10 12:02:30 -0400 (Wed, 10 Oct 2007)
New Revision: 997
Modified:
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/widgets.py
Log:
Adds a server group type object for describing groups in different
dimensions. Adds a preliminary version of server browser-style
interface that uses types and groups. Extends mlink a little for use
in selection lists.
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-10 14:38:09 UTC (rev 996)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-10 16:02:30 UTC (rev 997)
@@ -14,23 +14,24 @@
def load(self):
# XXX need some locking in here
+ sgtypes = dict()
sgroups = dict()
for name in ("Geography", "Department"):
- sgroup = ServerGroup(self.model)
- sgroup.name = name
- sgroups[name] = sgroup
+ sgtype = ServerGroupType(self.model)
+ sgtype.name = name
+ sgtypes[name] = sgtype
for name in ("West Coast", "East Coast"):
sgroup = ServerGroup(self.model)
sgroup.name = name
- sgroups["Geography"].add_child(sgroup)
+ sgroup.set_type(sgtypes["Geography"])
sgroups[name] = sgroup
for name in ("Marketing", "Sales"):
sgroup = ServerGroup(self.model)
sgroup.name = name
- sgroups["Department"].add_child(sgroup)
+ sgroup.set_type(sgtypes["Department"])
sgroups[name] = sgroup
# vhost templates
@@ -71,6 +72,11 @@
else:
sgroups["West Coast"].add_server(server)
+ if server_count % 4 < 2:
+ sgroups["Marketing"].add_server(server)
+ else:
+ sgroups["Sales"].add_server(server)
+
vhost = VirtualHost(self.model)
vhost.name = "default"
vhost.set_server(server)
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-10 14:38:09 UTC (rev 996)
+++ mgmt/cumin/python/cumin/model.py 2007-10-10 16:02:30 UTC (rev 997)
@@ -8,6 +8,7 @@
self.cluster = ModelClass(self, "cluster")
self.server = ModelClass(self, "server")
self.server_group = ModelClass(self, "server_group")
+ self.server_group_type = ModelClass(self, "server_group_type")
self.virtual_host = ModelClass(self, "virtual_host")
self.virtual_host_group = ModelClass(self, "virtual_host_group")
self.queue = ModelClass(self, "queue")
@@ -31,6 +32,10 @@
assoc.add_endpoint(self.server, "server_group", "0..n")
assoc.add_endpoint(self.server_group, "server", "0..n")
+ assoc = ModelAssociation(self, "server_groups_to_server_group_type")
+ assoc.add_endpoint(self.server_group_type, "server_group", "0..n")
+ assoc.add_endpoint(self.server_group, "type", "0..1")
+
assoc = ModelAssociation(self, "server_groups_to_server_groups")
assoc.add_endpoint(self.server_group, "parent", "0..n")
assoc.add_endpoint(self.server_group, "child", "0..n")
@@ -89,6 +94,12 @@
def get_server_groups(self):
return self.get_index(self.server_group).values()
+
+ def get_server_group_type(self, id):
+ return self.get_index(self.server_group_type).get(id)
+
+ def get_server_group_types(self):
+ return self.get_index(self.server_group_type).values()
def get_virtual_host(self, id):
return self.get_index(self.virtual_host).get(id)
@@ -145,6 +156,12 @@
self.name = None
+class ServerGroupType(ModelObject):
+ def __init__(self, model):
+ super(ServerGroupType, self).__init__(model, model.server_group_type)
+
+ self.name = None
+
class VirtualHost(ModelObject):
def __init__(self, model):
super(VirtualHost, self).__init__(model, model.virtual_host)
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-10 14:38:09 UTC (rev 996)
+++ mgmt/cumin/python/cumin/page.py 2007-10-10 16:02:30 UTC (rev 997)
@@ -172,7 +172,7 @@
self.groups = ServerGroupTree(app, "groups")
self.add_child(self.groups)
- self.servers = ServerSet(app, "servers")
+ self.servers = ServerBrowser(app, "servers")
self.add_child(self.servers)
def render_title(self, session, model):
@@ -201,3 +201,58 @@
def render_title(self, session, model):
return "Templates (%i)" % \
len(model.get_virtual_host_templates())
+
+class ServerBrowser(Widget):
+ def __init__(self, app, name):
+ super(ServerBrowser, self).__init__(app, name)
+
+ self.param = ServerGroupParameter(app, "param")
+ self.add_parameter(self.param)
+
+ self.groups = self.BrowserGroups(app, "groups")
+ self.add_child(self.groups)
+
+ self.servers = self.BrowserServers(app, "servers")
+ self.add_child(self.servers)
+
+ def render_title(self, session, model):
+ return "Servers (%i)" % len(model.get_servers())
+
+ class BrowserGroups(ItemSet):
+ def __init__(self, app, name):
+ super(ServerBrowser.BrowserGroups, self).__init__(app, name)
+
+ def get_items(self, session, model):
+ return sorted(model.get_server_groups(), cmp, lambda x: x.name)
+
+ def render_items(self, session, model):
+ writer = Writer()
+
+ last_type = None
+ groups = self.get_items(session, model)
+
+ if groups:
+ for group in groups:
+ if group.get_type() is not last_type:
+ pass
+
+ self.item_tmpl.render(session, group, writer)
+
+ return writer.to_string()
+
+ def render_item_content(self, session, group):
+ branch = session.branch()
+ self.parent.param.set(branch, group)
+
+ selected = self.parent.param.get(session) is group
+
+ return mlink(branch.marshal(), "ServerGroup", group.name, selected)
+
+ class BrowserServers(ServerSet):
+ def get_items(self, session, model):
+ group = self.parent.param.get(session)
+
+ if group:
+ return sorted(group.server_items(), cmp, lambda x: x.name)
+ else:
+ return sorted(model.get_servers(), cmp, lambda x: x.name)
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-10 14:38:09 UTC (rev 996)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-10 16:02:30 UTC (rev 997)
@@ -26,10 +26,20 @@
color: #06c;
}
+a.selected {
+ color: black;
+}
+
ul {
list-style: none;
+ padding: 0;
+ margin: 0;
}
+ul > ul {
+ padding: 1em;
+}
+
span.none {
font-style: italic;
color: #999;
@@ -399,3 +409,19 @@
<td>10 queues, 5 exchanges</td>
<td><a class="action" href="">Remove</a></td>
</tr>
+
+[ServerBrowser.css]
+.ServerBrowser.groups {
+ float: left;
+ width: 20%;
+}
+
+.ServerBrowser.servers {
+ width: 80%;
+}
+
+[ServerBrowser.html]
+<div class="ServerBrowser groups">
+{groups}
+</div>
+<div class="ServerBrowser servers">{servers}</div>
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-10 14:38:09 UTC (rev 996)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-10 16:02:30 UTC (rev 997)
@@ -7,8 +7,9 @@
def link(href, name):
return "<a href=\"%s\">%s</a>" % (href, name)
-def mlink(href, variety, name):
- return "<a href=\"%s\">%s</a>" % (href, name)
+def mlink(href, variety, name, selected=False):
+ return "<a %s href=\"%s\">%s</a>" % \
+ (selected and "class=\"selected\"" or "", href, name)
def none():
return "<span class=\"none\">None</span>"
17 years, 2 months
rhmessaging commits: r996 - in store/trunk/cpp: lib/jrnl and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-10-10 10:38:09 -0400 (Wed, 10 Oct 2007)
New Revision: 996
Modified:
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/JournalImpl.h
store/trunk/cpp/lib/jrnl/data_tok.hpp
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/rrfc.hpp
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/JournalSystemTests.cpp
store/trunk/cpp/tests/jrnl/rtest
Log:
Added transaction handling. Only recover now remains incomplete to get transactions done.
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -33,3 +33,16 @@
JournalImpl::~JournalImpl()
{}
+
+void
+JournalImpl::recover(std::deque<journal::data_tok*>* rd_dtokl, const journal::aio_cb rd_cb,
+ std::deque<journal::data_tok*>* wr_dtokl, const journal::aio_cb wr_cb,
+ boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list) throw (journal::jexception)
+{
+ // Create list of prepared xids
+ std::vector<std::string> prep_xid_list;
+ for (bdbstore::PreparedTransaction::list::iterator i = prep_tx_list.begin();
+ i != prep_tx_list.end(); i++)
+ prep_xid_list.push_back(i->xid);
+ journal::jcntl::recover(rd_dtokl, rd_cb, wr_dtokl, wr_cb, prep_xid_list);
+}
Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/JournalImpl.h 2007-10-10 14:38:09 UTC (rev 996)
@@ -25,6 +25,9 @@
#define _JournalImpl_
#include "jrnl/jcntl.hpp"
+#include "jrnl/data_tok.hpp"
+#include "PreparedTransaction.h"
+#include <boost/ptr_container/ptr_list.hpp>
namespace rhm {
namespace bdbstore {
@@ -36,6 +39,17 @@
const std::string& journalDirectory,
const std::string& journalBaseFilename);
~JournalImpl();
+ void recover(std::deque<journal::data_tok*>* rd_dtokl, const journal::aio_cb rd_cb,
+ std::deque<journal::data_tok*>* wr_dtokl, const journal::aio_cb wr_cb,
+ boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list)
+ throw (journal::jexception);
+
+ void recover(boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list)
+ throw (journal::jexception)
+ {
+ recover(&_aio_rd_cmpl_dtok_list, &aio_rd_callback, &_aio_wr_cmpl_dtok_list,
+ &aio_wr_callback, prep_tx_list);
+ }
};
} // namespace bdbstore
Modified: store/trunk/cpp/lib/jrnl/data_tok.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/data_tok.hpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/data_tok.hpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -108,6 +108,7 @@
size_t _dsize; ///< Data size in bytes
u_int32_t _dblks_written; ///< Data blocks read/written
u_int32_t _dblks_read; ///< Data blocks read/written
+ u_int16_t _fid; ///< FID containing header of enqueue record
u_int64_t _rid; ///< RID of data set by enqueue operation
std::string _xid; ///< XID set by enqueue operation
u_int64_t _dequeue_rid; ///< RID of data set by dequeue operation
@@ -146,6 +147,8 @@
inline void incr_dblocks_read(u_int32_t dblks_read) { _dblks_read += dblks_read; }
inline void set_dblocks_read(u_int32_t dblks_read) { _dblks_read = dblks_read; }
+ inline const u_int16_t fid() const { return _fid; }
+ inline void set_fid(const u_int16_t fid) { _fid = fid; }
inline const u_int64_t rid() const { return _rid; }
inline void set_rid(const u_int64_t rid) { _rid = rid; }
inline const u_int64_t dequeue_rid() const throw (jexception) {return _dequeue_rid; }
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -120,7 +120,7 @@
}
void
-enq_map::lock(const u_int64_t rid)
+enq_map::lock(const u_int64_t rid) throw (jexception)
{
pthread_mutex_lock(&_mutex);
emap_itr itr = _map.find(rid);
@@ -136,7 +136,7 @@
}
void
-enq_map::unlock(const u_int64_t rid)
+enq_map::unlock(const u_int64_t rid) throw (jexception)
{
pthread_mutex_lock(&_mutex);
emap_itr itr = _map.find(rid);
@@ -152,7 +152,7 @@
}
const bool
-enq_map::is_locked(const u_int64_t rid)
+enq_map::is_locked(const u_int64_t rid) throw (jexception)
{
pthread_mutex_lock(&_mutex);
emap_itr itr = _map.find(rid);
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -75,9 +75,9 @@
void insert_fid(const u_int64_t rid, const u_int16_t fid, bool locked) throw (jexception);
const u_int16_t get_fid(const u_int64_t rid) throw (jexception);
const u_int16_t get_remove_fid(const u_int64_t rid) throw (jexception);
- void lock(const u_int64_t rid);
- void unlock(const u_int64_t rid);
- const bool is_locked(const u_int64_t rid);
+ void lock(const u_int64_t rid) throw (jexception);
+ void unlock(const u_int64_t rid) throw (jexception);
+ const bool is_locked(const u_int64_t rid) throw (jexception);
inline void clear() { _map.clear(); }
inline const bool empty() const { return _map.empty(); }
inline const u_int16_t size() const { return (u_int16_t)_map.size(); }
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -123,21 +123,14 @@
void
jcntl::recover(std::deque<data_tok*>* rd_dtokl, const aio_cb rd_cb, std::deque<data_tok*>* wr_dtokl,
- const aio_cb wr_cb, boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list)
- throw (jexception)
+ const aio_cb wr_cb, const std::vector<std::string>& prep_txn_list) throw (jexception)
{
- // Create list of prepared xids
- std::set<std::string> prep_xid_list;
- for (bdbstore::PreparedTransaction::list::iterator i = prep_tx_list.begin();
- i != prep_tx_list.end(); i++);
-// TODO!
-// prep_xid_list.insert(i->??);
-
// Verify journal dir and journal files
_jdir.verify_dir();
_rcvdat.reset();
_emap.clear();
- rcvr_janalyze(_rcvdat);
+ _tmap.clear();
+ rcvr_janalyze(_rcvdat, prep_txn_list);
if (_datafh)
{
@@ -354,7 +347,7 @@
}
void
-jcntl::rcvr_janalyze(rcvdat& rd) throw (jexception)
+jcntl::rcvr_janalyze(rcvdat& rd, const std::vector<std::string>& prep_txn_list) throw (jexception)
{
jinf ji(_jdir.dirname() + "/" + _base_filename + "." + JRNL_INFO_EXTENSION, true);
try
@@ -367,7 +360,6 @@
if (e.err_code() != jerrno::JERR_JINF_JDATEMPTY)
throw e;
}
-//std::cout << "f" << rd._ffid << (rd._empty?"e":"") << " ";
// Restore all read and write pointers
if (!rd._empty)
@@ -376,13 +368,14 @@
for (u_int16_t fnum=0; fnum<JRNL_NUM_FILES && !eoj; fnum++)
{
u_int16_t fid = (fnum + rd._ffid) % JRNL_NUM_FILES;
- eoj = rcvr_fanalyze(fid, rd);
+ eoj = rcvr_fanalyze(fid, rd, prep_txn_list);
}
}
}
const bool
-jcntl::rcvr_fanalyze(u_int16_t fid, rcvdat& rd) throw (jexception)
+jcntl::rcvr_fanalyze(u_int16_t fid, rcvdat& rd, const std::vector<std::string>& /*prep_txn_list*/)
+ throw (jexception)
{
bool eoj = false;
std::stringstream ss;
@@ -466,6 +459,12 @@
jifs.seekg(foffs);
}
break;
+ case RHM_JDAT_TXA_MAGIC:
+//std::cout << " a";
+ break;
+ case RHM_JDAT_TXC_MAGIC:
+//std::cout << " c";
+ break;
case RHM_JDAT_EMPTY_MAGIC:
{
//std::cout << " x";
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -49,8 +49,6 @@
#include <jrnl/wmgr.hpp>
#include <jrnl/wrfc.hpp>
#include <qpid/broker/PersistableQueue.h>
-#include <PreparedTransaction.h>
-#include <boost/ptr_container/ptr_list.hpp>
namespace rhm
{
@@ -69,7 +67,7 @@
*/
class jcntl : public qpid::broker::ExternalQueueStore
{
- private:
+ protected:
/**
* \brief Journal ID
*
@@ -226,7 +224,7 @@
*/
void recover(std::deque<data_tok*>* rd_dtokl, const aio_cb rd_cb,
std::deque<data_tok*>* wr_dtokl, const aio_cb wr_cb,
- boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list) throw (jexception);
+ const std::vector<std::string>& prep_txn_list) throw (jexception);
/**
* \brief Recover using internal default callbacks and data_tok lists.
@@ -235,11 +233,10 @@
*
* \exception TODO
*/
- void recover(boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list)
- throw (jexception)
+ void recover(const std::vector<std::string>& prep_txn_list) throw (jexception)
{
recover(&_aio_rd_cmpl_dtok_list, &aio_rd_callback, &_aio_wr_cmpl_dtok_list,
- &aio_wr_callback, prep_tx_list);
+ &aio_wr_callback, prep_txn_list);
}
/**
@@ -590,7 +587,7 @@
- private:
+ protected:
/**
* \brief Check status of journal before allowing write operations.
*/
@@ -614,14 +611,16 @@
/**
* \brief Analyze journal for recovery.
*/
- void rcvr_janalyze(rcvdat& jrs) throw (jexception);
+ void rcvr_janalyze(rcvdat& jrs, const std::vector<std::string>& prep_txn_list)
+ throw (jexception);
/**
* \brief Analyze a particular journal file for recovery.
*
* \return <b><i>true</i></b> if end of journal (eoj) found; <b><i>false</i></b> otherwise.
*/
- const bool rcvr_fanalyze(u_int16_t fid, rcvdat& jrs) throw (jexception);
+ const bool rcvr_fanalyze(u_int16_t fid, rcvdat& jrs,
+ const std::vector<std::string>& prep_txn_list) throw (jexception);
/**
* Intenal callback write
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -295,6 +295,19 @@
if (is_enq) // ok, this record is enqueued, check it, then read it...
{
//std::cout << "e" << std::flush;
+#if !(defined(RHM_WRONLY) || defined(RHM_RDONLY))
+ // Is this locked by a pending dequeue transaction?
+ try
+ {
+ if (_emap.is_locked(_hdr._rid))
+ return RHM_IORES_TXPENDING;
+ }
+ catch (jexception e)
+ {
+ if (e.err_code() != jerrno::JERR_MAP_NOTFOUND)
+ throw e;
+ }
+#endif
if (dtokp->rid())
{
if (_hdr._rid != dtokp->rid())
Modified: store/trunk/cpp/lib/jrnl/rrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.hpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/rrfc.hpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -104,7 +104,10 @@
inline const int fh() const { return _curr_fh->rd_fh(); }
inline const u_int32_t enqcnt() const { return _curr_fh->enqcnt(); }
inline const u_int32_t incr_enqcnt() { return _curr_fh->incr_enqcnt(); }
+ inline const u_int32_t incr_enqcnt(u_int16_t fid) { return _fh_arr[fid]->incr_enqcnt(); }
inline const u_int32_t add_enqcnt(u_int32_t a) { return _curr_fh->add_enqcnt(a); }
+ inline const u_int32_t add_enqcnt(u_int16_t fid, u_int32_t a)
+ { return _fh_arr[fid]->add_enqcnt(a); }
inline const u_int32_t decr_enqcnt(u_int16_t fid) { return _fh_arr[fid]->decr_enqcnt(); }
inline const u_int32_t subtr_enqcnt(u_int16_t fid, u_int32_t s)
{ return _fh_arr[fid]->subtr_enqcnt(s); }
Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -41,6 +41,12 @@
namespace journal
{
+txn_data_struct::txn_data_struct(const u_int64_t rid, const u_int16_t fid, const bool enq_flag):
+ _rid(rid),
+ _fid(fid),
+ _enq_flag(enq_flag)
+{}
+
txn_map::txn_map():
_map()
{
@@ -53,25 +59,24 @@
}
void
-txn_map::insert_rid_fid(const std::string& xid, const u_int64_t rid, const u_int16_t fid)
- throw (jexception)
+txn_map::insert_txn_data(const std::string& xid, const txn_data& td) throw (jexception)
{
- rid_fid_pair rec(rid, fid);
pthread_mutex_lock(&_mutex);
xmap_itr itr = _map.find(xid);
pthread_mutex_unlock(&_mutex);
if (itr == _map.end()) // not found in map
{
- rid_fid_list list;
- list.push_back(rec);
+ txn_data_list list;
+ list.push_back(td);
std::pair<xmap_itr, bool> ret = _map.insert(xmap_param(xid, list));
+ // TODO: check for failure here?
}
else
- itr->second.push_back(rec);
+ itr->second.push_back(td);
}
-const txn_map::rid_fid_list
-txn_map::get_rid_fid_list(const std::string& xid) throw (jexception)
+const txn_data_list
+txn_map::get_tdata_list(const std::string& xid) throw (jexception)
{
pthread_mutex_lock(&_mutex);
xmap_itr itr = _map.find(xid);
@@ -85,8 +90,8 @@
return itr->second;
}
-const txn_map::rid_fid_list
-txn_map::get_remove_rid_fid_list(const std::string& xid) throw (jexception)
+const txn_data_list
+txn_map::get_remove_tdata_list(const std::string& xid) throw (jexception)
{
pthread_mutex_lock(&_mutex);
xmap_itr itr = _map.find(xid);
@@ -97,7 +102,7 @@
ss << std::hex << "xid=\"" << xid << "\"";
throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "txn_map", "get_remove_fid");
}
- rid_fid_list list = itr->second;
+ txn_data_list list = itr->second;
_map.erase(itr);
pthread_mutex_unlock(&_mutex);
return list;
Modified: store/trunk/cpp/lib/jrnl/txn_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.hpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/txn_map.hpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -42,7 +42,6 @@
}
#include <map>
-#include <list>
#include <pthread.h>
#include <vector>
#include <jrnl/jexception.hpp>
@@ -52,15 +51,22 @@
namespace journal
{
+ struct txn_data_struct
+ {
+ u_int64_t _rid;
+ u_int16_t _fid;
+ bool _enq_flag;
+ txn_data_struct(const u_int64_t rid, const u_int16_t fid, const bool enq_flag);
+ };
+ typedef txn_data_struct txn_data;
+ typedef std::vector<txn_data> txn_data_list;
+ typedef txn_data_list::iterator tdl_itr;
+
class txn_map
{
- public:
- typedef std::pair<u_int64_t, u_int16_t> rid_fid_pair;
- typedef std::list<rid_fid_pair> rid_fid_list;
-
private:
- typedef std::pair<std::string, rid_fid_list> xmap_param;
- typedef std::map<std::string, rid_fid_list> xmap;
+ typedef std::pair<std::string, txn_data_list> xmap_param;
+ typedef std::map<std::string, txn_data_list> xmap;
typedef xmap::iterator xmap_itr;
xmap _map;
@@ -70,10 +76,9 @@
txn_map();
~txn_map();
- void insert_rid_fid(const std::string& xid, const u_int64_t rid, const u_int16_t fid)
- throw (jexception);
- const rid_fid_list get_rid_fid_list(const std::string& xid) throw (jexception);
- const rid_fid_list get_remove_rid_fid_list(const std::string& xid) throw (jexception);
+ void insert_txn_data(const std::string& xid, const txn_data& td) throw (jexception);
+ const txn_data_list get_tdata_list(const std::string& xid) throw (jexception);
+ const txn_data_list get_remove_tdata_list(const std::string& xid) throw (jexception);
const u_int32_t get_rid_count(const std::string& xid) throw (jexception);
inline void clear() { _map.clear(); }
inline const bool empty() const { return _map.empty(); }
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -141,13 +141,10 @@
u_int32_t data_offs_dblks = dtokp->dblocks_written();
u_int32_t ret = _enq_rec.encode(wptr, data_offs_dblks,
(JRNL_WMGR_PAGE_SIZE * JRNL_SBLK_SIZE) - _pg_offset_dblks);
-#if !(defined(RHM_WRONLY) || defined(RHM_RDONLY))
+
+ // Remember fid which contains the record header in case record is split over several files
if (data_offs_dblks == 0)
- {
- _wrfc.incr_enqcnt();
- _emap.insert_fid(rid, _wrfc.index());
- }
-#endif
+ dtokp->set_fid(_wrfc.index());
_pg_offset_dblks += ret;
_cached_offset_dblks += ret;
dtokp->incr_dblocks_written(ret);
@@ -163,6 +160,18 @@
// message. AIO callbacks will then only process this token when entire message is
// enqueued.
_page_cb_arr[_pg_index]._pdtokl->push_back(dtokp);
+ _wrfc.incr_enqcnt(dtokp->fid());
+
+#if !(defined(RHM_WRONLY) || defined(RHM_RDONLY))
+ if (xid_len) // If part of transaction, add to transaction map
+ {
+ std::string xid((char*)xid_ptr, xid_len);
+ _tmap.insert_txn_data(xid, txn_data(rid, dtokp->fid(), true));
+ }
+ else
+ _emap.insert_fid(rid, dtokp->fid());
+#endif
+
done = true;
}
@@ -263,13 +272,10 @@
u_int32_t data_offs_dblks = dtokp->dblocks_written();
u_int32_t ret = _deq_rec.encode(wptr, data_offs_dblks,
(JRNL_WMGR_PAGE_SIZE * JRNL_SBLK_SIZE) - _pg_offset_dblks);
-#if !(defined(RHM_WRONLY) || defined(RHM_RDONLY))
+
+ // Remember fid which contains the record header in case record is split over several files
if (data_offs_dblks == 0)
- {
- u_int16_t fid = _emap.get_remove_fid(dtokp->rid());
- _wrfc.decr_enqcnt(fid);
- }
-#endif
+ dtokp->set_fid(_wrfc.index());
_pg_offset_dblks += ret;
_cached_offset_dblks += ret;
dtokp->incr_dblocks_written(ret);
@@ -280,6 +286,23 @@
// TODO: Incorrect - must set state to ENQ_CACHED; ENQ_SUBM is set when AIO returns.
dtokp->set_wstate(data_tok::DEQ_SUBM);
_page_cb_arr[_pg_index]._pdtokl->push_back(dtokp);
+
+#if !(defined(RHM_WRONLY) || defined(RHM_RDONLY))
+ 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(rid); }
+ catch(jexception e) { if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw e; }
+ std::string xid((char*)xid_ptr, xid_len);
+ _tmap.insert_txn_data(xid, txn_data(rid, dtokp->fid(), false));
+ }
+ else
+ {
+ u_int16_t fid = _emap.get_remove_fid(dtokp->rid());
+ _wrfc.decr_enqcnt(fid);
+ }
+#endif
+
done = true;
}
@@ -377,6 +400,10 @@
u_int32_t data_offs_dblks = dtokp->dblocks_written();
u_int32_t ret = _txn_rec.encode(wptr, data_offs_dblks,
(JRNL_WMGR_PAGE_SIZE * JRNL_SBLK_SIZE) - _pg_offset_dblks);
+
+ // Remember fid which contains the record header in case record is split over several files
+ if (data_offs_dblks == 0)
+ dtokp->set_fid(_wrfc.index());
_pg_offset_dblks += ret;
_cached_offset_dblks += ret;
dtokp->incr_dblocks_written(ret);
@@ -386,6 +413,20 @@
{
dtokp->set_wstate(data_tok::ABORT_SUBM);
_page_cb_arr[_pg_index]._pdtokl->push_back(dtokp);
+
+#if !(defined(RHM_WRONLY) || defined(RHM_RDONLY))
+ // Delete this txn from tmap, unlock any locked records in emap
+ std::string xid((char*)xid_ptr, xid_len);
+ txn_data_list tdl = _tmap.get_remove_tdata_list(xid);
+ for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
+ {
+ try { _emap.unlock(itr->_rid); }
+ catch(jexception e) { if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw e; }
+ if (itr->_enq_flag)
+ _wrfc.decr_enqcnt(itr->_fid);
+ }
+#endif
+
done = true;
}
@@ -483,6 +524,10 @@
u_int32_t data_offs_dblks = dtokp->dblocks_written();
u_int32_t ret = _txn_rec.encode(wptr, data_offs_dblks,
(JRNL_WMGR_PAGE_SIZE * JRNL_SBLK_SIZE) - _pg_offset_dblks);
+
+ // Remember fid which contains the record header in case record is split over several files
+ if (data_offs_dblks == 0)
+ dtokp->set_fid(_wrfc.index());
_pg_offset_dblks += ret;
_cached_offset_dblks += ret;
dtokp->incr_dblocks_written(ret);
@@ -492,6 +537,23 @@
{
dtokp->set_wstate(data_tok::COMMIT_SUBM);
_page_cb_arr[_pg_index]._pdtokl->push_back(dtokp);
+
+#if !(defined(RHM_WRONLY) || defined(RHM_RDONLY))
+ // Delete this txn from tmap, process records into emap
+ std::string xid((char*)xid_ptr, xid_len);
+ txn_data_list tdl = _tmap.get_remove_tdata_list(xid);
+ for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
+ {
+ if (itr->_enq_flag) // txn enqueue
+ _emap.insert_fid(itr->_rid, itr->_fid);
+ else // txn dequeue
+ {
+ u_int16_t fid = _emap.get_remove_fid(dtokp->rid());
+ _wrfc.decr_enqcnt(fid);
+ }
+ }
+#endif
+
done = true;
}
Modified: store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-10-10 14:38:09 UTC (rev 996)
@@ -33,10 +33,8 @@
#include "msg_producer.hpp"
#include "msg_consumer.hpp"
#include "jtest.hpp"
+#include <vector>
-#include <PreparedTransaction.h>
-#include <boost/ptr_container/ptr_list.hpp>
-
#define NUM_MSGS 5
#define MAX_AIO_SLEEPS 500
#define AIO_SLEEP_TIME 1000
@@ -161,7 +159,7 @@
void EmptyRecoverTest()
{
- boost::ptr_list<rhm::bdbstore::PreparedTransaction> txn_list;
+ std::vector<std::string> txn_list;
//Stack
char* test_name = "EmptyRecoverTest_Stack";
try
@@ -264,7 +262,7 @@
void RecoverReadTest()
{
- boost::ptr_list<rhm::bdbstore::PreparedTransaction> txn_list;
+ std::vector<std::string> txn_list;
//Stack
char* test_name = "RecoverReadTest_Stack";
try
@@ -334,7 +332,7 @@
void RecoveredReadTest()
{
- boost::ptr_list<rhm::bdbstore::PreparedTransaction> txn_list;
+ std::vector<std::string> txn_list;
//Stack
char* test_name = "RecoveredReadTest_Stack";
try
@@ -419,7 +417,7 @@
void RecoveredDequeueTest()
{
- boost::ptr_list<rhm::bdbstore::PreparedTransaction> txn_list;
+ std::vector<std::string> txn_list;
//Stack
char* test_name = "RecoveredDequeueTest_Stack";
try
@@ -508,7 +506,7 @@
void ComplexRecoveryTest1()
{
- boost::ptr_list<rhm::bdbstore::PreparedTransaction> txn_list;
+ std::vector<std::string> txn_list;
//Stack
char* test_name = "ComplexRecoveryTest1_Stack";
try
Modified: store/trunk/cpp/tests/jrnl/rtest
===================================================================
--- store/trunk/cpp/tests/jrnl/rtest 2007-10-10 13:59:38 UTC (rev 995)
+++ store/trunk/cpp/tests/jrnl/rtest 2007-10-10 14:38:09 UTC (rev 996)
@@ -30,8 +30,8 @@
NUM_JFILES=8
VG_ITERATIONS=1
-VG_NORM_FILESIZE=11
-#VG_NORM_FILESIZE=18 # RHEL5 triggers extra valgrind messages when pthreads are in use
+#VG_NORM_FILESIZE=11
+VG_NORM_FILESIZE=18 # RHEL5 triggers extra valgrind messages when pthreads are in use
# Write test
W_DO_TEST=T
@@ -58,8 +58,8 @@
RM_DIR="${RM} -rf"
TEST_PROG="./jtest"
CHK_PROG="./janalyze.py"
-#VALGRIND="valgrind -q --track-fds=yes --leak-check=full --leak-resolution=high --show-reachable=yes"
-VALGRIND="valgrind -q --track-fds=yes --leak-check=full --leak-resolution=high --show-reachable=yes --suppressions=/usr/lib/valgrind/glibc-2.5.supp"
+VALGRIND="valgrind -q --track-fds=yes --leak-check=full --leak-resolution=high --show-reachable=yes"
+#VALGRIND="valgrind -q --track-fds=yes --leak-check=full --leak-resolution=high --show-reachable=yes --suppressions=/usr/lib/valgrind/glibc-2.5.supp"
MAKE="make -f Makefile.rtest"
17 years, 2 months
rhmessaging commits: r995 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-10 09:59:38 -0400 (Wed, 10 Oct 2007)
New Revision: 995
Modified:
mgmt/cumin/python/cumin/demo.py
Log:
In demo data: adds vhost templates, adds non-clustered servers,
simplifies vhost names now that vhosts are properly scoped in the UI.
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-10 13:49:24 UTC (rev 994)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-10 13:59:38 UTC (rev 995)
@@ -33,6 +33,13 @@
sgroups["Department"].add_child(sgroup)
sgroups[name] = sgroup
+ # vhost templates
+ for name in ("test", "devel"):
+ vhost = VirtualHost(self.model)
+ vhost.name = name
+
+ self.load_vhost(vhost)
+
clusters = list()
for cluster_count in range(3):
@@ -41,37 +48,37 @@
clusters.append(cluster)
vhost = VirtualHost(self.model)
- vhost.name = cluster.name + ".default"
+ vhost.name = "default"
vhost.set_cluster(cluster)
for name in ("test", "devel"):
vhost = VirtualHost(self.model)
- vhost.name = cluster.name + "." + name
+ vhost.name = name
vhost.set_cluster(cluster)
- for vhost in cluster.virtual_host_items():
self.load_vhost(vhost)
for server_count in range(12):
- cluster = clusters[server_count % 3]
-
server = Server(self.model)
server.name = fmt("server", server_count)
- server.set_cluster(cluster)
+ index = server_count % 4
+ if index < 3:
+ server.set_cluster(clusters[index])
+
if server_count % 2:
sgroups["East Coast"].add_server(server)
else:
sgroups["West Coast"].add_server(server)
vhost = VirtualHost(self.model)
- vhost.name = server.name + ".default"
+ vhost.name = "default"
vhost.set_server(server)
server.default_virtual_host = vhost
for name in ("test", "devel"):
vhost = VirtualHost(self.model)
- vhost.name = server.name + "." + name
+ vhost.name = name
vhost.set_server(server)
for vhost in server.virtual_host_items():
17 years, 2 months
rhmessaging commits: r994 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-10 09:49:24 -0400 (Wed, 10 Oct 2007)
New Revision: 994
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/page.py
Log:
More navigation improvements. Now a vhost and its resources are
(navigationally speaking) contained inside of servers and clustered
servers, if the vhost is not a template vhost.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-10 13:34:25 UTC (rev 993)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-10 13:49:24 UTC (rev 994)
@@ -29,7 +29,7 @@
def render_item_link(self, session, server):
branch = session.branch()
- self.page().show_cluster_server(branch, server).show_view(branch)
+ self.page().show_server(branch, server).show_view(branch)
return mlink(branch.marshal(), "Server", server.name)
@@ -54,6 +54,9 @@
self.server = ServerFrame(app, "server")
self.add_child(self.server)
+ self.vhost = VirtualHostFrame(app, "vhost")
+ self.add_child(self.vhost)
+
def set_cluster(self, session, cluster):
self.param.set(session, cluster)
@@ -64,6 +67,10 @@
self.server.set_server(session, server)
return self.show_mode(session, self.server)
+ def show_virtual_host(self, session, vhost):
+ self.vhost.set_virtual_host(session, vhost)
+ return self.show_mode(session, self.vhost)
+
def render_href(self, session, cluster):
branch = session.branch()
self.page().show_cluster(branch, cluster).show_view(branch)
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-10 13:34:25 UTC (rev 993)
+++ mgmt/cumin/python/cumin/page.py 2007-10-10 13:49:24 UTC (rev 994)
@@ -37,21 +37,35 @@
self.app.sessions.append(session)
def show_server(self, session, server):
- return self.main.show_server(session, server)
+ cluster = server.get_cluster()
+ if cluster:
+ frame = self.main.show_cluster(session, cluster)
+ frame = frame.show_server(session, server)
+ else:
+ frame = self.main.show_server(session, server)
+
+ return frame
+
def show_server_group(self, session, sgroup):
return self.main.show_server_group(session, sgroup)
def show_cluster(self, session, cluster):
return self.main.show_cluster(session, cluster)
- def show_cluster_server(self, session, server):
- frame = self.main.show_cluster(session, server.get_cluster())
- return frame.show_server(session, server)
-
def show_virtual_host(self, session, vhost):
- return self.main.show_virtual_host(session, vhost)
+ server = vhost.get_server()
+ cluster = vhost.get_cluster()
+ if server:
+ frame = self.show_server(session, server)
+ elif cluster:
+ frame = self.show_cluster(session, cluster)
+ else:
+ frame = self.main
+
+ return frame.show_virtual_host(session, vhost)
+
def show_queue(self, session, queue):
frame = self.show_virtual_host(session, queue.virtual_host)
return frame.show_queue(session, queue)
17 years, 2 months
rhmessaging commits: r993 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-10 09:34:25 -0400 (Wed, 10 Oct 2007)
New Revision: 993
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/cluster.strings
mgmt/cumin/python/cumin/page.py
Log:
Improves navigation to cluster servers.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-09 20:41:26 UTC (rev 992)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-10 13:34:25 UTC (rev 993)
@@ -20,6 +20,19 @@
return mlink(branch.marshal(), "Cluster", cluster.name)
+class ClusterServerSet(ItemSet):
+ def render_title(self, session, cluster):
+ return "Servers (%i)" % len(cluster.server_items())
+
+ def get_items(self, session, cluster):
+ return sorted(cluster.server_items(), cmp, lambda x: x.name)
+
+ def render_item_link(self, session, server):
+ branch = session.branch()
+ self.page().show_cluster_server(branch, server).show_view(branch)
+
+ return mlink(branch.marshal(), "Server", server.name)
+
class ClusterParameter(Parameter):
def do_unmarshal(self, string):
return self.app.model.get_cluster(int(string))
@@ -38,14 +51,22 @@
self.view = ClusterView(app, "view")
self.add_child(self.view)
+ self.server = ServerFrame(app, "server")
+ self.add_child(self.server)
+
def set_cluster(self, session, cluster):
self.param.set(session, cluster)
def show_view(self, session):
return self.show_mode(session, self.view)
+ def show_server(self, session, server):
+ self.server.set_server(session, server)
+ return self.show_mode(session, self.server)
+
def render_href(self, session, cluster):
branch = session.branch()
+ self.page().show_cluster(branch, cluster).show_view(branch)
return branch.marshal()
def render_title(self, session, cluster):
@@ -67,13 +88,9 @@
def render_name(self, session, cluster):
return cluster.name
- class ServerTab(ServerSet):
- def render_title(self, session, cluster):
- return "Servers (%i)" % len(cluster.server_items())
+ class ServerTab(ClusterServerSet):
+ pass
- def get_items(self, session, cluster):
- return sorted(cluster.server_items(), cmp, lambda x: x.name)
-
class VirtualHostTab(VirtualHostSet):
def render_title(self, session, cluster):
return "Virtual Hosts (%i)" % len(cluster.virtual_host_items())
Modified: mgmt/cumin/python/cumin/cluster.strings
===================================================================
--- mgmt/cumin/python/cumin/cluster.strings 2007-10-09 20:41:26 UTC (rev 992)
+++ mgmt/cumin/python/cumin/cluster.strings 2007-10-10 13:34:25 UTC (rev 993)
@@ -25,13 +25,16 @@
<dt>Name</dt><dd>{name}</dd>
</dl>
+ <ul class="actions">
+ <li><a href="">Shutdown Cluster</a></li>
+ </ul>
+
{tabs}
</div>
[ServerTab.html]
<ul class="actions">
<li><a href="">Add Server</a></li>
- <li><a href="">Shutdown Servers</a></li>
</ul>
<table class="mobjects">
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-09 20:41:26 UTC (rev 992)
+++ mgmt/cumin/python/cumin/page.py 2007-10-10 13:34:25 UTC (rev 993)
@@ -45,6 +45,10 @@
def show_cluster(self, session, cluster):
return self.main.show_cluster(session, cluster)
+ def show_cluster_server(self, session, server):
+ frame = self.main.show_cluster(session, server.get_cluster())
+ return frame.show_server(session, server)
+
def show_virtual_host(self, session, vhost):
return self.main.show_virtual_host(session, vhost)
17 years, 2 months
rhmessaging commits: r992 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-09 16:41:26 -0400 (Tue, 09 Oct 2007)
New Revision: 992
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/cluster.strings
mgmt/cumin/python/cumin/server.py
Log:
Fixes a link bug in the server view. Moves links closer to item lists
in the cluster view.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-09 20:24:22 UTC (rev 991)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-09 20:41:26 UTC (rev 992)
@@ -58,8 +58,8 @@
self.tabs = TabSet(app, "tabs")
self.add_child(self.tabs)
- self.tabs.add_child(self.ClusterServers(app, "servers"))
- self.tabs.add_child(self.ClusterVirtualHosts(app, "vhosts"))
+ self.tabs.add_child(self.ServerTab(app, "servers"))
+ self.tabs.add_child(self.VirtualHostTab(app, "vhosts"))
def render_title(self, session, cluster):
return "Cluster '%s'" % cluster.name
@@ -67,14 +67,14 @@
def render_name(self, session, cluster):
return cluster.name
- class ClusterServers(ServerSet):
+ class ServerTab(ServerSet):
def render_title(self, session, cluster):
return "Servers (%i)" % len(cluster.server_items())
def get_items(self, session, cluster):
return sorted(cluster.server_items(), cmp, lambda x: x.name)
- class ClusterVirtualHosts(VirtualHostSet):
+ class VirtualHostTab(VirtualHostSet):
def render_title(self, session, cluster):
return "Virtual Hosts (%i)" % len(cluster.virtual_host_items())
Modified: mgmt/cumin/python/cumin/cluster.strings
===================================================================
--- mgmt/cumin/python/cumin/cluster.strings 2007-10-09 20:24:22 UTC (rev 991)
+++ mgmt/cumin/python/cumin/cluster.strings 2007-10-09 20:41:26 UTC (rev 992)
@@ -25,28 +25,50 @@
<dt>Name</dt><dd>{name}</dd>
</dl>
- <ul class="actions">
- <li><a href="">Add Virtual Host</a></li>
- <li><a href="">Add Server</a></li>
- <li><a href="">Shutdown Servers</a></li>
- </ul>
-
{tabs}
</div>
-[ClusterServers.html]
-<table class="ClusterServers mobjects">
+[ServerTab.html]
+<ul class="actions">
+ <li><a href="">Add Server</a></li>
+ <li><a href="">Shutdown Servers</a></li>
+</ul>
+
+<table class="mobjects">
<tr>
- <th>Name</th>
+ <th>Server</th>
<th>Status</th>
<th></th>
</tr>
-{items}
+
+ {items}
</table>
-[ClusterServers.item_html]
+[ServerTab.item_html]
<tr>
<td>{item_link}</td>
<td>0 errors, 0 warnings</td>
<td><a class="action" href="">Remove</a></td>
</tr>
+
+[VirtualHostTab.html]
+ <ul class="actions">
+ <li><a href="">Add Virtual Host</a></li>
+ </ul>
+
+<table class="mobjects">
+ <tr>
+ <th>Virtual Host</th>
+ <th>Configuration</th>
+ <th></th>
+ </tr>
+
+ {items}
+</table>
+
+[VirtualHostTab.item_html]
+<tr>
+ <td>{item_link}</td>
+ <td>10 queues, 5 exchanges</td>
+ <td><a class="action" href="">Remove</a></td>
+</tr>
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-09 20:24:22 UTC (rev 991)
+++ mgmt/cumin/python/cumin/server.py 2007-10-09 20:41:26 UTC (rev 992)
@@ -110,12 +110,11 @@
return server.name
def render_cluster_link(self, session, server):
- html = None
cluster = server.get_cluster()
if cluster:
branch = session.branch()
- self.page().show_cluster(session, cluster).show_view(branch)
+ self.page().show_cluster(branch, cluster).show_view(branch)
html = mlink(branch.marshal(), "Cluster", cluster.name)
else:
html = none()
17 years, 2 months
rhmessaging commits: r991 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-09 16:24:22 -0400 (Tue, 09 Oct 2007)
New Revision: 991
Modified:
mgmt/cumin/python/cumin/cluster.py
Log:
Makes servers the first tab in the cluster view.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-09 20:09:29 UTC (rev 990)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-09 20:24:22 UTC (rev 991)
@@ -58,8 +58,8 @@
self.tabs = TabSet(app, "tabs")
self.add_child(self.tabs)
+ self.tabs.add_child(self.ClusterServers(app, "servers"))
self.tabs.add_child(self.ClusterVirtualHosts(app, "vhosts"))
- self.tabs.add_child(self.ClusterServers(app, "servers"))
def render_title(self, session, cluster):
return "Cluster '%s'" % cluster.name
@@ -67,16 +67,16 @@
def render_name(self, session, cluster):
return cluster.name
- class ClusterVirtualHosts(VirtualHostSet):
+ class ClusterServers(ServerSet):
def render_title(self, session, cluster):
- return "Virtual Hosts (%i)" % len(cluster.virtual_host_items())
+ return "Servers (%i)" % len(cluster.server_items())
def get_items(self, session, cluster):
- return sorted(cluster.virtual_host_items(), cmp, lambda x: x.name)
+ return sorted(cluster.server_items(), cmp, lambda x: x.name)
- class ClusterServers(ServerSet):
+ class ClusterVirtualHosts(VirtualHostSet):
def render_title(self, session, cluster):
- return "Servers (%i)" % len(cluster.server_items())
+ return "Virtual Hosts (%i)" % len(cluster.virtual_host_items())
def get_items(self, session, cluster):
- return sorted(cluster.server_items(), cmp, lambda x: x.name)
+ return sorted(cluster.virtual_host_items(), cmp, lambda x: x.name)
17 years, 2 months
rhmessaging commits: r990 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-09 16:09:29 -0400 (Tue, 09 Oct 2007)
New Revision: 990
Modified:
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/virtualhost.py
Log:
Adds the templates concept to the UI and model.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-09 19:53:31 UTC (rev 989)
+++ mgmt/cumin/python/cumin/model.py 2007-10-09 20:09:29 UTC (rev 990)
@@ -96,6 +96,10 @@
def get_virtual_hosts(self):
return self.get_index(self.virtual_host).values()
+ def get_virtual_host_templates(self):
+ return [i for i in self.get_virtual_hosts() \
+ if not i.get_cluster() and not i.get_server()]
+
def get_virtual_host_group(self, id):
return self.get_index(self.virtual_host_group).get(id)
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-09 19:53:31 UTC (rev 989)
+++ mgmt/cumin/python/cumin/page.py 2007-10-09 20:09:29 UTC (rev 990)
@@ -167,11 +167,19 @@
def __init__(self, app, name):
super(MainView.VirtualHostTab, self).__init__(app, name)
- self.vhosts = VirtualHostSet(app, "vhosts")
+ self.vhosts = self.VirtualHostTemplateSet(app, "vhosts")
self.add_child(self.vhosts)
self.groups = VirtualHostGroupTree(app, "groups")
self.add_child(self.groups)
def render_title(self, session, model):
- return "Virtual Hosts (%i)" % len(model.get_virtual_hosts())
+ return "Virtual Hosts"
+
+ class VirtualHostTemplateSet(VirtualHostSet):
+ def get_items(self, session, model):
+ return model.get_virtual_host_templates()
+
+ def render_title(self, session, model):
+ return "Templates (%i)" % \
+ len(model.get_virtual_host_templates())
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-09 19:53:31 UTC (rev 989)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-09 20:09:29 UTC (rev 990)
@@ -358,22 +358,44 @@
{tabs}
</div>
-[VirtualHostTab.html]
-<ul class="VirtualHostTab radiotabs tabs">{tabs}</ul>
-<div class="VirtualHostTab mode">{mode}</div>
-
[ServerTab.html]
-<ul class="ServerTab radiotabs tabs">{tabs}</ul>
-<div class="ServerTab mode">{mode}</div>
+<ul class="radiotabs tabs">{tabs}</ul>
+<div class="mode">{mode}</div>
[ClusterTab.html]
<ul class="actions">
<li><a href="">Add Cluster</a></li>
</ul>
-<table class="ClusterTab mobjects">
+<table class="mobjects">
<tr>
<th>Cluster</th>
</tr>
{items}
</table>
+
+[VirtualHostTab.html]
+<ul class="radiotabs tabs">{tabs}</ul>
+<div class="mode">{mode}</div>
+
+[VirtualHostTemplateSet.html]
+<ul class="actions">
+ <li><a href="">Add Template</a></li>
+</ul>
+
+<table class="mobjects">
+ <tr>
+ <th>Template</th>
+ <th>Configuration</th>
+ <th></th>
+ </tr>
+
+ {items}
+</table>
+
+[VirtualHostTemplateSet.item_html]
+<tr>
+ <td>{item_link}</td>
+ <td>10 queues, 5 exchanges</td>
+ <td><a class="action" href="">Remove</a></td>
+</tr>
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2007-10-09 19:53:31 UTC (rev 989)
+++ mgmt/cumin/python/cumin/virtualhost.py 2007-10-09 20:09:29 UTC (rev 990)
@@ -23,7 +23,7 @@
class VirtualHostGroupTree(ItemTree):
def render_title(self, session, model):
- return "Virtual Host Groups (%i)" \
+ return "Groups (%i)" \
% len(model.get_virtual_host_groups())
class VirtualHostFrame(CuminFrame):
17 years, 2 months
rhmessaging commits: r989 - in store/trunk/cpp: lib/jrnl and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-10-09 15:53:31 -0400 (Tue, 09 Oct 2007)
New Revision: 989
Added:
store/trunk/cpp/lib/jrnl/txn_map.cpp
store/trunk/cpp/lib/jrnl/txn_map.hpp
Modified:
store/trunk/cpp/lib/Makefile.am
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/jerrno.cpp
store/trunk/cpp/lib/jrnl/jerrno.hpp
store/trunk/cpp/lib/jrnl/pmgr.cpp
store/trunk/cpp/lib/jrnl/pmgr.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/lib/jrnl/rmgr.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/tests/jrnl/Makefile.rtest
store/trunk/cpp/tests/jrnl/rtest
Log:
Added transaction map class txn_map; added it to class jcntl.
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/Makefile.am 2007-10-09 19:53:31 UTC (rev 989)
@@ -53,6 +53,7 @@
jrnl/pmgr.cpp \
jrnl/rmgr.cpp \
jrnl/rrfc.cpp \
+ jrnl/txn_map.cpp \
jrnl/txn_rec.cpp \
jrnl/wmgr.cpp \
jrnl/wrfc.cpp \
@@ -75,6 +76,7 @@
jrnl/rcvdat.hpp \
jrnl/rmgr.hpp \
jrnl/rrfc.hpp \
+ jrnl/txn_map.hpp \
jrnl/txn_rec.hpp \
jrnl/wmgr.hpp \
jrnl/wrfc.hpp
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -61,17 +61,15 @@
void
enq_map::insert_fid(const u_int64_t rid, const u_int16_t fid, bool locked) throw (jexception)
{
- std::pair<u_int16_t, bool> rec(fid, locked);
+ fid_lock_pair rec(fid, locked);
pthread_mutex_lock(&_mutex);
- std::pair<std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator, bool> ret =
- _map.insert(std::pair<u_int64_t, std::pair<u_int16_t, bool> >(rid, rec));
+ std::pair<emap_itr, bool> ret = _map.insert(emap_param(rid, rec));
pthread_mutex_unlock(&_mutex);
if (ret.second == false)
{
std::stringstream ss;
- ss << std::hex << std::setfill('0');
- ss << "rid=0x" << std::setw(16) << rid << " fid=0x" << std::setw(4) << fid;
- throw jexception(jerrno::JERR_EMAP_DUPLICATE, ss.str(), "enq_map", "insert");
+ ss << std::hex << "rid=0x" << rid << " fid=0x" << fid;
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, ss.str(), "enq_map", "insert");
}
}
@@ -79,19 +77,19 @@
enq_map::get_fid(const u_int64_t rid) throw (jexception)
{
pthread_mutex_lock(&_mutex);
- std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.find(rid);
+ emap_itr itr = _map.find(rid);
pthread_mutex_unlock(&_mutex);
if (itr == _map.end()) // not found in map
{
std::stringstream ss;
ss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_EMAP_NOTFOUND, ss.str(), "enq_map", "get_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_fid");
}
if (itr->second.second) // locked
{
std::stringstream ss;
ss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_EMAP_LOCKED, ss.str(), "enq_map", "get_fid");
+ throw jexception(jerrno::JERR_MAP_LOCKED, ss.str(), "enq_map", "get_fid");
}
return itr->second.first;
}
@@ -100,20 +98,20 @@
enq_map::get_remove_fid(const u_int64_t rid) throw (jexception)
{
pthread_mutex_lock(&_mutex);
- std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.find(rid);
+ emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
pthread_mutex_unlock(&_mutex);
std::stringstream ss;
ss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_EMAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
}
if (itr->second.second) // locked
{
pthread_mutex_unlock(&_mutex);
std::stringstream ss;
ss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_EMAP_LOCKED, ss.str(), "enq_map", "get_remove_fid");
+ throw jexception(jerrno::JERR_MAP_LOCKED, ss.str(), "enq_map", "get_remove_fid");
}
u_int16_t fid = itr->second.first;
_map.erase(itr);
@@ -125,13 +123,13 @@
enq_map::lock(const u_int64_t rid)
{
pthread_mutex_lock(&_mutex);
- std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.find(rid);
+ emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
pthread_mutex_unlock(&_mutex);
std::stringstream ss;
ss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_EMAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
}
itr->second.second = true;
pthread_mutex_unlock(&_mutex);
@@ -141,13 +139,13 @@
enq_map::unlock(const u_int64_t rid)
{
pthread_mutex_lock(&_mutex);
- std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.find(rid);
+ emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
pthread_mutex_unlock(&_mutex);
std::stringstream ss;
ss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_EMAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
}
itr->second.second = false;
pthread_mutex_unlock(&_mutex);
@@ -157,13 +155,13 @@
enq_map::is_locked(const u_int64_t rid)
{
pthread_mutex_lock(&_mutex);
- std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.find(rid);
+ emap_itr itr = _map.find(rid);
pthread_mutex_unlock(&_mutex);
if (itr == _map.end()) // not found in map
{
std::stringstream ss;
ss << std::hex << "rid=0x" << rid;
- throw jexception(jerrno::JERR_EMAP_NOTFOUND, ss.str(), "enq_map", "get_fid");
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_fid");
}
return itr->second.second;
}
@@ -173,8 +171,7 @@
{
rv.clear();
pthread_mutex_lock(&_mutex);
- for (std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.begin();
- itr != _map.end(); itr++)
+ for (emap_itr itr = _map.begin(); itr != _map.end(); itr++)
rv.push_back(itr->first);
pthread_mutex_unlock(&_mutex);
}
@@ -184,8 +181,7 @@
{
fv.clear();
pthread_mutex_lock(&_mutex);
- for (std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.begin();
- itr != _map.end(); itr++)
+ for (emap_itr itr = _map.begin(); itr != _map.end(); itr++)
fv.push_back(itr->second.first);
pthread_mutex_unlock(&_mutex);
}
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -59,7 +59,12 @@
class enq_map
{
private:
- std::map<u_int64_t, std::pair<u_int16_t, bool> > _map;
+ 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;
+ typedef emap::iterator emap_itr;
+
+ emap _map;
pthread_mutex_t _mutex;
public:
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -58,10 +58,11 @@
_autostop(true),
_datafh(NULL),
_emap(),
+ _tmap(),
_rrfc(),
_wrfc(),
- _rmgr(this, _emap, _rrfc),
- _wmgr(this, _emap, _wrfc)
+ _rmgr(this, _emap, _tmap, _rrfc),
+ _wmgr(this, _emap, _tmap, _wrfc)
{}
jcntl::~jcntl()
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -134,6 +134,7 @@
// Journal control structures
lfh** _datafh; ///< Array of pointers to data file handles
enq_map _emap; ///< Enqueue map for low water mark management
+ txn_map _tmap; ///< Transaction map open transactions
rrfc _rrfc; ///< Read journal rotating file controller
wrfc _wrfc; ///< Write journal rotating file controller
rmgr _rmgr; ///< Read page manager which manages AIO
Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -105,10 +105,10 @@
const u_int32_t jerrno::JERR_DTOK_ILLEGALSTATE = 0x0a00;
const u_int32_t jerrno::JERR_DTOK_RIDNOTSET = 0x0a01;
-// class enq_map
-const u_int32_t jerrno::JERR_EMAP_DUPLICATE = 0x0b00;
-const u_int32_t jerrno::JERR_EMAP_NOTFOUND = 0x0b01;
-const u_int32_t jerrno::JERR_EMAP_LOCKED = 0x0b02;
+// class enq_map, txn_map
+const u_int32_t jerrno::JERR_MAP_DUPLICATE = 0x0b00;
+const u_int32_t jerrno::JERR_MAP_NOTFOUND = 0x0b01;
+const u_int32_t jerrno::JERR_MAP_LOCKED = 0x0b02;
// class jinf
const u_int32_t jerrno::JERR_JINF_CVALIDFAIL = 0x0c00;
@@ -202,12 +202,11 @@
"Attempted to change to illegal state.");
_err_map[JERR_DTOK_RIDNOTSET] = std::string("JERR_DTOK_RIDNOTSET: Record ID not set.");
- // class enq_map
- _err_map[JERR_EMAP_DUPLICATE] = std::string("JERR_EMAP_DUPLICATE: "
+ // class enq_map, txn_map
+ _err_map[JERR_MAP_DUPLICATE] = std::string("JERR_MAP_DUPLICATE: "
"Attempted to insert enqueue record using duplicate key.");
- _err_map[JERR_EMAP_NOTFOUND] = std::string("JERR_EMAP_NOTFOUND: "
- "Key not found in enqueue map.");
- _err_map[JERR_EMAP_LOCKED] = std::string("JERR_EMAP_LOCKED: "
+ _err_map[JERR_MAP_NOTFOUND] = std::string("JERR_MAP_NOTFOUND: Key not found in enqueue map.");
+ _err_map[JERR_MAP_LOCKED] = std::string("JERR_MAP_LOCKED: "
"Record ID locked by a pending transaction.");
// class jinf
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -122,10 +122,10 @@
static const u_int32_t JERR_DTOK_ILLEGALSTATE; ///< Attempted to change to illegal state
static const u_int32_t JERR_DTOK_RIDNOTSET; ///< Record ID not set
- // class enq_map
- static const u_int32_t JERR_EMAP_DUPLICATE; ///< Attempted to insert using duplicate key
- static const u_int32_t JERR_EMAP_NOTFOUND; ///< Key not found in map
- static const u_int32_t JERR_EMAP_LOCKED; ///< rid locked by pending txn
+ // class enq_map, txn_map
+ static const u_int32_t JERR_MAP_DUPLICATE; ///< Attempted to insert using duplicate key
+ static const u_int32_t JERR_MAP_NOTFOUND; ///< Key not found in map
+ static const u_int32_t JERR_MAP_LOCKED; ///< rid locked by pending txn
// class jinf
static const u_int32_t JERR_JINF_CVALIDFAIL; ///< Compatibility validation failure
Modified: store/trunk/cpp/lib/jrnl/pmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.cpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/pmgr.cpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -73,11 +73,13 @@
const u_int32_t pmgr::_sblksize = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
-pmgr::pmgr(jcntl* jc, enq_map& emap, const u_int32_t pagesize, const u_int16_t pages):
+pmgr::pmgr(jcntl* jc, enq_map& emap, txn_map& tmap, const u_int32_t pagesize,
+ const u_int16_t pages):
_pagesize(pagesize),
_pages(pages),
_jc(jc),
_emap(emap),
+ _tmap(tmap),
_dtokl(NULL),
_page_base_ptr(NULL),
_page_ptr_arr(NULL),
@@ -95,12 +97,13 @@
_cb(NULL)
{}
-pmgr::pmgr(jcntl* jc, enq_map& emap, const u_int32_t pagesize, const u_int16_t pages,
+pmgr::pmgr(jcntl* jc, enq_map& emap, txn_map& tmap, const u_int32_t pagesize, const u_int16_t pages,
std::deque<data_tok*>* const dtokl) throw (jexception):
_pagesize(pagesize),
_pages(pages),
_jc(jc),
_emap(emap),
+ _tmap(tmap),
_dtokl(dtokl),
_page_base_ptr(NULL),
_page_ptr_arr(NULL),
Modified: store/trunk/cpp/lib/jrnl/pmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.hpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/pmgr.hpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -50,6 +50,7 @@
#include <jrnl/enq_map.hpp>
#include <jrnl/enq_rec.hpp>
#include <jrnl/nlfh.hpp>
+#include <jrnl/txn_map.hpp>
#include <jrnl/txn_rec.hpp>
namespace rhm
@@ -116,6 +117,7 @@
const u_int16_t _pages; ///< Number of page cache pages
jcntl* _jc; ///< Pointer to journal controller
enq_map& _emap; ///< Ref to enqueue map
+ txn_map& _tmap; ///< Ref to transaction map
std::deque<data_tok*>* _dtokl; ///< Pointer to external data token list
void* _page_base_ptr; ///< Base pointer to page memory
void** _page_ptr_arr; ///< Array of pointers to pages in page memory
@@ -135,9 +137,10 @@
aio_cb _cb; ///< Callback function pointer for AIO events
public:
- pmgr(jcntl* jc, enq_map& emap, const u_int32_t pagesize, const u_int16_t pages);
- pmgr(jcntl* jc, enq_map& emap, const u_int32_t pagesize, const u_int16_t pages,
- std::deque<data_tok*>* const dtokl) throw (jexception);
+ pmgr(jcntl* jc, enq_map& emap, txn_map& tmap, const u_int32_t pagesize,
+ const u_int16_t pages);
+ pmgr(jcntl* jc, enq_map& emap, txn_map& tmap, const u_int32_t pagesize,
+ const u_int16_t pages, std::deque<data_tok*>* const dtokl) throw (jexception);
virtual ~pmgr();
virtual const u_int32_t get_events(page_state state) throw (jexception) = 0;
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -42,14 +42,15 @@
namespace journal
{
-rmgr::rmgr(jcntl* jc, enq_map& emap, rrfc& rrfc):
- pmgr(jc, emap, JRNL_RMGR_PAGE_SIZE, JRNL_RMGR_PAGES),
+rmgr::rmgr(jcntl* jc, enq_map& emap, txn_map& tmap, rrfc& rrfc):
+ pmgr(jc, emap, tmap, JRNL_RMGR_PAGE_SIZE, JRNL_RMGR_PAGES),
_rrfc(rrfc),
_hdr()
{}
-rmgr::rmgr(jcntl* jc, enq_map& emap, rrfc& rrfc, std::deque<data_tok*>* const dtokl) throw (jexception):
- pmgr(jc, emap, JRNL_RMGR_PAGE_SIZE, JRNL_RMGR_PAGES, dtokl),
+rmgr::rmgr(jcntl* jc, enq_map& emap, txn_map& tmap, rrfc& rrfc,
+ std::deque<data_tok*>* const dtokl) throw (jexception):
+ pmgr(jc, emap, tmap, JRNL_RMGR_PAGE_SIZE, JRNL_RMGR_PAGES, dtokl),
_rrfc(rrfc),
_hdr()
{}
@@ -286,7 +287,7 @@
}
catch (jexception& e)
{
- if (e.err_code() != jerrno::JERR_EMAP_NOTFOUND)
+ if (e.err_code() != jerrno::JERR_MAP_NOTFOUND)
throw e;
//std::cout << "-nf" << std::flush;
}
Modified: store/trunk/cpp/lib/jrnl/rmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.hpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/rmgr.hpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -62,9 +62,9 @@
hdr _hdr; ///< Header used to determind record type
public:
- rmgr(jcntl* jc, enq_map& emap, rrfc& rrfc);
- rmgr(jcntl* jc, enq_map& emap, rrfc& rrfc, std::deque<data_tok*>* const dtokl)
- throw (jexception);
+ rmgr(jcntl* jc, enq_map& emap, txn_map& tmap, rrfc& rrfc);
+ rmgr(jcntl* jc, enq_map& emap, txn_map& tmap, rrfc& rrfc,
+ std::deque<data_tok*>* const dtokl) throw (jexception);
~rmgr();
void initialize(std::deque<data_tok*>* const dtokl, const aio_cb rd_cb) throw (jexception);
Added: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -0,0 +1,132 @@
+/**
+* \file txn_map.cpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class rhm::journal::txn_map (transaction map). See
+* comments in file txn_map.hpp for details.
+*
+* \author Kim van der Riet
+*
+* Copyright (C) 2007 Red Hat Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#include <jrnl/txn_map.hpp>
+
+#include <iomanip>
+#include <sstream>
+#include <jrnl/jerrno.hpp>
+
+namespace rhm
+{
+namespace journal
+{
+
+txn_map::txn_map():
+ _map()
+{
+ pthread_mutex_init(&_mutex, NULL);
+}
+
+txn_map::~txn_map()
+{
+ pthread_mutex_destroy(&_mutex);
+}
+
+void
+txn_map::insert_rid_fid(const std::string& xid, const u_int64_t rid, const u_int16_t fid)
+ throw (jexception)
+{
+ rid_fid_pair rec(rid, fid);
+ pthread_mutex_lock(&_mutex);
+ xmap_itr itr = _map.find(xid);
+ pthread_mutex_unlock(&_mutex);
+ if (itr == _map.end()) // not found in map
+ {
+ rid_fid_list list;
+ list.push_back(rec);
+ std::pair<xmap_itr, bool> ret = _map.insert(xmap_param(xid, list));
+ }
+ else
+ itr->second.push_back(rec);
+}
+
+const txn_map::rid_fid_list
+txn_map::get_rid_fid_list(const std::string& xid) throw (jexception)
+{
+ pthread_mutex_lock(&_mutex);
+ xmap_itr itr = _map.find(xid);
+ pthread_mutex_unlock(&_mutex);
+ if (itr == _map.end()) // not found in map
+ {
+ std::stringstream ss;
+ ss << std::hex << "xid=\"" << xid << "\"";
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "txn_map", "get_fid");
+ }
+ return itr->second;
+}
+
+const txn_map::rid_fid_list
+txn_map::get_remove_rid_fid_list(const std::string& xid) throw (jexception)
+{
+ pthread_mutex_lock(&_mutex);
+ xmap_itr itr = _map.find(xid);
+ if (itr == _map.end()) // not found in map
+ {
+ pthread_mutex_unlock(&_mutex);
+ std::stringstream ss;
+ ss << std::hex << "xid=\"" << xid << "\"";
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "txn_map", "get_remove_fid");
+ }
+ rid_fid_list list = itr->second;
+ _map.erase(itr);
+ pthread_mutex_unlock(&_mutex);
+ return list;
+}
+
+const u_int32_t
+txn_map::get_rid_count(const std::string& xid) throw (jexception)
+{
+ pthread_mutex_lock(&_mutex);
+ xmap_itr itr = _map.find(xid);
+ pthread_mutex_unlock(&_mutex);
+ if (itr == _map.end()) // not found in map
+ {
+ std::stringstream ss;
+ ss << std::hex << "xid=\"" << xid << "\"";
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "txn_map", "get_fid");
+ }
+ return itr->second.size();
+}
+
+void
+txn_map::xid_list(std::vector<std::string>& xv)
+{
+ xv.clear();
+ pthread_mutex_lock(&_mutex);
+ for (xmap_itr itr = _map.begin(); itr != _map.end(); itr++)
+ xv.push_back(itr->first);
+ pthread_mutex_unlock(&_mutex);
+}
+
+} // namespace journal
+} // namespace rhm
Added: store/trunk/cpp/lib/jrnl/txn_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/txn_map.hpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -0,0 +1,87 @@
+/**
+* \file txn_map.hpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class rhm::journal::txn_map (transaction map).
+* See class documentation for details.
+*
+* \author Kim van der Riet
+*
+* Copyright (C) 2007 Red Hat Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#ifndef rhm_journal_txn_map_hpp
+#define rhm_journal_txn_map_hpp
+
+namespace rhm
+{
+namespace journal
+{
+ class txn_map;
+}
+}
+
+#include <map>
+#include <list>
+#include <pthread.h>
+#include <vector>
+#include <jrnl/jexception.hpp>
+
+namespace rhm
+{
+namespace journal
+{
+
+ class txn_map
+ {
+ public:
+ typedef std::pair<u_int64_t, u_int16_t> rid_fid_pair;
+ typedef std::list<rid_fid_pair> rid_fid_list;
+
+ private:
+ typedef std::pair<std::string, rid_fid_list> xmap_param;
+ typedef std::map<std::string, rid_fid_list> xmap;
+ typedef xmap::iterator xmap_itr;
+
+ xmap _map;
+ pthread_mutex_t _mutex;
+
+ public:
+ txn_map();
+ ~txn_map();
+
+ void insert_rid_fid(const std::string& xid, const u_int64_t rid, const u_int16_t fid)
+ throw (jexception);
+ const rid_fid_list get_rid_fid_list(const std::string& xid) throw (jexception);
+ const rid_fid_list get_remove_rid_fid_list(const std::string& xid) throw (jexception);
+ const u_int32_t get_rid_count(const std::string& xid) throw (jexception);
+ inline void clear() { _map.clear(); }
+ inline const bool empty() const { return _map.empty(); }
+ inline const u_int16_t size() const { return (u_int16_t)_map.size(); }
+ void xid_list(std::vector<std::string>& xv);
+ };
+
+} // namespace journal
+} // namespace rhm
+
+#endif // ifndef rhm_journal_txn_map_hpp
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -42,8 +42,8 @@
namespace journal
{
-wmgr::wmgr(jcntl* jc, enq_map& emap, wrfc& wrfc):
- pmgr(jc, emap, JRNL_WMGR_PAGE_SIZE, JRNL_WMGR_PAGES),
+wmgr::wmgr(jcntl* jc, enq_map& emap, txn_map& tmap, wrfc& wrfc):
+ pmgr(jc, emap, tmap, JRNL_WMGR_PAGE_SIZE, JRNL_WMGR_PAGES),
_wrfc(wrfc),
_max_dtokpp(0),
_max_io_wait_us(0),
@@ -57,9 +57,9 @@
_commit_busy(false)
{}
-wmgr::wmgr(jcntl* jc, enq_map& emap, wrfc& wrfc, std::deque<data_tok*>* const dtokl,
+wmgr::wmgr(jcntl* jc, enq_map& emap, txn_map& tmap, wrfc& wrfc, std::deque<data_tok*>* const dtokl,
const u_int32_t max_dtokpp, const u_int32_t max_iowait_us) throw (jexception):
- pmgr(jc, emap, JRNL_WMGR_PAGE_SIZE, JRNL_WMGR_PAGES, dtokl),
+ pmgr(jc, emap, tmap, JRNL_WMGR_PAGE_SIZE, JRNL_WMGR_PAGES, dtokl),
_wrfc(wrfc),
_max_dtokpp(max_dtokpp),
_max_io_wait_us(max_iowait_us),
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-10-09 19:53:31 UTC (rev 989)
@@ -93,9 +93,10 @@
aio_cb _cb; ///< Callback function pointer for AIO events
public:
- wmgr(jcntl* jc, enq_map& emap, wrfc& wrfc);
- wmgr(jcntl* jc, enq_map& emap, wrfc& wrfc, std::deque<data_tok*>* const dtokl,
- const u_int32_t max_dtokpp, const u_int32_t max_iowait_us) throw (jexception);
+ wmgr(jcntl* jc, enq_map& emap, txn_map& tmap, wrfc& wrfc);
+ wmgr(jcntl* jc, enq_map& emap, txn_map& tmap, wrfc& wrfc,
+ std::deque<data_tok*>* const dtokl, const u_int32_t max_dtokpp,
+ const u_int32_t max_iowait_us) throw (jexception);
~wmgr();
void initialize(std::deque<data_tok*>* const dtokl, aio_cb wr_cb,
Modified: store/trunk/cpp/tests/jrnl/Makefile.rtest
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.rtest 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/tests/jrnl/Makefile.rtest 2007-10-09 19:53:31 UTC (rev 989)
@@ -52,6 +52,7 @@
jerrno.o \
jinf.o \
enq_map.o \
+ txn_map.o \
jdir.o \
data_tok.o \
file_hdr.o \
Modified: store/trunk/cpp/tests/jrnl/rtest
===================================================================
--- store/trunk/cpp/tests/jrnl/rtest 2007-10-09 19:44:52 UTC (rev 988)
+++ store/trunk/cpp/tests/jrnl/rtest 2007-10-09 19:53:31 UTC (rev 989)
@@ -30,8 +30,8 @@
NUM_JFILES=8
VG_ITERATIONS=1
-#VG_NORM_FILESIZE=11
-VG_NORM_FILESIZE=18 # RHEL5 triggers extra valgrind messages when pthreads are in use
+VG_NORM_FILESIZE=11
+#VG_NORM_FILESIZE=18 # RHEL5 triggers extra valgrind messages when pthreads are in use
# Write test
W_DO_TEST=T
@@ -58,8 +58,8 @@
RM_DIR="${RM} -rf"
TEST_PROG="./jtest"
CHK_PROG="./janalyze.py"
-VALGRIND="valgrind -q --track-fds=yes --leak-check=full --leak-resolution=high --show-reachable=yes"
-#VALGRIND="valgrind -q --track-fds=yes --leak-check=full --leak-resolution=high --show-reachable=yes --suppressions=/usr/lib/valgrind/glibc-2.5.supp"
+#VALGRIND="valgrind -q --track-fds=yes --leak-check=full --leak-resolution=high --show-reachable=yes"
+VALGRIND="valgrind -q --track-fds=yes --leak-check=full --leak-resolution=high --show-reachable=yes --suppressions=/usr/lib/valgrind/glibc-2.5.supp"
MAKE="make -f Makefile.rtest"
17 years, 2 months