rhmessaging commits: r988 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-09 15:44:52 -0400 (Tue, 09 Oct 2007)
New Revision: 988
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/server.py
Log:
Moves some UI elements around. Makes servers the first tab in the top
view. Moves action links closer to item sets. Shortens "Server
Groups" to just "Groups".
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-09 19:25:21 UTC (rev 987)
+++ mgmt/cumin/python/cumin/page.py 2007-10-09 19:44:52 UTC (rev 988)
@@ -140,13 +140,29 @@
self.tabs = TabSet(app, "tabs")
self.add_child(self.tabs)
+ self.tabs.add_child(self.ServerTab(app, "servers"))
+ self.tabs.add_child(self.ClusterTab(app, "clusters"))
self.tabs.add_child(self.VirtualHostTab(app, "vhosts"))
- self.tabs.add_child(self.ServerTab(app, "servers"))
- self.tabs.add_child(ClusterSet(app, "clusters"))
def render_title(self, session, model):
return "Red Hat Messaging"
+ class ServerTab(TabSet):
+ def __init__(self, app, name):
+ super(MainView.ServerTab, self).__init__(app, name)
+
+ self.groups = ServerGroupTree(app, "groups")
+ self.add_child(self.groups)
+
+ self.servers = ServerSet(app, "servers")
+ self.add_child(self.servers)
+
+ def render_title(self, session, model):
+ return "Servers (%i)" % len(model.get_servers())
+
+ class ClusterTab(ClusterSet):
+ pass
+
class VirtualHostTab(TabSet):
def __init__(self, app, name):
super(MainView.VirtualHostTab, self).__init__(app, name)
@@ -159,16 +175,3 @@
def render_title(self, session, model):
return "Virtual Hosts (%i)" % len(model.get_virtual_hosts())
-
- class ServerTab(TabSet):
- def __init__(self, app, name):
- super(MainView.ServerTab, self).__init__(app, name)
-
- self.servers = ServerSet(app, "servers")
- self.add_child(self.servers)
-
- self.groups = ServerGroupTree(app, "groups")
- self.add_child(self.groups)
-
- def render_title(self, session, model):
- return "Servers (%i)" % len(model.get_servers())
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-09 19:25:21 UTC (rev 987)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-09 19:44:52 UTC (rev 988)
@@ -130,7 +130,7 @@
ul.actions {
padding: 0;
- margin: 1em 0;
+ margin: 0 0 1em 0;
list-style: none;
}
@@ -354,13 +354,7 @@
[MainView.html]
<div class="oblock">
<h1>{title}</h1>
- <ul class="actions">
- <li><a href="">Add Virtual Host</a></li>
- <li><a href="">Add Virtual Host Group</a></li>
- <li><a href="">Add Server</a></li>
- <li><a href="">Add Server Group</a></li>
- <li><a href="">Add Cluster</a></li>
- </ul>
+
{tabs}
</div>
@@ -371,3 +365,15 @@
[ServerTab.html]
<ul class="ServerTab radiotabs tabs">{tabs}</ul>
<div class="ServerTab mode">{mode}</div>
+
+[ClusterTab.html]
+<ul class="actions">
+ <li><a href="">Add Cluster</a></li>
+</ul>
+
+<table class="ClusterTab mobjects">
+ <tr>
+ <th>Cluster</th>
+ </tr>
+ {items}
+</table>
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-09 19:25:21 UTC (rev 987)
+++ mgmt/cumin/python/cumin/server.py 2007-10-09 19:44:52 UTC (rev 988)
@@ -139,7 +139,7 @@
class ServerGroupTree(ItemTree):
def render_title(self, session, model):
- return "Server Groups (%i)" % len(model.get_server_groups())
+ return "Groups (%i)" % len(model.get_server_groups())
def get_items(self, session, model):
roots = list()
17 years, 5 months
rhmessaging commits: r987 - store/trunk/cpp/etc.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-10-09 15:25:21 -0400 (Tue, 09 Oct 2007)
New Revision: 987
Modified:
store/trunk/cpp/etc/rhmd
Log:
simplify launching qpidd as daemon
Modified: store/trunk/cpp/etc/rhmd
===================================================================
--- store/trunk/cpp/etc/rhmd 2007-10-09 19:12:07 UTC (rev 986)
+++ store/trunk/cpp/etc/rhmd 2007-10-09 19:25:21 UTC (rev 987)
@@ -31,7 +31,7 @@
start() {
echo -n $"Starting Qpid AMQP daemon: "
- daemon --check $prog $prog --daemon --config=/etc/rhmd.conf
+ $prog --daemon --config=/etc/rhmd.conf
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch $lockfile
17 years, 5 months
rhmessaging commits: r986 - store/trunk/cpp/etc.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-10-09 15:12:07 -0400 (Tue, 09 Oct 2007)
New Revision: 986
Added:
store/trunk/cpp/etc/rhmd.conf
Log:
add rhmd.conf configuration file
Added: store/trunk/cpp/etc/rhmd.conf
===================================================================
--- store/trunk/cpp/etc/rhmd.conf (rev 0)
+++ store/trunk/cpp/etc/rhmd.conf 2007-10-09 19:12:07 UTC (rev 986)
@@ -0,0 +1,2 @@
+# Configuration file for qpidd
+store=libbdbstore.so.0
17 years, 5 months
rhmessaging commits: r985 - in store/trunk/cpp: etc and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-10-09 15:01:34 -0400 (Tue, 09 Oct 2007)
New Revision: 985
Modified:
store/trunk/cpp/Makefile.am
store/trunk/cpp/etc/rhmd
store/trunk/cpp/rhm.spec.in
Log:
add rhmd.conf configuration file, instead of passing env vars to qpidd
Modified: store/trunk/cpp/Makefile.am
===================================================================
--- store/trunk/cpp/Makefile.am 2007-10-09 17:58:20 UTC (rev 984)
+++ store/trunk/cpp/Makefile.am 2007-10-09 19:01:34 UTC (rev 985)
@@ -1,8 +1,10 @@
AUTOMAKE_OPTIONS = 1.9.6 foreign
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = README etc/rhmd
+EXTRA_DIST = README etc/rhmd etc/rhmd.conf
+sysconf_DATA = etc/rhmd.conf
+
SUBDIRS = lib tests docs
# Update libtool, if needed.
Modified: store/trunk/cpp/etc/rhmd
===================================================================
--- store/trunk/cpp/etc/rhmd 2007-10-09 17:58:20 UTC (rev 984)
+++ store/trunk/cpp/etc/rhmd 2007-10-09 19:01:34 UTC (rev 985)
@@ -17,19 +17,63 @@
# description: Qpidd is an AMQP broker. It receives, stores, routes and forwards messages using the AMQP protocol.
# processname: qpidd
+prog=qpidd
lockfile=/var/lock/subsys/rhmd
-LIBBDBSTORE=libbdbstore.so.0
+# Source function library.
+. /etc/rc.d/init.d/functions
-# See how we were called.
+if [ -f /etc/sysconfig/$prog ] ; then
+ . /etc/sysconfig/$prog
+fi
+
+RETVAL=0
+
+start() {
+ echo -n $"Starting Qpid AMQP daemon: "
+ daemon --check $prog $prog --daemon --config=/etc/rhmd.conf
+ RETVAL=$?
+ echo
+ [ $RETVAL = 0 ] && touch $lockfile
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping Qpid AMQP daemon: "
+ killproc $prog
+ RETVAL=$?
+ echo
+ [ $RETVAL = 0 ] && rm -f $lockfile
+}
+
+reload() {
+ echo 1>&2 $"$0: reload not supported"
+ exit 3
+}
+
+restart() {
+ stop
+ start
+}
+
+# See how we were called.
case "$1" in
- start|stop|restart|reload|status)
- QPIDD_OPTIONS="-s $LIBBDBSTORE"
- . /etc/rc.d/init.d/qpidd
- exit $?
- ;;
+ start|stop|restart|reload)
+ $1
+ ;;
+ status)
+ status $prog
+ RETVAL=$?
+ ;;
+ force-reload)
+ restart
+ ;;
+ try-restart)
+ [ -e $lockfile ] && restart || :
+ ;;
*)
- echo 1>&2 $"Usage: $0 {start|stop|restart|condrestart|status}"
- exit 1
- ;;
+ echo 1>&2 $"Usage: $0 {start|stop|restart|condrestart|status}"
+ exit 1
esac
+
+exit $RETVAL
Modified: store/trunk/cpp/rhm.spec.in
===================================================================
--- store/trunk/cpp/rhm.spec.in 2007-10-09 17:58:20 UTC (rev 984)
+++ store/trunk/cpp/rhm.spec.in 2007-10-09 19:01:34 UTC (rev 985)
@@ -38,6 +38,7 @@
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
install -Dp -m0755 etc/rhmd %{buildroot}%{_initrddir}/rhmd
+#install -Dp -m0555 etc/rhmd.conf %{buildroot}%{_sysconfdir}/rhmd.conf
rm -f %{buildroot}%_libdir/*.a
rm -f %{buildroot}%_libdir/*.la
rm -f %{buildroot}%_libdir/*.so
@@ -53,7 +54,8 @@
%doc README COPYING
%_libdir/libbdbstore.so.0
%_libdir/libbdbstore.so.0.1.0
-%{_initrddir}/rhmd
+%_initrddir/rhmd
+%config(noreplace) %_sysconfdir/rhmd.conf
%post
# This adds the proper /etc/rc*.d links for the script
17 years, 5 months
rhmessaging commits: r984 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-09 13:58:20 -0400 (Tue, 09 Oct 2007)
New Revision: 984
Modified:
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/widgets.py
Log:
Improves handling of cases in the UI where a set is empty or a scalar
property is not set.
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-09 17:45:25 UTC (rev 983)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-09 17:58:20 UTC (rev 984)
@@ -30,6 +30,11 @@
list-style: none;
}
+span.none {
+ font-style: italic;
+ color: #999;
+}
+
#head {
padding: 0.4em 0.75em 0.2em 0.75em;
}
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-09 17:45:25 UTC (rev 983)
+++ mgmt/cumin/python/cumin/server.py 2007-10-09 17:58:20 UTC (rev 984)
@@ -84,6 +84,9 @@
return mlink(branch.marshal(), "ServerGroup", group.name)
+ def render_none(self, session, group):
+ return none()
+
class ServerView(Widget):
def __init__(self, app, name):
super(ServerView, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-09 17:45:25 UTC (rev 983)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-09 17:58:20 UTC (rev 984)
@@ -11,7 +11,7 @@
return "<a href=\"%s\">%s</a>" % (href, name)
def none():
- return "<em>None</em>"
+ return "<span class=\"none\">None</span>"
class CuminFrame(Frame, ModeSet):
def do_process(self, session, object):
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2007-10-09 17:45:25 UTC (rev 983)
+++ mgmt/cumin/python/wooly/widgets.py 2007-10-09 17:58:20 UTC (rev 984)
@@ -137,15 +137,24 @@
if items:
writer = Writer()
-
+
for item in items:
self.item_tmpl.render(session, item, writer)
- return writer.to_string()
+ html = writer.to_string()
+ else:
+ html = self.render_none(session, object)
+ return html
+
def render_item_content(self, session, item):
return None
+ def render_none(self, session, object):
+ """For producing a message when the set is empty"""
+
+ return None
+
class ItemTree(ItemSet):
def get_items(self, session, object):
"""Get the root items"""
17 years, 5 months
rhmessaging commits: r983 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-09 13:45:25 -0400 (Tue, 09 Oct 2007)
New Revision: 983
Modified:
mgmt/cumin/python/cumin/server.py
Log:
Makes the parent groups property a list of links.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-09 17:31:30 UTC (rev 982)
+++ mgmt/cumin/python/cumin/server.py 2007-10-09 17:45:25 UTC (rev 983)
@@ -189,19 +189,22 @@
def __init__(self, app, name):
super(ServerGroupView, self).__init__(app, name)
+ self.pgroups = self.GroupParents(app, "parent_groups")
+ self.add_child(self.pgroups)
+
self.tabs = TabSet(app, "tabs")
self.add_child(self.tabs)
- self.tabs.add_child(self.Servers(app, "servers"))
+ self.tabs.add_child(self.GroupServers(app, "servers"))
def render_title(self, session, group):
return "Server Group '%s'" % group.name
- def render_parent_groups(self, session, group):
- return ", ".join([i.name for i in group.parent_items()]) \
- or "<em>None</em>"
+ class GroupParents(ServerGroupSet):
+ def get_items(self, session, group):
+ return sorted(group.parent_items(), cmp, lambda x: x.name)
- class Servers(ServerSet):
+ class GroupServers(ServerSet):
def get_items(self, session, group):
return sorted(group.server_items(), cmp, lambda x: x.name)
17 years, 5 months
rhmessaging commits: r982 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-09 13:31:30 -0400 (Tue, 09 Oct 2007)
New Revision: 982
Modified:
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Add a server group set and use it in the server properties.
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-09 17:13:02 UTC (rev 981)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-09 17:31:30 UTC (rev 982)
@@ -26,6 +26,10 @@
color: #06c;
}
+ul {
+ list-style: none;
+}
+
#head {
padding: 0.4em 0.75em 0.2em 0.75em;
}
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-09 17:13:02 UTC (rev 981)
+++ mgmt/cumin/python/cumin/server.py 2007-10-09 17:31:30 UTC (rev 982)
@@ -77,10 +77,20 @@
def render_title(self, session, server):
return "Server '%s'" % server.name
+class ServerGroupSet(ItemSet):
+ def render_item_content(self, session, group):
+ branch = session.branch()
+ self.page().show_server_group(branch, group).show_view(branch)
+
+ return mlink(branch.marshal(), "ServerGroup", group.name)
+
class ServerView(Widget):
def __init__(self, app, name):
super(ServerView, self).__init__(app, name)
+ self.groups = self.ServerServerGroups(app, "groups")
+ self.add_child(self.groups)
+
self.tabs = TabSet(app, "tabs")
self.add_child(self.tabs)
@@ -109,6 +119,10 @@
return html
+ class ServerServerGroups(ServerGroupSet):
+ def get_items(self, session, server):
+ return sorted(server.server_group_items(), cmp, lambda x: x.name)
+
class ServerVirtualHosts(VirtualHostSet):
def render_title(self, session, server):
return "Virtual Hosts (%i)" % len(server.virtual_host_items())
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-09 17:13:02 UTC (rev 981)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-09 17:31:30 UTC (rev 982)
@@ -28,11 +28,13 @@
<dl class="properties">
<dt>Name</dt><dd>{name}</dd>
<dt>Cluster</dt><dd>{cluster_link}</dd>
+ <dt>Server Groups</dt><dd>{groups}</dd>
</dl>
<ul class="actions">
<li><a href="">Shutdown</a></li>
</ul>
+
{tabs}
</div>
@@ -64,7 +66,7 @@
<ul class="actions">
<li><a href="">Add Server</a></li>
- <li><a href="">Shutdown All Servers in Group</a></li>
+ <li><a href="">Shutdown Servers</a></li>
</ul>
{tabs}
17 years, 5 months
rhmessaging commits: r981 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-09 13:13:02 -0400 (Tue, 09 Oct 2007)
New Revision: 981
Modified:
mgmt/cumin/python/cumin/page.strings
Log:
Sketches in the login ui bit in the top navbar.
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-09 16:59:39 UTC (rev 980)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-09 17:13:02 UTC (rev 981)
@@ -42,6 +42,21 @@
vertical-align: -20%;
}
+ul#whonav {
+ float: right;
+ list-style: none;
+ color: white;
+ margin: 0;
+}
+
+ul#whonav li {
+ display: inline;
+}
+
+ul#whonav li a {
+ color: white;
+}
+
h1, h2 {
margin: 0;
}
@@ -311,7 +326,13 @@
<script src="resource?name=wooly.js"> </script>
</head>
<body class="{class}">
- <div id="head"><ul id="context">{context_items}</ul></div>
+ <div id="head">
+ <ul id="whonav">
+ <li>Hi, <strong>nsantos</strong></li>
+ <li><a class="action" href="">Log Out</a></li>
+ </ul>
+ <ul id="context">{context_items}</ul>
+ </div>
<div id="body">{content}</div>
<div id="foot">
</div>
17 years, 5 months
rhmessaging commits: r980 - mgmt/etc.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-09 12:59:39 -0400 (Tue, 09 Oct 2007)
New Revision: 980
Modified:
mgmt/etc/cumindev.el
Log:
* Binds .strings files to html mode
* Removes the desktop-read business
Modified: mgmt/etc/cumindev.el
===================================================================
--- mgmt/etc/cumindev.el 2007-10-09 16:01:15 UTC (rev 979)
+++ mgmt/etc/cumindev.el 2007-10-09 16:59:39 UTC (rev 980)
@@ -2,9 +2,12 @@
(if cumindev-home
(progn
- ;(desktop-read cumindev-home)
(shell "dev")
(setq tags-file-name (concat cumindev-home "/etc/cumindev.tags"))
- (setq grep-command (concat "find " cumindev-home " -name \\*.py -print | xargs fgrep -n "))
- (setq compile-command "cumin-test"))
- (display-warning 'cumindev "Environment variable CUMINDEV_HOME not set" :error))
+ (setq grep-command (concat "find " cumindev-home
+ " -name \\*.py -print | xargs fgrep -n "))
+ (setq compile-command "cumin-test")
+ (setq auto-mode-alist
+ (cons '("\\.strings$" . html-mode) auto-mode-alist)))
+ (display-warning 'cumindev
+ "Environment variable CUMINDEV_HOME not set" :error))
17 years, 5 months
rhmessaging commits: r979 - in store/trunk/cpp: lib/jrnl and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-10-09 12:01:15 -0400 (Tue, 09 Oct 2007)
New Revision: 979
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/jerrno.cpp
store/trunk/cpp/lib/jrnl/jerrno.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
store/trunk/cpp/tests/jrnl/janalyze.py
Log:
Bugfix in rmgr::consume_xid_rec(); Added boolean transaction lock to enq-map.
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2007-10-09 15:55:12 UTC (rev 978)
+++ store/trunk/cpp/lib/Makefile.am 2007-10-09 16:01:15 UTC (rev 979)
@@ -1,4 +1,4 @@
-AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) $(QPID_CXXFLAGS) -pthread
+AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) $(QPID_CXXFLAGS) -DRHM_CLEAN -pthread
lib_LTLIBRARIES = libbdbstore.la
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-10-09 15:55:12 UTC (rev 978)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-10-09 16:01:15 UTC (rev 979)
@@ -55,9 +55,16 @@
void
enq_map::insert_fid(const u_int64_t rid, const u_int16_t fid) throw (jexception)
{
+ insert_fid(rid, fid, false);
+}
+
+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);
pthread_mutex_lock(&_mutex);
- std::pair<std::map<u_int64_t, u_int16_t>::iterator, bool> ret =
- _map.insert(std::pair<u_int64_t, u_int16_t>(rid, fid));
+ 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));
pthread_mutex_unlock(&_mutex);
if (ret.second == false)
{
@@ -72,43 +79,102 @@
enq_map::get_fid(const u_int64_t rid) throw (jexception)
{
pthread_mutex_lock(&_mutex);
- std::map<u_int64_t, u_int16_t>::iterator itr = _map.find(rid);
+ std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.find(rid);
pthread_mutex_unlock(&_mutex);
- if (itr == _map.end())
+ if (itr == _map.end()) // not found in map
{
std::stringstream ss;
- ss << std::hex << std::setfill('0');
- ss << "rid=0x" << std::setw(16) << rid;
+ ss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_EMAP_NOTFOUND, ss.str(), "enq_map", "get_fid");
}
- return itr->second;
+ 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");
+ }
+ return itr->second.first;
}
const u_int16_t
enq_map::get_remove_fid(const u_int64_t rid) throw (jexception)
{
pthread_mutex_lock(&_mutex);
- std::map<u_int64_t, u_int16_t>::iterator itr = _map.find(rid);
- if (itr == _map.end())
+ std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.find(rid);
+ if (itr == _map.end()) // not found in map
{
pthread_mutex_unlock(&_mutex);
std::stringstream ss;
- ss << std::hex << std::setfill('0');
- ss << "rid=0x" << std::setw(16) << rid;
+ ss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_EMAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
}
- u_int16_t fid = itr->second;
+ 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");
+ }
+ u_int16_t fid = itr->second.first;
_map.erase(itr);
pthread_mutex_unlock(&_mutex);
return fid;
}
void
+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);
+ 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");
+ }
+ itr->second.second = true;
+ pthread_mutex_unlock(&_mutex);
+}
+
+void
+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);
+ 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");
+ }
+ itr->second.second = false;
+ pthread_mutex_unlock(&_mutex);
+}
+
+const bool
+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);
+ 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");
+ }
+ return itr->second.second;
+}
+
+void
enq_map::rid_list(std::vector<u_int64_t>& rv)
{
rv.clear();
pthread_mutex_lock(&_mutex);
- for (std::map<u_int64_t, u_int16_t>::iterator itr = _map.begin(); itr != _map.end(); itr++)
+ for (std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator itr = _map.begin();
+ itr != _map.end(); itr++)
rv.push_back(itr->first);
pthread_mutex_unlock(&_mutex);
}
@@ -118,8 +184,9 @@
{
fv.clear();
pthread_mutex_lock(&_mutex);
- for (std::map<u_int64_t, u_int16_t>::iterator itr = _map.begin(); itr != _map.end(); itr++)
- fv.push_back(itr->second);
+ for (std::map<u_int64_t, std::pair<u_int16_t, bool> >::iterator 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 15:55:12 UTC (rev 978)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2007-10-09 16:01:15 UTC (rev 979)
@@ -53,13 +53,13 @@
/**
* \class enq_map
- * \brief Class for storing the file id (fid) for each enqueued data block using
- * the record id (rid) as a key.
+ * \brief Class for storing the file id (fid) and a transaction locked flag for each enqueued
+ * data block using the record id (rid) as a key.
*/
class enq_map
{
private:
- std::map<u_int64_t, u_int16_t> _map;
+ std::map<u_int64_t, std::pair<u_int16_t, bool> > _map;
pthread_mutex_t _mutex;
public:
@@ -67,8 +67,12 @@
~enq_map();
void insert_fid(const u_int64_t rid, const u_int16_t fid) throw (jexception);
+ 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);
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/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-10-09 15:55:12 UTC (rev 978)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-10-09 16:01:15 UTC (rev 979)
@@ -108,6 +108,7 @@
// 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 jinf
const u_int32_t jerrno::JERR_JINF_CVALIDFAIL = 0x0c00;
@@ -206,6 +207,8 @@
"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: "
+ "Record ID locked by a pending transaction.");
// class jinf
_err_map[JERR_JINF_CVALIDFAIL] = std::string("JERR_JINF_CVALIDFAIL: "
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-10-09 15:55:12 UTC (rev 978)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-10-09 16:01:15 UTC (rev 979)
@@ -125,6 +125,7 @@
// 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 jinf
static const u_int32_t JERR_JINF_CVALIDFAIL; ///< Compatibility validation failure
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-10-09 15:55:12 UTC (rev 978)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-10-09 16:01:15 UTC (rev 979)
@@ -248,6 +248,7 @@
// Read header, determine next record type
while (true)
{
+//std::string s;
//std::cout << " [f pi=" << _pg_index << " d=" << dblks_rem() << " f=" << (_rrfc.empty()?"T":"F") << " status:" << _rrfc.file_handle()->status_str(s) << "]" << std::flush;
if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
{
@@ -292,7 +293,7 @@
#endif
if (is_enq) // ok, this record is enqueued, check it, then read it...
{
-//std::cout << " $" << std::flush;
+//std::cout << "e" << std::flush;
if (dtokp->rid())
{
if (_hdr._rid != dtokp->rid())
@@ -329,7 +330,7 @@
return res;
}
else // skip this record, it is already dequeued
-//{ std::cout << " %" << std::flush;
+//{ std::cout << "d" << std::flush;
consume_xid_rec(_hdr, rptr, dtokp);
//}
break;
@@ -510,7 +511,7 @@
{
enq_hdr ehdr;
::memcpy(&ehdr, rptr, sizeof(enq_hdr));
- dtokp->set_dsize(ehdr._xidsize + sizeof(enq_hdr) + sizeof(rec_tail));
+ dtokp->set_dsize(ehdr._xidsize + ehdr._dsize + sizeof(enq_hdr) + sizeof(rec_tail));
}
else if (h._magic == RHM_JDAT_DEQ_MAGIC)
{
@@ -579,8 +580,6 @@
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
{
dtokp->set_rstate(data_tok::SKIP_PART);
- // Use data_tok::dblocks_proc field to save how many skip bloks still to go...
-// dtokp->set_dblocks_read(dsize_dblks - tot_dblk_cnt);
//std::cout << " w]" << std::flush;
return RHM_IORES_AIO_WAIT;
}
Modified: store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-10-09 15:55:12 UTC (rev 978)
+++ store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-10-09 16:01:15 UTC (rev 979)
@@ -51,7 +51,7 @@
CPPUNIT_TEST(RecoverReadTest);
CPPUNIT_TEST(RecoveredReadTest);
CPPUNIT_TEST(RecoveredDequeueTest);
-// CPPUNIT_TEST(ComplexRecoveryTest1);
+ CPPUNIT_TEST(ComplexRecoveryTest1);
CPPUNIT_TEST(EncodeTest_000);
CPPUNIT_TEST(EncodeTest_001);
CPPUNIT_TEST(EncodeTest_002);
Modified: store/trunk/cpp/tests/jrnl/janalyze.py
===================================================================
--- store/trunk/cpp/tests/jrnl/janalyze.py 2007-10-09 15:55:12 UTC (rev 978)
+++ store/trunk/cpp/tests/jrnl/janalyze.py 2007-10-09 16:01:15 UTC (rev 979)
@@ -25,6 +25,7 @@
from struct import unpack, calcsize
from time import gmtime, strftime
+base_file_name = 'test'
dblk_size = 128
sblk_size = 4 * dblk_size
file_size = (3072 + 1) * sblk_size
@@ -359,8 +360,6 @@
return ''
def __str__(self):
-# if self.enq_tail == None:
-# return '%s %s [no tail]' % (Hdr.__str__(self), self.dsize, dstr)
return '%s %s%s %s %s' % (Hdr.__str__(self), print_xid(self.xidsize, self.xid), print_data(self.dsize, self.data), self.enq_tail, self.print_flags())
@@ -510,7 +509,7 @@
self.last_file = self.file_num == self.file_start - 1
if self.file_num < 0 or self.file_num >= num_files:
raise Exception('Bad file number %d' % self.file_num)
- file_name = 'jdata/test.%04d.jdat' % self.file_num
+ file_name = 'jdata/' + base_file_name + '.%04d.jdat' % self.file_num
self.f = open(file_name)
self.fhdr = load(self.f, Hdr)
if seek_flag and self.f.tell() != self.fro:
@@ -558,7 +557,7 @@
tss = ''
print 'Analyzing journal files:'
for i in range(0, num_files):
- file_name = 'jdata/test.%04d.jdat' % i
+ file_name = 'jdata/' + base_file_name + '.%04d.jdat' % i
f = open(file_name)
fhdr = load(f, Hdr)
if fhdr.empty():
17 years, 5 months