rhmessaging commits: r1721 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-21 16:24:33 -0500 (Thu, 21 Feb 2008)
New Revision: 1721
Modified:
mgmt/cumin/python/wooly/__init__.py
Log:
Tolerate page paths that start with '/'
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-02-21 21:23:31 UTC (rev 1720)
+++ mgmt/cumin/python/wooly/__init__.py 2008-02-21 21:24:33 UTC (rev 1721)
@@ -630,7 +630,7 @@
def unmarshal(self, string):
if string.startswith("/"):
- raise Exception("Illegal session string '" + string + "'")
+ string = string[1:]
elems = string.split("?")
16 years, 11 months
rhmessaging commits: r1720 - in store/trunk/cpp: tests and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: gordonsim
Date: 2008-02-21 16:23:31 -0500 (Thu, 21 Feb 2008)
New Revision: 1720
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/tests/SimpleTest.cpp
Log:
Fix test for changes to PersistableMessage
Turn async back on by default
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2008-02-21 18:53:14 UTC (rev 1719)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2008-02-21 21:23:31 UTC (rev 1720)
@@ -1363,7 +1363,7 @@
BdbMessageStore::Options::Options(const std::string& name) :
qpid::Options(name),
- storeAsync(false),
+ storeAsync(true),
storeForce(false),
numJrnlFiles(8),
jrnlFsizePgs(24)
Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp 2008-02-21 18:53:14 UTC (rev 1719)
+++ store/trunk/cpp/tests/SimpleTest.cpp 2008-02-21 21:23:31 UTC (rev 1720)
@@ -244,9 +244,9 @@
BdbMessageStore store;
store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
- Queue queue(name, 0, &store, 0);
+ Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
FieldTable settings;
- queue.create(settings);
+ queue->create(settings);
Message::shared_ptr msg = MessageUtils::createMessage(exchange, routingKey, messageId, 14);
MessageUtils::addContent(msg, data1);
@@ -257,7 +257,7 @@
table.setString("abc", "xyz");
msg->getProperties<MessageProperties>()->setApplicationHeaders(table);
- queue.enqueue(0, msg);
+ queue->enqueue(0, msg);
}//db will be closed
{
BdbMessageStore store;
@@ -302,16 +302,16 @@
BdbMessageStore store;
store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
- Queue queue(name, 0, &store, 0);
+ Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
FieldTable settings;
- queue.create(settings);
+ queue->create(settings);
Message::shared_ptr msg = MessageUtils::createMessage(exchange, routingKey, messageId, 7);
MessageUtils::addContent(msg, data);
msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
- queue.enqueue(0, msg);
- queue.dequeue(0, msg);
+ queue->enqueue(0, msg);
+ queue->dequeue(0, msg);
}//db will be closed
{
BdbMessageStore store;
@@ -355,20 +355,15 @@
store.appendContent(cpmsg, data1);
store.appendContent(cpmsg, data2);
- //AMQContentBody part1(data1);
- //msg->addContent(&part1);FIXME
- //AMQContentBody part2(data2);
- //msg->addContent(&part2);FIXME
-
//enqueue it
- Queue queue(name, 0, &store, 0);
+ Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
FieldTable settings;
- queue.create(settings);
- queue.enqueue(0, msg);
+ queue->create(settings);
+ queue->enqueue(0, msg);
//load it (without recovery)
DummyHandler handler;
- QueuedMessage qm(&queue, msg, 0);
+ QueuedMessage qm(queue.get(), msg, 0);
MessageDelivery::deliver(qm, handler, 0,
MessageDelivery::getBasicConsumeToken("ignore"), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12
CPPUNIT_ASSERT(handler.frames.size() > 2);
16 years, 11 months
rhmessaging commits: r1719 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-21 13:53:14 -0500 (Thu, 21 Feb 2008)
New Revision: 1719
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/brokergroup.py
mgmt/notes/justin-todo.txt
Log:
Adds a form to edit broker registrations names and group membership.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-02-21 18:52:49 UTC (rev 1718)
+++ mgmt/cumin/python/cumin/broker.py 2008-02-21 18:53:14 UTC (rev 1719)
@@ -135,6 +135,10 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
+ self.edit = BrokerEdit(app, "edit")
+ self.add_mode(self.edit)
+ self.set_edit_mode(self.edit)
+
self.remove = BrokerRemove(app, "remove")
self.add_mode(self.remove)
self.set_remove_mode(self.remove)
@@ -659,6 +663,82 @@
self.process_cancel(session, model)
+# XXX I would like to move this to brokergroup.py, once I fix the
+# python import issues
+class BrokerGroupInputSet(CheckboxInputSet):
+ def __init__(self, app, name, form):
+ super(BrokerGroupInputSet, self).__init__(app, name, form)
+
+ param = ListParameter(app, "param", BrokerGroupParameter(app, "item"))
+ self.add_parameter(param)
+ self.set_parameter(param)
+
+ def do_get_items(self, session, model):
+ return BrokerGroup.select()
+
+ def render_item_value(self, session, group):
+ return group.id
+
+ def render_item_content(self, session, group):
+ return group.name
+
+ def render_item_checked_attr(self, session, group):
+ return group in self.param.get(session) and "checked=\"checked\""
+
+class BrokerEdit(CuminForm, Frame):
+ def __init__(self, app, name):
+ super(BrokerEdit, self).__init__(app, name)
+
+ self.broker_name = TextInput(app, "name", self)
+ self.add_child(self.broker_name)
+
+ self.groups = BrokerGroupInputSet(app, "groups", self)
+ self.add_child(self.groups)
+
+ def get_title(self, session, reg):
+ return "Edit Broker '%s'" % reg.name
+
+ def validate(self, session):
+ error = None
+
+ name = self.broker_name.get(session)
+
+ if name == "":
+ error = EmptyInputError(self.broker_name)
+ self.broker_name.add_error(session, error)
+
+ return error is None
+
+ def process_cancel(self, session, reg):
+ branch = session.branch()
+ self.frame().show_view(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def process_submit(self, session, reg):
+ if self.validate(session):
+ action = self.app.model.broker_registration.edit
+ args = {"name": self.broker_name.get(session)}
+ action.invoke(reg, args)
+
+ for group in self.groups.get(session):
+ if group not in reg.groups:
+ reg.addBrokerGroup(group)
+
+ for group in reg.groups:
+ if group not in self.groups.get(session):
+ reg.removeBrokerGroup(group)
+
+ reg.syncUpdate()
+
+ self.process_cancel(session, reg)
+
+ def process_display(self, session, reg):
+ self.broker_name.set(session, reg.name)
+
+ for group in reg.groups:
+ self.groups.get(session).append(group)
+
+# XXX use reg, not broker, where appropriate
class BrokerRemove(CuminConfirmForm):
def get_title(self, session, broker):
return "Unregister Broker '%s'" % broker.name
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-02-21 18:52:49 UTC (rev 1718)
+++ mgmt/cumin/python/cumin/broker.strings 2008-02-21 18:53:14 UTC (rev 1719)
@@ -142,6 +142,7 @@
<tr>
<th class="actions" colspan="2">
<h2>Act on This Broker:</h2>
+ <a class="nav" href="{edit_href}">Edit</a>
<a href="{remove_href}">Unregister</a>
</th>
</tr>
@@ -201,19 +202,19 @@
[BrokerBrowser.cluster_html]
<li>{cluster_link}</li>
-[BrokerForm.css]
-table.BrokerForm td, table.BrokerForm th {
+[BrokerSetForm.css]
+table.BrokerSetForm td, table.BrokerSetForm th {
padding: 0.25em;
}
-[BrokerForm.html]
+[BrokerSetForm.html]
<form id="{id}" class="mform" method="post" action="?">
<div class="head">
<h1>{title}</h1>
</div>
<div class="body">
<fieldset>
- <table class="BrokerForm">
+ <table class="BrokerSetForm">
<tr>
<th>Name</th>
<th>Host Name or IP Address</th>
@@ -242,7 +243,7 @@
}())
</script>
-[BrokerForm.field_html]
+[BrokerSetForm.field_html]
<tr>
<td><input type="text" name="{field_name_name}" value="{field_name_value}" size="15" tabindex="100"/></td>
<td><input type="text" name="{field_address_name}" value="{field_address_value}" size="35" tabindex="100"/></td>
@@ -254,5 +255,39 @@
</td>
</tr>
-[BrokerForm.group_html]
+[BrokerSetForm.group_html]
<option value="{group_value}" {group_selected_attr}>{group_name}</option>
+
+[BrokerEdit.html]
+<form id="{id}" class="mform" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <span class="legend">Name</span>
+ <fieldset>{name}</fieldset>
+
+ <span class="legend">Groups</span>
+ <fieldset>{groups}</fieldset>
+
+ {hidden_inputs}
+ </div>
+ <div class="foot">
+ <a class="help action" href="{href}" target="help">Help</a>
+ {submit}
+ {cancel}
+ </div>
+</form>
+<script defer="defer">
+(function() {
+ var elem = wooly.doc().elembyid("{id}").node.elements[1];
+ elem.focus();
+ elem.select();
+}())
+</script>
+
+[BrokerGroupInputSet.item_html]
+<div class="field">
+ <input type="checkbox" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
+ {item_content}
+</div>
Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py 2008-02-21 18:52:49 UTC (rev 1718)
+++ mgmt/cumin/python/cumin/brokergroup.py 2008-02-21 18:53:14 UTC (rev 1719)
@@ -1,6 +1,7 @@
from mint import *
from wooly import *
from wooly.widgets import *
+from wooly.forms import *
from broker import BrokerSet
from widgets import *
@@ -38,6 +39,26 @@
self.app.model.broker_group.show(branch, group).show_view(branch)
return fmt_olink(branch, group, name=data["name"])
+class BrokerGroupInputSet(CheckboxInputSet):
+ def __init__(self, app, name, form):
+ super(BrokerGroupInputSet, self).__init__(app, name, form)
+
+ param = ListParameter(app, "param", BrokerGroupParameter(app, "item"))
+ self.add_parameter(param)
+ self.set_parameter(param)
+
+ def do_get_items(self, session, model):
+ return BrokerGroup.select()
+
+ def render_item_value(self, session, group):
+ return group.id
+
+ def render_item_content(self, session, group):
+ return group.name
+
+ def render_item_checked_attr(self, session, group):
+ return group in self.param.get(session) and "checked=\"checked\""
+
class BrokerGroupFrame(CuminFrame):
def __init__(self, app, name):
super(BrokerGroupFrame, self).__init__(app, name)
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-02-21 18:52:49 UTC (rev 1718)
+++ mgmt/notes/justin-todo.txt 2008-02-21 18:53:14 UTC (rev 1719)
@@ -12,16 +12,18 @@
* Get rid of single object confirms
- * No way to ungroupify a broker
-
- * No broker edit form
-
* Add examples of legit broker addresses in broker add form
- * Validate broker and group names in forms
+ * Add broker reg name unique constraint and validation
Deferred
+ * See if we can't avoid the app.add_parameter in Parameter; adding to
+ page somehow would make a lot more sense
+
+ * In validate methods, instead of using an error var, add an error to
+ the form indicating that the form has member widgets with errors.
+
* Unregistering a broker doesn't disconnect it
* Don't let anyone close mgmt clients
@@ -74,24 +76,8 @@
* Indicate how old stats are
- * Add broker reg name unique constraint and validation
-
- * Whereever it makes sense, add a switch to display living, dead, or
- all objects
-
- * BrokerSetForm displays no rows instead of [None] with some filters
-
- * Add an edit form for broker registrations so you can change their
- names, and also their group membership
-
* Add inactive state to some status lights
- * Paginate producers
-
- * Paginate consumers
-
- * Email amqp-list, Jonathan, and Lana with doc requirements for mgmt
-
* Ask tross to take some prints out of ManagedBroker.start
* Add a do_get_item_count, and cache result for use by get_item_count
@@ -115,8 +101,6 @@
* Restore high-low
- * Fix sqlobject init: make it happen at cumin init
-
* "remove broker groups"
* "shutdown broker groups"
@@ -130,14 +114,10 @@
* Add a wooly.focus(id) method to replace the ad-hoc javascript I'm
using
- * The granularity of radio and checkbox disabling seems to be off
-
* Make the status lights also be links to an appropriate view
- Defer until we know what we're going to link to
- * Add a CuminItemSet with add/edit/remove href parts
-
* Add a parameter that takes a modelclass
* Make it a little simpler to express hrefs
@@ -146,8 +126,6 @@
* Add an error banner to form
- * Use wsgiref instead of BaseHTTPServer
-
* Separate wooly stuff into its own devel subdir
* Consider having a cssclass set on widgets
16 years, 11 months
rhmessaging commits: r1718 - mgmt/mint/sql.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-21 13:52:49 -0500 (Thu, 21 Feb 2008)
New Revision: 1718
Modified:
mgmt/mint/sql/schema.sql
Log:
Take the extra index statements out of schema.sql as they are loaded separately now
Modified: mgmt/mint/sql/schema.sql
===================================================================
--- mgmt/mint/sql/schema.sql 2008-02-21 18:34:13 UTC (rev 1717)
+++ mgmt/mint/sql/schema.sql 2008-02-21 18:52:49 UTC (rev 1718)
@@ -457,11 +457,3 @@
ALTER TABLE vhost ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES broker (id) ON DELETE SET NULL;
ALTER TABLE vhost_stats ADD CONSTRAINT vhost_id_exists FOREIGN KEY (vhost_id) REFERENCES vhost (id) ON DELETE SET NULL;
-
-create index queue_vhost_id_idx on queue (vhost_id);
-create index exchange_vhost_id_idx on exchange (vhost_id);
-create index client_vhost_id_idx on client (vhost_id);
-
-create index queue_stats_queue_id_idx on queue_stats (queue_id);
-create index exchange_stats_exchange_id_idx on exchange_stats (exchange_id);
-create index client_stats_client_id_idx on client_stats (client_id);
16 years, 11 months
rhmessaging commits: r1717 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-21 13:34:13 -0500 (Thu, 21 Feb 2008)
New Revision: 1717
Modified:
mgmt/cumin/python/wooly/__init__.py
Log:
Check for empy param.widget so that parameters can be used to describe
list elements.
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-02-21 17:15:49 UTC (rev 1716)
+++ mgmt/cumin/python/wooly/__init__.py 2008-02-21 18:34:13 UTC (rev 1717)
@@ -494,7 +494,8 @@
index = dict()
for param in self.parameters:
- index[(param.widget.page(), param.path())] = param
+ if param.widget:
+ index[(param.widget.page(), param.path())] = param
self.parameter_index = index
16 years, 11 months
rhmessaging commits: r1716 - mgmt/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-21 12:15:49 -0500 (Thu, 21 Feb 2008)
New Revision: 1716
Modified:
mgmt/mint/Makefile
Log:
Don't append the index sql to the schema.sql file
Modified: mgmt/mint/Makefile
===================================================================
--- mgmt/mint/Makefile 2008-02-20 18:05:56 UTC (rev 1715)
+++ mgmt/mint/Makefile 2008-02-21 17:15:49 UTC (rev 1716)
@@ -17,4 +17,3 @@
schema-sql:
sqlobject-admin sql -m mint -m mint.schema -c ${dsn} | sed -e '1,2d' > sql/schema.sql
- cat sql/indexes.sql >> sql/schema.sql
16 years, 11 months
rhmessaging commits: r1715 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-02-20 13:05:56 -0500 (Wed, 20 Feb 2008)
New Revision: 1715
Modified:
store/trunk/cpp/tests/persistence.py
store/trunk/cpp/tests/system_test.sh
Log:
Fixed failure of python persistence test. Also fixed the silent failure of the python script - so if the test fails again, cruisecontrol will notice.
Modified: store/trunk/cpp/tests/persistence.py
===================================================================
--- store/trunk/cpp/tests/persistence.py 2008-02-20 17:27:36 UTC (rev 1714)
+++ store/trunk/cpp/tests/persistence.py 2008-02-20 18:05:56 UTC (rev 1715)
@@ -346,9 +346,11 @@
try:
getattr(self, phase)()
print phase, "succeeded"
+ res = True;
except Exception, e:
print phase, "failed: ", e
traceback.print_exc()
+ res = False
self.channel.session_close()
@@ -358,7 +360,7 @@
import time
time.sleep(1)
- return True
+ return res
def setBroker(self, broker):
Modified: store/trunk/cpp/tests/system_test.sh
===================================================================
--- store/trunk/cpp/tests/system_test.sh 2008-02-20 17:27:36 UTC (rev 1714)
+++ store/trunk/cpp/tests/system_test.sh 2008-02-20 18:05:56 UTC (rev 1715)
@@ -64,7 +64,7 @@
while ((sync <= 1)); do
echo
if ((sync == 1)); then
- JRNLFLAGS="--store-directory ${WORKING_DIR} --store-force yes"
+ JRNLFLAGS="--store-directory ${WORKING_DIR} --store-async yes --store-force yes"
mode='jrnl'
echo 'Journal (AIO) persistence...'
else
16 years, 11 months
rhmessaging commits: r1713 - mgmt/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-20 12:25:09 -0500 (Wed, 20 Feb 2008)
New Revision: 1713
Modified:
mgmt/bin/devel-reload-database
Log:
Make the db reload script resilient to the schema already being
removed.
Modified: mgmt/bin/devel-reload-database
===================================================================
--- mgmt/bin/devel-reload-database 2008-02-20 16:09:24 UTC (rev 1712)
+++ mgmt/bin/devel-reload-database 2008-02-20 17:25:09 UTC (rev 1713)
@@ -5,7 +5,8 @@
exit 1
fi
-psql -U "$1" -d "$2" -c "drop schema public cascade; create schema public"
+psql -U "$1" -d "$2" -c "drop schema public cascade"
+psql -U "$1" -d "$2" -c "create schema public"
psql -U "$1" -d "$2" -f "$DEVEL_HOME"/mint/sql/schema.sql
python "$DEVEL_HOME"/cumin/python/cumin/demo.py postgresql://"$1"@localhost/"$2"
16 years, 11 months
rhmessaging commits: r1712 - store/branches/java/M2.1/java/bdbstore.
by rhmessaging-commits@lists.jboss.org
Author: rupertlssmith
Date: 2008-02-20 11:09:24 -0500 (Wed, 20 Feb 2008)
New Revision: 1712
Modified:
store/branches/java/M2.1/java/bdbstore/pom.xml
Log:
Updated pom for M2.1 version.
Modified: store/branches/java/M2.1/java/bdbstore/pom.xml
===================================================================
--- store/branches/java/M2.1/java/bdbstore/pom.xml 2008-02-20 15:58:08 UTC (rev 1711)
+++ store/branches/java/M2.1/java/bdbstore/pom.xml 2008-02-20 16:09:24 UTC (rev 1712)
@@ -22,14 +22,14 @@
<groupId>org.etp.qpid</groupId>
<artifactId>qpid-bdbstore</artifactId>
<packaging>jar</packaging>
- <version>1.0-incubating-M2-SNAPSHOT</version>
+ <version>1.0-incubating-M2.1-SNAPSHOT</version>
<name>Qpid BDB Store</name>
<url>http://cwiki.apache.org/confluence/display/qpid</url>
<parent>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid</artifactId>
- <version>1.0-incubating-M2-SNAPSHOT</version>
+ <version>1.0-incubating-M2.1-SNAPSHOT</version>
</parent>
<!-- Local repository for the BerkelyDB-je so we don't have to use the installer script -->
16 years, 11 months
rhmessaging commits: r1711 - in store/trunk/cpp: lib/jrnl and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-02-20 10:58:08 -0500 (Wed, 20 Feb 2008)
New Revision: 1711
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/JournalImpl.h
store/trunk/cpp/lib/jrnl/enq_map.cpp
store/trunk/cpp/lib/jrnl/txn_map.cpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp
store/trunk/cpp/tests/jrnl/run-journal-tests
Log:
Bugfix for intermittent JMS failures; also added scoped locks to emap and tmap classes. Some python tool bugfixes also
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2008-02-20 14:55:14 UTC (rev 1710)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2008-02-20 15:58:08 UTC (rev 1711)
@@ -48,8 +48,8 @@
static const u_int8_t MESSAGE_MESSAGE = 1;
static const u_int8_t BASIC_MESSAGE = 2;
bool BdbMessageStore::useAsync;
-qpid::sys::Duration BdbMessageStore::defJournalGetEventsTimeout(1000000); // 1ms
-qpid::sys::Duration BdbMessageStore::defJournalFlushTimeout(1000000000); // 1 sec
+qpid::sys::Duration BdbMessageStore::defJournalGetEventsTimeout(10 * qpid::sys::TIME_MSEC); // 10ms
+qpid::sys::Duration BdbMessageStore::defJournalFlushTimeout(500 * qpid::sys::TIME_MSEC); // 0.5s
unsigned int TxnCtxt::count = 0;
qpid::sys::Mutex TxnCtxt::globalSerialiser;
@@ -274,9 +274,8 @@
{
JournalImpl* jQueue = static_cast<JournalImpl*>(eqs);
jQueue->delete_jrnl_files();
- queue.setExternalQueueStore(NULL); // will delete the journal if exists
+ queue.setExternalQueueStore(0); // will delete the journal if exists
}
-
}
void BdbMessageStore::create(const PersistableExchange& exchange)
@@ -906,7 +905,9 @@
void BdbMessageStore::flush(const qpid::broker::PersistableQueue& queue)
{
if (!usingJrnl()) return;
+ if (queue.getExternalQueueStore() == 0) return;
checkInit();
+ std::string qn = queue.getName();
try {
JournalImpl* jc = static_cast<JournalImpl*>(queue.getExternalQueueStore());
if (jc){
@@ -914,7 +915,7 @@
/*rhm::journal::iores res =*/ jc->flush();
}
}catch (const journal::jexception& e) {
- THROW_STORE_EXCEPTION(std::string("Queue ") + queue.getName() + ": flush() failed: " + e.what() );
+ THROW_STORE_EXCEPTION(std::string("Queue ") + qn + ": flush() failed: " + e.what() );
}
}
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2008-02-20 14:55:14 UTC (rev 1710)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2008-02-20 15:58:08 UTC (rev 1711)
@@ -25,6 +25,7 @@
#include "jrnl/jerrno.hpp"
#include "jrnl/jexception.hpp"
+#include "jrnl/slock.hpp"
#include "StoreException.h"
#include <qpid/sys/Monitor.h>
@@ -56,6 +57,7 @@
_dtok(),
_external(false)
{
+ ::pthread_mutex_init(&_getf_mutex, 0);
getEventsFireEventsPtr = new GetEventsFireEvent(this, getEventsTimeout);
inactivityFireEventPtr = new InactivityFireEvent(this, flushTimeout);
journalTimer.start();
@@ -77,6 +79,7 @@
::free(_datap);
_datap = 0;
}
+ ::pthread_mutex_destroy(&_getf_mutex);
}
void
@@ -232,13 +235,12 @@
}
const iores
-JournalImpl::flush()
+JournalImpl::flush(const bool block_till_aio_cmpl)
{
- const iores res = jcntl::flush();
- if (_wmgr.get_aio_evt_rem() && !getEventsTimerSetFlag) {
- getEventsFireEventsPtr->addRef();
- journalTimer.add(getEventsFireEventsPtr);
- getEventsTimerSetFlag = true;
+ const iores res = jcntl::flush(block_till_aio_cmpl);
+ {
+ slock s(&_getf_mutex);
+ if (_wmgr.get_aio_evt_rem() && !getEventsTimerSetFlag) { setGetEventTimer(); }
}
return res;
}
@@ -246,22 +248,12 @@
void
JournalImpl::getEventsFire()
{
- if (_wmgr.get_aio_evt_rem()) {
- try { jcntl::get_wr_events(); }
- catch (const jexception& e)
- {
- // Another thread has already called get_wr_events() and it is still busy, ignore
- if (e.err_code() != jerrno::JERR__PTHREAD) {
- throw;
- }
- }
- }
+ slock s(&_getf_mutex);
getEventsTimerSetFlag = false;
if (_wmgr.get_aio_evt_rem()) {
- getEventsFireEventsPtr->addRef();
- journalTimer.add(getEventsFireEventsPtr);
- getEventsTimerSetFlag = true;
+ jcntl::get_wr_events();
}
+ if (_wmgr.get_aio_evt_rem()) { setGetEventTimer(); }
}
void
Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h 2008-02-20 14:55:14 UTC (rev 1710)
+++ store/trunk/cpp/lib/JournalImpl.h 2008-02-20 15:58:08 UTC (rev 1711)
@@ -70,6 +70,7 @@
bool getEventsTimerSetFlag;
qpid::intrusive_ptr<qpid::broker::TimerTask> getEventsFireEventsPtr;
+ pthread_mutex_t _getf_mutex; // getEventsTimerSetFlag mutex
bool writeActivityFlag;
bool flushTriggeredFlag;
@@ -135,13 +136,19 @@
void stop(bool block_till_aio_cmpl = false);
// Overrides for get_events timer
- const journal::iores flush();
+ const journal::iores flush(const bool block_till_aio_cmpl = false);
// TimerTask callback
void getEventsFire();
void flushFire();
private:
+ inline void setGetEventTimer()
+ {
+ getEventsFireEventsPtr->addRef();
+ journalTimer.add(getEventsFireEventsPtr);
+ getEventsTimerSetFlag = true;
+ }
void handleIoResult(const journal::iores r);
static void aio_wr_callback(jcntl* journal, std::vector<journal::data_tok*>& dtokl);
// static void aio_rd_callback(jcntl* journal, std::vector<u_int16_t>& pil);
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2008-02-20 14:55:14 UTC (rev 1710)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2008-02-20 15:58:08 UTC (rev 1711)
@@ -33,6 +33,7 @@
#include <iomanip>
#include <sstream>
#include <jrnl/jerrno.hpp>
+#include <jrnl/slock.hpp>
namespace rhm
@@ -60,10 +61,12 @@
void
enq_map::insert_fid(const u_int64_t rid, const u_int16_t fid, const bool locked)
{
+ std::pair<emap_itr, bool> ret;
fid_lock_pair rec(fid, locked);
- pthread_mutex_lock(&_mutex);
- std::pair<emap_itr, bool> ret = _map.insert(emap_param(rid, rec));
- pthread_mutex_unlock(&_mutex);
+ {
+ slock s(&_mutex);
+ ret = _map.insert(emap_param(rid, rec));
+ }
if (ret.second == false)
{
std::ostringstream oss;
@@ -75,9 +78,11 @@
const u_int16_t
enq_map::get_fid(const u_int64_t rid)
{
- pthread_mutex_lock(&_mutex);
- emap_itr itr = _map.find(rid);
- pthread_mutex_unlock(&_mutex);
+ emap_itr itr;
+ {
+ slock s(&_mutex);
+ itr = _map.find(rid);
+ }
if (itr == _map.end()) // not found in map
{
std::ostringstream oss;
@@ -96,34 +101,33 @@
const u_int16_t
enq_map::get_remove_fid(const u_int64_t rid, const bool txn_flag)
{
- pthread_mutex_lock(&_mutex);
+ slock s(&_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
- pthread_mutex_unlock(&_mutex);
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "enq_map", "get_remove_fid");
}
if (itr->second.second && !txn_flag) // locked, but not a commit/abort
{
- pthread_mutex_unlock(&_mutex);
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_LOCKED, oss.str(), "enq_map", "get_remove_fid");
}
u_int16_t fid = itr->second.first;
_map.erase(itr);
- pthread_mutex_unlock(&_mutex);
return fid;
}
const bool
enq_map::is_enqueued(const u_int64_t rid)
{
- pthread_mutex_lock(&_mutex);
- emap_itr itr = _map.find(rid);
- pthread_mutex_unlock(&_mutex);
+ emap_itr itr;
+ {
+ slock s(&_mutex);
+ itr = _map.find(rid);
+ }
if (itr == _map.end()) // not found in map
return false;
if (itr->second.second) // locked
@@ -134,41 +138,39 @@
void
enq_map::lock(const u_int64_t rid)
{
- pthread_mutex_lock(&_mutex);
+ slock s(&_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
- pthread_mutex_unlock(&_mutex);
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.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);
+ slock s(&_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
- pthread_mutex_unlock(&_mutex);
std::ostringstream oss;
oss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.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);
- emap_itr itr = _map.find(rid);
- pthread_mutex_unlock(&_mutex);
+ emap_itr itr;
+ {
+ slock s(&_mutex);
+ itr = _map.find(rid);
+ }
if (itr == _map.end()) // not found in map
{
std::ostringstream oss;
@@ -182,20 +184,22 @@
enq_map::rid_list(std::vector<u_int64_t>& rv)
{
rv.clear();
- pthread_mutex_lock(&_mutex);
- for (emap_itr itr = _map.begin(); itr != _map.end(); itr++)
- rv.push_back(itr->first);
- pthread_mutex_unlock(&_mutex);
+ {
+ slock s(&_mutex);
+ for (emap_itr itr = _map.begin(); itr != _map.end(); itr++)
+ rv.push_back(itr->first);
+ }
}
void
enq_map::fid_list(std::vector<u_int16_t>& fv)
{
fv.clear();
- pthread_mutex_lock(&_mutex);
- for (emap_itr itr = _map.begin(); itr != _map.end(); itr++)
- fv.push_back(itr->second.first);
- pthread_mutex_unlock(&_mutex);
+ {
+ slock s(&_mutex);
+ for (emap_itr itr = _map.begin(); itr != _map.end(); itr++)
+ fv.push_back(itr->second.first);
+ }
}
} // namespace journal
Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp 2008-02-20 14:55:14 UTC (rev 1710)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2008-02-20 15:58:08 UTC (rev 1711)
@@ -34,6 +34,7 @@
#include <sstream>
#include <jrnl/jerrno.hpp>
#include <jrnl/jexception.hpp>
+#include <jrnl/slock.hpp>
namespace rhm
{
@@ -64,7 +65,7 @@
txn_map::insert_txn_data(const std::string& xid, const txn_data& td)
{
bool ok = true;
- pthread_mutex_lock(&_mutex);
+ slock s(&_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // not found in map
{
@@ -76,16 +77,17 @@
}
else
itr->second.push_back(td);
- pthread_mutex_unlock(&_mutex);
return ok;
}
const txn_data_list
txn_map::get_tdata_list(const std::string& xid)
{
- pthread_mutex_lock(&_mutex);
- xmap_itr itr = _map.find(xid);
- pthread_mutex_unlock(&_mutex);
+ xmap_itr itr;
+ {
+ slock s(&_mutex);
+ itr = _map.find(xid);
+ }
if (itr == _map.end()) // not found in map
{
std::ostringstream oss;
@@ -98,11 +100,10 @@
const txn_data_list
txn_map::get_remove_tdata_list(const std::string& xid)
{
- pthread_mutex_lock(&_mutex);
+ slock s(&_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // not found in map
{
- pthread_mutex_unlock(&_mutex);
std::ostringstream oss;
oss << std::hex << "xid=" << xid_format(xid);
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "txn_map",
@@ -110,16 +111,17 @@
}
txn_data_list list = itr->second;
_map.erase(itr);
- pthread_mutex_unlock(&_mutex);
return list;
}
const bool
txn_map::in_map(const std::string& xid)
{
- pthread_mutex_lock(&_mutex);
- xmap_itr itr = _map.find(xid);
- pthread_mutex_unlock(&_mutex);
+ xmap_itr itr;
+ {
+ slock s(&_mutex);
+ itr = _map.find(xid);
+ }
if (itr == _map.end()) // not found in map
return false;
return true;
@@ -128,9 +130,11 @@
const u_int32_t
txn_map::get_rid_count(const std::string& xid)
{
- pthread_mutex_lock(&_mutex);
- xmap_itr itr = _map.find(xid);
- pthread_mutex_unlock(&_mutex);
+ xmap_itr itr;
+ {
+ slock s(&_mutex);
+ itr = _map.find(xid);
+ }
if (itr == _map.end()) // not found in map
{
std::ostringstream oss;
@@ -143,11 +147,10 @@
const bool
txn_map::is_txn_synced(const std::string& xid)
{
- pthread_mutex_lock(&_mutex);
+ slock s(&_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // not found in map
{
- pthread_mutex_unlock(&_mutex);
std::ostringstream oss;
oss << std::hex << "xid=" << xid_format(xid);
throw jexception(jerrno::JERR_MAP_NOTFOUND, oss.str(), "txn_map", "is_txn_synced");
@@ -161,7 +164,6 @@
break;
}
}
- pthread_mutex_unlock(&_mutex);
return is_synced;
}
@@ -170,23 +172,24 @@
{
bool ok = true;
bool found = false;
- pthread_mutex_lock(&_mutex);
- xmap_itr itr = _map.find(xid);
- if (itr == _map.end()) // not found in map
- ok = false;
- else
{
- for (tdl_itr litr = itr->second.begin(); litr < itr->second.end(); litr++)
+ slock s(&_mutex);
+ xmap_itr itr = _map.find(xid);
+ if (itr == _map.end()) // not found in map
+ ok = false;
+ else
{
- if (litr->_rid == rid)
+ for (tdl_itr litr = itr->second.begin(); litr < itr->second.end(); litr++)
{
- found = true;
- litr->_aio_compl = true;
- break;
+ if (litr->_rid == rid)
+ {
+ found = true;
+ litr->_aio_compl = true;
+ break;
+ }
}
}
}
- pthread_mutex_unlock(&_mutex);
if (ok && !found)
{
std::ostringstream oss;
@@ -200,10 +203,11 @@
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);
+ {
+ slock s(&_mutex);
+ for (xmap_itr itr = _map.begin(); itr != _map.end(); itr++)
+ xv.push_back(itr->first);
+ }
}
// static fn
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-02-20 14:55:14 UTC (rev 1710)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-02-20 15:58:08 UTC (rev 1711)
@@ -37,6 +37,8 @@
#include <jrnl/jcntl.hpp>
#include <jrnl/jerrno.hpp>
+#include <iostream> // debug
+
namespace rhm
{
namespace journal
Modified: store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-02-20 14:55:14 UTC (rev 1710)
+++ store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-02-20 15:58:08 UTC (rev 1711)
@@ -210,7 +210,7 @@
f.read(rem_in_blk(f, dblk_size))
def check(self):
- if self.empty() or self.magic[-1] not in ['a', 'c', 'd', 'e', 'f', 'x']:
+ if self.empty() or self.magic[:3] != 'RHM' or self.magic[-1] not in ['a', 'c', 'd', 'e', 'f', 'x']:
return True
if self.ver != hdr_ver and self.magic[-1] != 'x':
raise Exception('%s: Invalid header version: found %d, expected %d.' % (self, self.ver, hdr_ver))
Modified: store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp 2008-02-20 14:55:14 UTC (rev 1710)
+++ store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp 2008-02-20 15:58:08 UTC (rev 1711)
@@ -98,8 +98,13 @@
oss << path << "jfile_chk.py -q";
oss << " -d " << jpp->jdir();
oss << " -b " << jpp->base_filename();
- oss << " -c" << _args.test_case_csv_file_name;
- oss << " -t" << (*tci)->test_case_num();
+ // TODO: When jfile_check.py can handle previously recovered journals for
+ // specific tests, then remove this exclusion.
+ if (!_args.recover_mode)
+ {
+ oss << " -c" << _args.test_case_csv_file_name;
+ oss << " -t" << (*tci)->test_case_num();
+ }
bool res = system(oss.str().c_str()) == 0;
(*tci)->set_fmt_chk_res(res, jpp->jid());
}
Modified: store/trunk/cpp/tests/jrnl/run-journal-tests
===================================================================
--- store/trunk/cpp/tests/jrnl/run-journal-tests 2008-02-20 14:55:14 UTC (rev 1710)
+++ store/trunk/cpp/tests/jrnl/run-journal-tests 2008-02-20 15:58:08 UTC (rev 1711)
@@ -6,8 +6,38 @@
# Run jtt using default test set
echo
+echo "***** Mode 1: New journal instance, no recover, single journal *****"
+rm -rf /tmp/test_0*
$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --format-chk || fail = 1
echo
+#echo "***** Mode 2: New journal instance, no recover, multiple journals *****"
+#rm -rf /tmp/test_0*
+#$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --format-chk --num-jrnls 5 || fail = 1
+#echo
+#echo "***** Mode 3: Reuse journal instance, no recover, single journal *****"
+#rm -rf /tmp/test_0*
+#$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --format-chk || fail = 1
+#echo
+#echo "***** Mode 4: Reuse journal instance, no recover, multiple journals *****"
+#rm -rf /tmp/test_0*
+#$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --format-chk --num-jrnls 5 || fail = 1
+#echo
+#echo "***** Mode 5: New journal instance, recover previous test journal, single journal *****"
+#rm -rf /tmp/test_0*
+#$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --recover-mode --format-chk || fail = 1
+#echo
+#echo "***** Mode 6: New journal instance, recover previous test journal, multiple journals *****"
+#rm -rf /tmp/test_0*
+#$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --recover-mode --format-chk --num-jrnls 5 || fail = 1
+#echo
+#echo "***** Mode 7: Reuse journal instance, recover previous test journal, single journal *****"
+#rm -rf /tmp/test_0*
+#$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --recover-mode --format-chk || fail = 1
+#echo
+#echo "***** Mode 8: Reuse journal instance, recover previous test journal, multiple journals *****"
+#rm -rf /tmp/test_0*
+#$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --recover-mode --format-chk --num-jrnls 5 || fail = 1
+#echo
# Run cpp-unit tests
LD_PRELOAD=$pwd/.libs/libdlclose_noop.so DllPlugInTester -c -b $pwd/.libs/Journal*Tests.so || fail=1
16 years, 11 months