rhmessaging commits: r1928 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-17 13:07:13 -0400 (Thu, 17 Apr 2008)
New Revision: 1928
Modified:
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/stat.py
Log:
Append "/ sec" to rate chart legend elements.
Adjust titles.
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-04-17 16:50:49 UTC (rev 1927)
+++ mgmt/cumin/python/cumin/exchange.py 2008-04-17 17:07:13 UTC (rev 1928)
@@ -384,7 +384,7 @@
self.mode = "rate"
def render_title(self, session, exchange):
- return "Received, Routed, and Dropped Messages per Second"
+ return "Messages Received, Routed, and Dropped"
class ExchangeProducerSet(ItemSet):
def get_args(self, session):
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-04-17 16:50:49 UTC (rev 1927)
+++ mgmt/cumin/python/cumin/queue.py 2008-04-17 17:07:13 UTC (rev 1928)
@@ -464,7 +464,7 @@
self.mode = "rate"
def render_title(self, session, queue):
- return "Enqueues and Dequeues per Second"
+ return "Messages Enqueued and Dequeued"
class DepthChart(StatValueChart):
def __init__(self, app, name):
@@ -496,7 +496,7 @@
self.mode = "rate"
def render_title(self, session, queue):
- return "Enqueues and Dequeues per Second"
+ return "Durable Messages Enqueued and Dequeued"
class QueueStatsTransactions(Widget):
def __init__(self, app, name):
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-04-17 16:50:49 UTC (rev 1927)
+++ mgmt/cumin/python/cumin/stat.py 2008-04-17 17:07:13 UTC (rev 1928)
@@ -248,7 +248,11 @@
chart.plot_frame()
- titles = [x.title for x in stats]
+ if self.mode.get(session) == "rate":
+ titles = ["%s / sec" % x.title for x in stats]
+ else:
+ titles = [x.title for x in stats]
+
chart.plot_legend(titles, colors)
writer = Writer()
16 years, 2 months
rhmessaging commits: r1927 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-04-17 12:50:49 -0400 (Thu, 17 Apr 2008)
New Revision: 1927
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
Log:
Use a better object-id for the store object
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2008-04-17 16:00:34 UTC (rev 1926)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2008-04-17 16:50:49 UTC (rev 1927)
@@ -91,7 +91,7 @@
mgmtObject->set_defaultInitialFileCount(numJrnlFiles);
mgmtObject->set_defaultDataFileSize(jrnlFsizePgs);
- agent->addObject(mgmtObject, 3, 0);
+ agent->addObject(mgmtObject, 50, 1);
}
}
}
16 years, 2 months
rhmessaging commits: r1926 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-17 12:00:34 -0400 (Thu, 17 Apr 2008)
New Revision: 1926
Modified:
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
Log:
Restore message and byte statistics to exchanges.
Improve the receive/route/drop chart.
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-04-17 15:48:07 UTC (rev 1925)
+++ mgmt/cumin/python/cumin/exchange.py 2008-04-17 16:00:34 UTC (rev 1926)
@@ -362,11 +362,10 @@
def __init__(self, app, name):
super(ExchangeStats, self).__init__(app, name)
+ self.add_child(StatSet(app, "messages", "message"))
self.add_child(StatSet(app, "general", "general"))
- chart = StatValueChart(app, "inout")
- chart.stats = ("msgReceives", "msgRoutes")
- chart.mode = "rate"
+ chart = self.ReceiveRouteDropRateChart(app, "recvroutedrop")
self.add_child(chart)
chart = StatValueChart(app, "producers")
@@ -376,6 +375,17 @@
def render_title(self, session):
return "Statistics"
+ class ReceiveRouteDropRateChart(StatValueChart):
+ def __init__(self, app, name):
+ super(ExchangeStats.ReceiveRouteDropRateChart, self).__init__ \
+ (app, name)
+
+ self.stats = ("msgReceives", "msgRoutes", "msgDrops")
+ self.mode = "rate"
+
+ def render_title(self, session, exchange):
+ return "Received, Routed, and Dropped Messages per Second"
+
class ExchangeProducerSet(ItemSet):
def get_args(self, session):
return self.frame.get_args(session)
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2008-04-17 15:48:07 UTC (rev 1925)
+++ mgmt/cumin/python/cumin/exchange.strings 2008-04-17 16:00:34 UTC (rev 1926)
@@ -201,11 +201,14 @@
<table class="layout">
<tr>
<td class="twocol">
+ <h2>Messages</h2>
+ {messages}
+
<h2>General</h2>
{general}
</td>
<td class="twocol">
- {inout}
+ {recvroutedrop}
{producers}
</td>
</tr>
16 years, 2 months
rhmessaging commits: r1925 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-17 11:48:07 -0400 (Thu, 17 Apr 2008)
New Revision: 1925
Modified:
mgmt/cumin/python/cumin/stat.strings
Log:
Some margin adjustments
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-04-17 15:38:22 UTC (rev 1924)
+++ mgmt/cumin/python/cumin/stat.strings 2008-04-17 15:48:07 UTC (rev 1925)
@@ -45,7 +45,7 @@
table.StatSet {
width: 25em;
border-collapse: collapse;
- margin: 0.5em;
+ margin: 0.5em 0.5em 1em 0.5em;
}
table.StatSet tr {
@@ -117,7 +117,7 @@
[StatValueChart.css]
div.StatValueChart {
font-size: 0.9em;
- margin: 0 0 1em 0;
+ margin: 0 0 1.5em 0;
width: 30em;
}
16 years, 2 months
rhmessaging commits: r1924 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-17 11:38:22 -0400 (Thu, 17 Apr 2008)
New Revision: 1924
Modified:
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/notes/justin-todo.txt
Log:
Finish reorganization of queue stats. Add separate views for
transaction and durability stats. Recategorize some stats. Add new
charts.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-04-16 16:14:16 UTC (rev 1923)
+++ mgmt/cumin/python/cumin/model.py 2008-04-17 15:38:22 UTC (rev 1924)
@@ -565,76 +565,56 @@
stat = CuminStat(self, "msgDepth")
stat.title = "Message Depth"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat.highlow = True
stat = CuminStat(self, "msgTotalEnqueues")
stat.title = "Msgs. Enqueued"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "msgTotalDequeues")
stat.title = "Msgs. Dequeued"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "byteDepth")
stat.title = "Byte Depth"
stat.unit = "byte"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat.highlow = True
stat = CuminStat(self, "byteTotalEnqueues")
stat.title = "Bytes Enqueued"
stat.unit = "byte"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "byteTotalDequeues")
stat.title = "Bytes Dequeued"
stat.unit = "byte"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "unackedMessages")
stat.title = "Msgs. Unacked"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat.highlow = True
stat = CuminStat(self, "messageLatencyMin")
stat.title = "Min. Msg. Latency"
stat.unit = "nanosecond"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "messageLatencyMax")
stat.title = "Max. Msg. Latency"
stat.unit = "nanosecond"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "messageLatencyAverage")
stat.title = "Avg. Msg. Latency"
stat.unit = "nanosecond"
- stat.categories = ("general",)
+ stat.categories = ("message",)
- stat = CuminStat(self, "messageLatencySamples")
- stat.title = "Msg. Latency Samples"
- stat.unit = "sample"
- stat.categories = ("general",)
-
- # Disk
-
- #stat = CuminStat(self, "diskPageSize")
- #stat.title = "Page size"
- #stat.categories = ("disk",)
-
- #stat = CuminStat(self, "diskPages")
- #stat.title = "Disk Pages"
- #stat.unit = "page"
- #stat.categories = ("general",)
-
- #stat = CuminStat(self, "diskAvailableSize")
- #stat.title = "Available size"
- #stat.categories = ("disk")
-
# Transactional
stat = CuminStat(self, "msgTxnEnqueues")
@@ -773,32 +753,32 @@
stat = CuminStat(self, "msgReceives")
stat.title = "Msgs. Received"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "msgRoutes")
stat.title = "Msgs. Routed"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "msgDrops")
stat.title = "Msgs. Dropped"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "byteReceives")
stat.title = "Bytes Received"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "byteRoutes")
stat.title = "Bytes Routed"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
stat = CuminStat(self, "byteDrops")
stat.title = "Bytes Dropped"
stat.unit = "message"
- stat.categories = ("general",)
+ stat.categories = ("message",)
def show_object(self, session, exchange):
frame = self.cumin_model.show_main(session)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-04-16 16:14:16 UTC (rev 1923)
+++ mgmt/cumin/python/cumin/queue.py 2008-04-17 15:38:22 UTC (rev 1924)
@@ -428,17 +428,19 @@
def __init__(self, app, name):
super(QueueStats, self).__init__(app, name)
- self.add_tab(GeneralQueueStats(app, "general"))
+ self.add_tab(QueueStatsGeneral(app, "gen"))
+ self.add_tab(QueueStatsDurability(app, "dur"))
+ self.add_tab(QueueStatsTransactions(app, "txn"))
def render_title(self, session):
return "Statistics"
-class GeneralQueueStats(Widget):
+class QueueStatsGeneral(Widget):
def __init__(self, app, name):
- super(GeneralQueueStats, self).__init__(app, name)
+ super(QueueStatsGeneral, self).__init__(app, name)
self.add_child(StatSet(app, "general", "general"))
- self.add_child(StatSet(app, "disk", "disk"))
+ self.add_child(StatSet(app, "messages", "message"))
chart = self.EnqueueDequeueRateChart(app, "enqdeq")
self.add_child(chart)
@@ -455,8 +457,8 @@
class EnqueueDequeueRateChart(StatValueChart):
def __init__(self, app, name):
- super(GeneralQueueStats.EnqueueDequeueRateChart, self).__init__ \
- (app, name)
+ super(QueueStatsGeneral.EnqueueDequeueRateChart,
+ self).__init__(app, name)
self.stats = ("msgTotalEnqueues", "msgTotalDequeues")
self.mode = "rate"
@@ -466,13 +468,76 @@
class DepthChart(StatValueChart):
def __init__(self, app, name):
- super(GeneralQueueStats.DepthChart, self).__init__(app, name)
+ super(QueueStatsGeneral.DepthChart, self).__init__(app, name)
self.stats = ("msgDepth",)
def render_title(self, session, queue):
return "Queue Depth"
+class QueueStatsDurability(Widget):
+ def __init__(self, app, name):
+ super(QueueStatsDurability, self).__init__(app, name)
+
+ self.add_child(StatSet(app, "messages", "persistent"))
+
+ chart = self.EnqueueDequeueRateChart(app, "enqdeq")
+ self.add_child(chart)
+
+ def render_title(self, session):
+ return "Durability"
+
+ class EnqueueDequeueRateChart(StatValueChart):
+ def __init__(self, app, name):
+ super(QueueStatsDurability.EnqueueDequeueRateChart,
+ self).__init__(app, name)
+
+ self.stats = ("msgPersistEnqueues", "msgPersistDequeues")
+ self.mode = "rate"
+
+ def render_title(self, session, queue):
+ return "Enqueues and Dequeues per Second"
+
+class QueueStatsTransactions(Widget):
+ def __init__(self, app, name):
+ super(QueueStatsTransactions, self).__init__(app, name)
+
+ self.add_child(StatSet(app, "transactions", "transaction"))
+ self.add_child(StatSet(app, "messages", "transactional"))
+
+ chart = self.EnqueueTransactionRateChart(app, "enqtxn")
+ self.add_child(chart)
+
+ chart = self.DequeueTransactionRateChart(app, "deqtxn")
+ self.add_child(chart)
+
+ def render_title(self, session):
+ return "Transactions"
+
+ class EnqueueTransactionRateChart(StatValueChart):
+ def __init__(self, app, name):
+ super(QueueStatsTransactions.EnqueueTransactionRateChart,
+ self).__init__(app, name)
+
+ self.stats = ("enqueueTxnStarts", "enqueueTxnCommits",
+ "enqueueTxnRejects")
+ self.mode = "rate"
+
+ def render_title(self, session, queue):
+ return "Enqueue Transaction Operations per Second"
+
+ class DequeueTransactionRateChart(StatValueChart):
+ def __init__(self, app, name):
+ super(QueueStatsTransactions.DequeueTransactionRateChart,
+ self).__init__(app, name)
+
+ self.stats = ("dequeueTxnStarts", "dequeueTxnCommits",
+ "dequeueTxnRejects")
+ self.mode = "rate"
+
+ def render_title(self, session, queue):
+ return "Dequeue Transaction Operations per Second"
+
class QueueConsumerSet(PaginatedItemSet):
def get_args(self, session):
return self.frame.get_args(session)
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2008-04-16 16:14:16 UTC (rev 1923)
+++ mgmt/cumin/python/cumin/queue.strings 2008-04-17 15:38:22 UTC (rev 1924)
@@ -185,10 +185,14 @@
<ul class="radiotabs tabs">{tabs}</ul>
<div class="radiotabs mode">{mode}</div>
-[GeneralQueueStats.html]
+[QueueStatsGeneral.html]
<table class="layout">
<tr>
<td class="twocol">
+ <h2>Messages</h2>
+ {messages}
+
+ <h2>General</h2>
{general}
</td>
<td class="twocol">
@@ -199,6 +203,36 @@
</tr>
</table>
+[QueueStatsDurability.html]
+<table class="layout">
+ <tr>
+ <td class="twocol">
+ <h2>Durable Messages</h2>
+ {messages}
+ </td>
+ <td class="twocol">
+ {enqdeq}
+ </td>
+ </tr>
+</table>
+
+[QueueStatsTransactions.html]
+<table class="layout">
+ <tr>
+ <td class="twocol">
+ <h2>Transactions</h2>
+ {transactions}
+
+ <h2>Transactional Messages</h2>
+ {messages}
+ </td>
+ <td class="twocol">
+ {enqtxn}
+ {deqtxn}
+ </td>
+ </tr>
+</table>
+
[QueueConsumerSet.html]
<div class="sactions">
<h2>Act on Selected Consumers:</h2>
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-04-16 16:14:16 UTC (rev 1923)
+++ mgmt/notes/justin-todo.txt 2008-04-17 15:38:22 UTC (rev 1924)
@@ -28,6 +28,14 @@
* Check for per-row querying in BrokerSet
+ * stat.py:222 min_value is None somehow
+
+ * Need to prompt for password confirmation
+
+ * Blow up if someone adds a child with an existing name
+
+ * Fix the chart left side "pinch" problem
+
Deferred
* En dashes don't disappear on stat update
16 years, 2 months
rhmessaging commits: r1923 - in store/branches/java/M2.x/java/bdbstore: src/test/java/org and 3 other directories.
by rhmessaging-commits@lists.jboss.org
Author: ritchiem
Date: 2008-04-16 12:14:16 -0400 (Wed, 16 Apr 2008)
New Revision: 1923
Added:
store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/
store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/
store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/
store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/StoreContextRaceConditionTest.java
Modified:
store/branches/java/M2.x/java/bdbstore/pom.xml
Log:
Added test for RaceCondtion in present between BDBStore and Qpid Housekeeping thread.
Modified: store/branches/java/M2.x/java/bdbstore/pom.xml
===================================================================
--- store/branches/java/M2.x/java/bdbstore/pom.xml 2008-04-16 15:38:14 UTC (rev 1922)
+++ store/branches/java/M2.x/java/bdbstore/pom.xml 2008-04-16 16:14:16 UTC (rev 1923)
@@ -32,6 +32,10 @@
<version>1.0-incubating-M2.1-SNAPSHOT</version>
</parent>
+ <properties>
+ <topDirectoryLocation>..</topDirectoryLocation>
+ </properties>
+
<!-- Local repository for the BerkelyDB-je so we don't have to use the installer script -->
<repositories>
<repository>
@@ -78,6 +82,25 @@
<build>
<plugins>
+
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>QPID_HOME</name>
+ <value>${basedir}/${topDirectoryLocation}/broker</value>
+ </property>
+ </systemProperties>
+ <excludes>
+ <exclude>**/StoreContextRaceConditionTest.class</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+
<!-- Produce an all dependencies jar, to be used for running the hot backup utility as a standalone tool. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Added: store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/StoreContextRaceConditionTest.java
===================================================================
--- store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/StoreContextRaceConditionTest.java (rev 0)
+++ store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/StoreContextRaceConditionTest.java 2008-04-16 16:14:16 UTC (rev 1923)
@@ -0,0 +1,271 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.etp.qpid.server;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
+import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
+import org.apache.qpid.test.VMTestCase;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.NamingException;
+import java.io.File;
+
+public class StoreContextRaceConditionTest extends VMTestCase
+{
+ private static final Logger _logger = Logger.getLogger(StoreContextRaceConditionTest.class);
+ private long _TimeToLive = 0L;
+ private static long SECOND = 1000L;
+
+ private static final String LOGGING_KEY = "amqj.logging.level";
+
+ private String _loggingOriginal;
+
+ public void setUp() throws Exception
+ {
+ //Disable the logging
+ _loggingOriginal = System.getProperty(LOGGING_KEY);
+ System.setProperty(LOGGING_KEY, "WARN");
+
+ // Initialise ACLs.
+ final String qpidHome = System.getProperty("QPID_HOME");
+
+ final File defaultaclConfigFile = new File(qpidHome, "etc/persistent_config.xml");
+
+ if (!defaultaclConfigFile.exists())
+ {
+ System.err.println("Configuration file not found:" + defaultaclConfigFile);
+ fail("Configuration file not found:" + defaultaclConfigFile);
+ }
+
+ if (System.getProperty("QPID_HOME") == null)
+ {
+ fail("QPID_HOME not set");
+ }
+
+ Configuration configuration = ConfigurationFileApplicationRegistry.config(defaultaclConfigFile);
+
+ //Reset the housekeeping threads to run every second.
+ configuration.setProperty("virtualhosts.virtualhost.test.housekeeping.expiredMessageCheckPeriod", 10 * SECOND);
+ configuration.setProperty("management.enabled", "false");
+
+ _logger.info("Reset Housekeeping to :" + configuration.getLong("virtualhosts.virtualhost.test.housekeeping.expiredMessageCheckPeriod"));
+
+ ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(configuration);
+
+ ApplicationRegistry.initialise(config, 1);
+
+ //Remove the Vhosts we are not using to free up CPU from extra housekeeping threads.
+ VirtualHostRegistry vHostRegistry = ApplicationRegistry.getInstance().getVirtualHostRegistry();
+ vHostRegistry.getVirtualHost("localhost").close();
+ vHostRegistry.getVirtualHost("development").close();
+
+ //Create the Broker
+ super.setUp();
+
+ _queue = (Queue) _context.lookup("queue");
+ }
+
+ public void tearDown()
+ {
+ System.setProperty(LOGGING_KEY, _loggingOriginal);
+ }
+
+ protected static final String MESSAGE_ID_PROPERTY = "MessageIDProperty";
+
+ protected Queue _queue;
+
+ protected void sendMessages(int num) throws JMSException
+ {
+ Connection producerConnection = null;
+ try
+ {
+ producerConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+ }
+ catch (NamingException e)
+ {
+ fail("Unable to lookup connection in JNDI.");
+ }
+
+ sendMessages(producerConnection, num);
+ }
+
+ protected void sendMessages(Connection producerConnection, int num) throws JMSException
+ {
+ Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ //Ensure _queue is created
+ producerSession.createConsumer(_queue).close();
+
+ MessageProducer producer = producerSession.createProducer(_queue);
+
+ producer.setTimeToLive(_TimeToLive);
+ producer.setDisableMessageTimestamp(false);
+
+ for (int messsageID = 0; messsageID < num; messsageID++)
+ {
+ TextMessage textMsg = producerSession.createTextMessage("Message " + messsageID);
+ textMsg.setIntProperty(MESSAGE_ID_PROPERTY, messsageID);
+ producer.send(textMsg);
+ }
+
+ producerConnection.close();
+ }
+
+ public void test() throws InterruptedException, NamingException, JMSException
+ {
+ Runnable test = new Runnable()
+ {
+ public void run()
+ {
+
+ //Create Consumer
+ Connection connection = null;
+
+ Session session = null;
+ try
+ {
+ try
+ {
+ connection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+ }
+ catch (NamingException e)
+ {
+ fail("Unable to lookup connection in JNDI.");
+ }
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ }
+ catch (JMSException e)
+ {
+ return;
+ }
+
+ try
+ {
+ int run = 1;
+ while (true)
+ {
+ try
+ {
+ //Stop the connection to prevent flow
+ connection.stop();
+ //Create Consumer to receive msgs
+ MessageConsumer consumer = session.createConsumer(_queue);
+
+ //Send one message to hold up the Async Delivery from purging
+ _logger.info("***** CREATED Consumer");
+ _TimeToLive = 0L;
+ sendMessages(1);
+ _logger.info("***** SENT msg 1");
+ //Send 1000 msgs that will time out
+ _TimeToLive = 1000L;
+ sendMessages(50);
+ _logger.info("***** SENT TTL msgs");
+
+ //Timeout Messages - Note that we
+ Thread.sleep(1000);
+ _logger.info("***** SLEEP");
+
+ //Allw the messages to flow to us
+ connection.start();
+ _logger.info("***** START Consumer");
+ //*** Starts Async process
+
+ //Remove the first message so that the async will occcur and start purging.
+ consumer.receive(1000);
+ _logger.info("***** RECEIVE Consumer");
+
+ sendMessages(50);
+ _logger.info("***** SENT TTL msgs");
+
+ //Close the consumer freeing the QHK thread to doing work
+ consumer.close();
+ _logger.info("***** CLOSE Consumer");
+ //** Allows QueueHouskeeping to run.
+ sendMessages(50);
+ _logger.info("***** SENT TTL msgs");
+
+ System.err.println("********************************* Running test again (" + run +
+ ")in attempt to cause race condition.");
+ run++;
+ }
+ catch (JMSException e)
+ {
+
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+ }
+ finally
+ {
+ try
+ {
+ connection.close();
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ _logger.info("***** Test Done");
+ }
+ }
+ };
+
+ int MAX_THREADS = 1;
+
+ Thread[] threads = new Thread[MAX_THREADS];
+
+ for (int concurentClients = 0; concurentClients < MAX_THREADS; concurentClients++)
+ {
+ threads[concurentClients] = new Thread(test);
+ threads[concurentClients].start();
+ }
+
+ for (int concurentClients = 0; concurentClients < MAX_THREADS; concurentClients++)
+ {
+ threads[concurentClients].join();
+ }
+ }
+
+ public static void main(String[] args) throws Exception, InterruptedException
+ {
+ StoreContextRaceConditionTest scrc = new StoreContextRaceConditionTest();
+
+ scrc.setUp();
+ scrc.test();
+// scrc.tearDown();
+ }
+
+}
Property changes on: store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/StoreContextRaceConditionTest.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
16 years, 2 months
rhmessaging commits: r1922 - in store/trunk/cpp: lib/jrnl and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-04-16 11:38:14 -0400 (Wed, 16 Apr 2008)
New Revision: 1922
Added:
store/trunk/cpp/lib/jrnl/arr_cnt.cpp
store/trunk/cpp/lib/jrnl/arr_cnt.hpp
store/trunk/cpp/tests/jrnl/_ut_arr_cnt.cpp
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/txn_map.cpp
store/trunk/cpp/lib/jrnl/txn_map.hpp
store/trunk/cpp/tests/jrnl/
store/trunk/cpp/tests/jrnl/Makefile.am
store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
store/trunk/cpp/tests/jrnl/jtt/Makefile.am
Log:
Added per-fid enq counter for enq_map and per-fid txn counter for txn_map. Updated unit tests.
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2008-04-16 15:31:34 UTC (rev 1921)
+++ store/trunk/cpp/lib/Makefile.am 2008-04-16 15:38:14 UTC (rev 1922)
@@ -39,6 +39,7 @@
StoreException.h \
StringDbt.h \
TxnCtxt.h \
+ jrnl/arr_cnt.cpp \
jrnl/cvar.cpp \
jrnl/data_tok.cpp \
jrnl/deq_rec.cpp \
@@ -62,6 +63,7 @@
jrnl/wmgr.cpp \
jrnl/wrfc.cpp \
jrnl/aio_cb.hpp \
+ jrnl/arr_cnt.hpp \
jrnl/cvar.hpp \
jrnl/data_tok.hpp \
jrnl/deq_hdr.hpp \
Added: store/trunk/cpp/lib/jrnl/arr_cnt.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/arr_cnt.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/arr_cnt.cpp 2008-04-16 15:38:14 UTC (rev 1922)
@@ -0,0 +1,169 @@
+/**
+* \file arr_cnt.cpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class rhm::journal::arr_cnt (enqueue map). See
+* comments in file arr_cnt.hpp for details.
+*
+* Copyright (C) 2007, 2008 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/arr_cnt.hpp"
+
+#include <cassert>
+
+namespace rhm
+{
+namespace journal
+{
+
+arr_cnt::arr_cnt(): _size(0), _cnt_arr_ptr(0)
+{}
+
+arr_cnt::~arr_cnt()
+{
+ clean(_cnt_arr_ptr, _size);
+}
+
+void
+arr_cnt::set_size(const u_int16_t size)
+{
+ u_int16_t old_size = _size;
+ u_int32_t** old_cnt_arr_ptr = _cnt_arr_ptr;
+ _size = size;
+ if (_size)
+ {
+ _cnt_arr_ptr = new u_int32_t*[_size];
+ for (u_int16_t i=0; i<_size; i++)
+ {
+ _cnt_arr_ptr[i] = new u_int32_t;
+ // transfer counts from old file array
+ *_cnt_arr_ptr[i] = i < old_size ? *(old_cnt_arr_ptr[i]) : u_int32_t(0);
+ }
+ }
+ else
+ _cnt_arr_ptr = 0;
+ clean(old_cnt_arr_ptr, old_size);
+}
+
+u_int32_t
+arr_cnt::cnt(const u_int16_t index) const
+{
+ assert(_size == 0 || index < _size);
+ if (_cnt_arr_ptr)
+ return *(_cnt_arr_ptr[index]);
+ return 0;
+}
+
+u_int32_t
+arr_cnt::incr(const u_int16_t index)
+{
+ assert(_size == 0 || index < _size);
+ if (_cnt_arr_ptr)
+ return ++(*(_cnt_arr_ptr[index]));
+ return 0;
+}
+
+u_int32_t
+arr_cnt::decr(const u_int16_t index)
+{
+ assert(_size == 0 || index < _size);
+ if (_cnt_arr_ptr)
+ {
+ assert(*(_cnt_arr_ptr[index]) > 0);
+ return --(*(_cnt_arr_ptr[index]));
+ }
+ return 0;
+}
+
+u_int32_t
+arr_cnt::add(const u_int16_t index, u_int32_t amt)
+{
+ assert(_size == 0 || index < _size);
+ if (_cnt_arr_ptr)
+ {
+ *(_cnt_arr_ptr[index]) += amt;
+ return *(_cnt_arr_ptr[index]);
+ }
+ return 0;
+}
+
+u_int32_t
+arr_cnt::sub(const u_int16_t index, u_int32_t amt)
+{
+ assert(_size == 0 || index < _size);
+ if (_cnt_arr_ptr)
+ {
+ assert(*(_cnt_arr_ptr[index]) >= amt);
+ *(_cnt_arr_ptr[index]) -= amt;
+ return *(_cnt_arr_ptr[index]);
+ }
+ return 0;
+}
+
+void
+arr_cnt::set_cnt(const u_int16_t index, u_int32_t val)
+{
+ assert(_size == 0 || index < _size);
+ if (_cnt_arr_ptr)
+ *(_cnt_arr_ptr[index]) = val;
+}
+
+void
+arr_cnt::clear_cnt(const u_int16_t index)
+{
+ assert(_size == 0 || index < _size);
+ if (_cnt_arr_ptr)
+ *(_cnt_arr_ptr[index]) = 0;
+}
+
+void
+arr_cnt::clear_all()
+{
+ if (_cnt_arr_ptr)
+ {
+ for (u_int16_t i=0; i<_size; i++)
+ *(_cnt_arr_ptr[i]) = 0;
+ }
+}
+
+void
+arr_cnt::clean(u_int32_t** cnt_arr_ptr, const u_int16_t size)
+{
+ if (cnt_arr_ptr)
+ {
+ for (u_int16_t i=0; i<size; i++)
+ {
+ if (cnt_arr_ptr[i])
+ {
+ delete cnt_arr_ptr[i];
+ cnt_arr_ptr[i] = 0;
+ }
+ }
+ delete[] cnt_arr_ptr;
+ cnt_arr_ptr = 0;
+ }
+}
+
+} // namespace journal
+} // namespace rhm
Added: store/trunk/cpp/lib/jrnl/arr_cnt.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/arr_cnt.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/arr_cnt.hpp 2008-04-16 15:38:14 UTC (rev 1922)
@@ -0,0 +1,77 @@
+/**
+* \file arr_cnt.hpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class rhm::journal::arr_cnt (array counter).
+* 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_arr_cnt_hpp
+#define rhm_journal_arr_cnt_hpp
+
+#include <sys/types.h>
+
+namespace rhm
+{
+namespace journal
+{
+
+ /**
+ * \class arr_cnt
+ * \brief Class which implements a dynamically allocated array of u_int32_t counters.
+ * This is ideal where it is necessary to increment and decrement counts for an entuty
+ * for which the number of elements is unknown, but for which the efficiency of a static
+ * array is required. None of the counts may go below zero.
+ */
+ class arr_cnt
+ {
+ private:
+ u_int16_t _size;
+ u_int32_t** _cnt_arr_ptr;
+
+ public:
+ arr_cnt();
+ virtual ~arr_cnt();
+
+ inline u_int16_t size() const { return _size; }
+ void set_size(const u_int16_t size);
+ u_int32_t cnt(const u_int16_t index) const;
+ u_int32_t incr(const u_int16_t index);
+ u_int32_t decr(const u_int16_t index);
+ u_int32_t add(const u_int16_t index, u_int32_t amt);
+ u_int32_t sub(const u_int16_t index, u_int32_t amt);
+ void set_cnt(const u_int16_t index, u_int32_t val);
+ void clear_cnt(const u_int16_t index);
+ void clear_all();
+ private:
+ void clean(u_int32_t** cnt_arr_ptr, const u_int16_t size);
+ };
+
+} // namespace journal
+} // namespace rhm
+
+#endif // ifndef rhm_journal_arr_cnt_hpp
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2008-04-16 15:31:34 UTC (rev 1921)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2008-04-16 15:38:14 UTC (rev 1922)
@@ -42,7 +42,8 @@
{
enq_map::enq_map():
- _map()
+ _map(),
+ _fid_enq_cnt()
{
pthread_mutex_init(&_mutex, 0);
}
@@ -53,6 +54,12 @@
}
void
+enq_map::set_num_jfiles(const u_int16_t num_jfiles)
+{
+ _fid_enq_cnt.set_size(num_jfiles);
+}
+
+void
enq_map::insert_fid(const u_int64_t rid, const u_int16_t fid)
{
insert_fid(rid, fid, false);
@@ -73,6 +80,7 @@
oss << std::hex << "rid=0x" << rid << " fid=0x" << fid;
throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "enq_map", "insert");
}
+ _fid_enq_cnt.incr(fid);
}
u_int16_t
@@ -117,6 +125,7 @@
}
u_int16_t fid = itr->second.first;
_map.erase(itr);
+ _fid_enq_cnt.decr(fid);
return fid;
}
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2008-04-16 15:31:34 UTC (rev 1921)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2008-04-16 15:38:14 UTC (rev 1922)
@@ -41,6 +41,7 @@
}
}
+#include "jrnl/arr_cnt.hpp"
#include "jrnl/jexception.hpp"
#include <map>
#include <pthread.h>
@@ -81,11 +82,15 @@
emap _map;
pthread_mutex_t _mutex;
+ arr_cnt _fid_enq_cnt;
public:
enq_map();
virtual ~enq_map();
+ void set_num_jfiles(const u_int16_t num_jfiles);
+ inline u_int32_t get_enq_cnt(const u_int16_t fid) const { return _fid_enq_cnt.cnt(fid); };
+
void insert_fid(const u_int64_t rid, const u_int16_t fid);
void insert_fid(const u_int64_t rid, const u_int16_t fid, const bool locked);
u_int16_t get_fid(const u_int64_t rid);
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-04-16 15:31:34 UTC (rev 1921)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-04-16 15:38:14 UTC (rev 1922)
@@ -113,6 +113,8 @@
assert(num_jfiles >= JRNL_MIN_NUM_FILES);
assert(num_jfiles <= JRNL_MAX_NUM_FILES);
_num_jfiles = num_jfiles;
+ _emap.set_num_jfiles(_num_jfiles);
+ _tmap.set_num_jfiles(_num_jfiles);
assert(jfsize_sblks >= JRNL_MIN_FILE_SIZE);
assert(jfsize_sblks <= JRNL_MAX_FILE_SIZE);
@@ -169,6 +171,8 @@
assert(num_jfiles >= JRNL_MIN_NUM_FILES);
assert(num_jfiles <= JRNL_MAX_NUM_FILES);
_num_jfiles = num_jfiles;
+ _emap.set_num_jfiles(_num_jfiles);
+ _tmap.set_num_jfiles(_num_jfiles);
assert(jfsize_sblks >= JRNL_MIN_FILE_SIZE);
assert(jfsize_sblks <= JRNL_MAX_FILE_SIZE);
Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp 2008-04-16 15:31:34 UTC (rev 1921)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2008-04-16 15:38:14 UTC (rev 1922)
@@ -51,7 +51,8 @@
{}
txn_map::txn_map():
- _map()
+ _map(),
+ _fid_txn_cnt()
{
pthread_mutex_init(&_mutex, 0);
}
@@ -61,6 +62,12 @@
pthread_mutex_destroy(&_mutex);
}
+void
+txn_map::set_num_jfiles(const u_int16_t num_jfiles)
+{
+ _fid_txn_cnt.set_size(num_jfiles);
+}
+
bool
txn_map::insert_txn_data(const std::string& xid, const txn_data& td)
{
@@ -77,6 +84,7 @@
}
else
itr->second.push_back(td);
+ _fid_txn_cnt.incr(td._fid);
return ok;
}
@@ -111,6 +119,8 @@
}
txn_data_list list = itr->second;
_map.erase(itr);
+ for (tdl_itr i=list.begin(); i!=list.end(); i++)
+ _fid_txn_cnt.decr(i->_fid);
return list;
}
Modified: store/trunk/cpp/lib/jrnl/txn_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.hpp 2008-04-16 15:31:34 UTC (rev 1921)
+++ store/trunk/cpp/lib/jrnl/txn_map.hpp 2008-04-16 15:38:14 UTC (rev 1922)
@@ -41,6 +41,7 @@
}
}
+#include "jrnl/arr_cnt.hpp"
#include <map>
#include <pthread.h>
#include <string>
@@ -115,11 +116,16 @@
xmap _map;
pthread_mutex_t _mutex;
+ arr_cnt _fid_txn_cnt;
public:
txn_map();
virtual ~txn_map();
+ void set_num_jfiles(const u_int16_t num_jfiles);
+ inline u_int32_t get_txn_fid_cnt(const u_int16_t fid) const
+ { return _fid_txn_cnt.cnt(fid); };
+
bool insert_txn_data(const std::string& xid, const txn_data& td);
const txn_data_list get_tdata_list(const std::string& xid);
const txn_data_list get_remove_tdata_list(const std::string& xid);
Property changes on: store/trunk/cpp/tests/jrnl
___________________________________________________________________
Name: svn:ignore
- .deps
.libs
Makefile
Makefile.in
jtest
_ut_enq_map
_ut_jdir
_ut_jerrno
_ut_jexception
_ut_jinf
_ut_rec_hdr
_ut_time_ns
_ut_txn_map
_st_basic
_st_basic_txn
_st_read
_st_read_txn
+ .deps
.libs
Makefile
Makefile.in
jtest
_ut_enq_map
_ut_arr_cnt
_ut_jdir
_ut_jerrno
_ut_jexception
_ut_jinf
_ut_rec_hdr
_ut_time_ns
_ut_txn_map
_st_basic
_st_basic_txn
_st_read
_st_read_txn
Modified: store/trunk/cpp/tests/jrnl/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.am 2008-04-16 15:31:34 UTC (rev 1921)
+++ store/trunk/cpp/tests/jrnl/Makefile.am 2008-04-16 15:38:14 UTC (rev 1922)
@@ -29,6 +29,7 @@
TESTS = \
_ut_time_ns \
+ _ut_arr_cnt \
_ut_jexception \
_ut_jerrno \
_ut_rec_hdr \
@@ -44,6 +45,7 @@
check_PROGRAMS = \
_ut_time_ns \
+ _ut_arr_cnt \
_ut_jexception \
_ut_jerrno \
_ut_rec_hdr \
@@ -62,6 +64,9 @@
_ut_time_ns_SOURCES = _ut_time_ns.cpp $(UNIT_TEST_SRCS)
_ut_time_ns_LDFLAGS = $(UNIT_TEST_LDADD)
+_ut_arr_cnt_SOURCES = _ut_arr_cnt.cpp $(UNIT_TEST_SRCS)
+_ut_arr_cnt_LDFLAGS = $(UNIT_TEST_LDADD)
+
_ut_jexception_SOURCES = _ut_jexception.cpp $(UNIT_TEST_SRCS)
_ut_jexception_LDFLAGS = $(UNIT_TEST_LDADD)
Added: store/trunk/cpp/tests/jrnl/_ut_arr_cnt.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_arr_cnt.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/_ut_arr_cnt.cpp 2008-04-16 15:38:14 UTC (rev 1922)
@@ -0,0 +1,153 @@
+/**
+* \file _ut_enq_map.cpp
+*
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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 "../unit_test.h"
+
+#include <iostream>
+#include "jrnl/arr_cnt.hpp"
+
+using namespace boost::unit_test;
+using namespace rhm::journal;
+using namespace std;
+
+QPID_AUTO_TEST_SUITE(eng_map_suite)
+
+const string test_filename("_ut_arr_cnt");
+
+QPID_AUTO_TEST_CASE(default_constructor)
+{
+ cout << test_filename << ".default_constructor: " << flush;
+ arr_cnt a1;
+ BOOST_CHECK_EQUAL(a1.size(), u_int16_t(0));
+ BOOST_CHECK_EQUAL(a1.cnt(0), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a1.incr(0), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a1.decr(0), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a1.add(0, 100), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a1.sub(0, 100), u_int32_t(0));
+ a1.set_cnt(0, 100);
+ a1.clear_cnt(0);
+ a1.clear_all();
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_CASE(basic_fns)
+{
+ cout << test_filename << ".basic_fns: " << flush;
+ const u_int16_t num_elts = 8;
+ arr_cnt a2;
+ BOOST_CHECK_EQUAL(a2.size(), u_int16_t(0));
+ a2.set_size(num_elts);
+ BOOST_CHECK_EQUAL(a2.size(), num_elts);
+ for (u_int16_t i=0; i<num_elts; i++)
+ {
+ BOOST_CHECK_EQUAL(a2.cnt(i), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a2.incr(i), u_int32_t(1));
+ BOOST_CHECK_EQUAL(a2.decr(i), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a2.add(i, 100), u_int32_t(100));
+ BOOST_CHECK_EQUAL(a2.sub(i, 100), u_int32_t(0));
+ a2.set_cnt(i, 100);
+ a2.set_cnt(i, 100);
+ BOOST_CHECK_EQUAL(a2.cnt(i), u_int32_t(100));
+ a2.clear_cnt(i);
+ BOOST_CHECK_EQUAL(a2.cnt(i), u_int32_t(0));
+ a2.set_cnt(i, i);
+ }
+ a2.clear_all();
+ for (u_int16_t i=0; i<num_elts; i++)
+ BOOST_CHECK_EQUAL(a2.cnt(i), u_int32_t(0));
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_CASE(resize)
+{
+ cout << test_filename << ".resize: " << flush;
+ arr_cnt a3;
+ BOOST_CHECK_EQUAL(a3.size(), u_int16_t(0));
+ a3.set_size(8);
+ BOOST_CHECK_EQUAL(a3.size(), u_int16_t(8));
+ a3.set_size(1000);
+ BOOST_CHECK_EQUAL(a3.size(), u_int16_t(1000));
+ a3.set_size(4);
+ BOOST_CHECK_EQUAL(a3.size(), u_int16_t(4));
+ a3.set_size(0);
+ BOOST_CHECK_EQUAL(a3.size(), u_int16_t(0));
+ a3.set_size(10);
+ BOOST_CHECK_EQUAL(a3.size(), u_int16_t(10));
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_CASE(resize_up_transfer_cnt)
+{
+ cout << test_filename << ".transfer_up: " << flush;
+ const u_int16_t num_elts = 8;
+ arr_cnt a4;
+ a4.set_size(num_elts);
+ for (u_int16_t i=0; i<num_elts; i++)
+ a4.set_cnt(i, i*i);
+ a4.set_size(2*num_elts);
+ for (u_int16_t i=0; i<num_elts; i++)
+ BOOST_CHECK_EQUAL(a4.cnt(i), u_int32_t(i*i));
+ for (u_int16_t i=num_elts; i<2*num_elts; i++)
+ BOOST_CHECK_EQUAL(a4.cnt(i), u_int32_t(0));
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_CASE(resize_down_transfer_cnt)
+{
+ cout << test_filename << ".transfer_up: " << flush;
+ const u_int16_t num_elts = 16;
+ arr_cnt a5;
+ a5.set_size(num_elts);
+ for (u_int16_t i=0; i<num_elts; i++)
+ a5.set_cnt(i, i*i);
+ a5.set_size(num_elts/2);
+ for (u_int16_t i=0; i<num_elts/2; i++)
+ BOOST_CHECK_EQUAL(a5.cnt(i), u_int32_t(i*i));
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_CASE(null_immunity_after_resize_to_zero)
+{
+ cout << test_filename << ".null_immunity_after_resize_to_zero: " << flush;
+ arr_cnt a6;
+ a6.set_size(8);
+ a6.set_size(0);
+ BOOST_CHECK_EQUAL(a6.size(), u_int16_t(0));
+ BOOST_CHECK_EQUAL(a6.cnt(8), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a6.incr(8), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a6.decr(8), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a6.add(8, 100), u_int32_t(0));
+ BOOST_CHECK_EQUAL(a6.sub(8, 100), u_int32_t(0));
+ a6.set_cnt(8, 100);
+ a6.clear_cnt(8);
+ a6.clear_all();
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2008-04-16 15:31:34 UTC (rev 1921)
+++ store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2008-04-16 15:38:14 UTC (rev 1922)
@@ -250,6 +250,55 @@
cout << "ok" << endl;
}
+QPID_AUTO_TEST_CASE(enq_count)
+{
+ cout << test_filename << ".enq_count: " << flush;
+
+ enq_map e6;
+
+ // Check the allocation and cleanup as the file size is set both up and down
+ e6.set_num_jfiles(24);
+ e6.set_num_jfiles(0);
+ e6.set_num_jfiles(100);
+ e6.set_num_jfiles(4);
+
+ // Add 100 enqueues to file 1, check that the counts match
+ for (u_int16_t fid=0; fid<4; fid++)
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(0));
+ for (u_int64_t rid=0; rid<100; rid++)
+ e6.insert_fid(rid, 1);
+ for (u_int16_t fid=0; fid<4; fid++)
+ {
+ if (fid == 1)
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(100));
+ else
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(0));
+ }
+
+ // Now remove 10 from file 1, check that the counts match
+ for (u_int64_t rid=0; rid<100; rid+=10)
+ e6.get_remove_fid(rid);
+ for (u_int16_t fid=0; fid<4; fid++)
+ {
+ if (fid == 1)
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(90));
+ else
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(0));
+ }
+
+ // Now resize the file up and make sure the count in file 1 still exists
+ e6.set_num_jfiles(8);
+ for (u_int16_t fid=0; fid<8; fid++)
+ {
+ if (fid == 1)
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(90));
+ else
+ BOOST_CHECK_EQUAL(e6.get_enq_cnt(fid), u_int32_t(0));
+ }
+
+ cout << "ok" << endl;
+}
+
QPID_AUTO_TEST_CASE(stress)
{
cout << test_filename << ".stress: " << flush;
@@ -258,23 +307,24 @@
u_int64_t rid_begin = 0xffffffff00000000ULL;
u_int64_t num_rid = 0x800000ULL;
- enq_map e6;
+ enq_map e7;
// insert even rids with no dups
for (rid = rid_begin, rid_cnt = u_int64_t(0); rid_cnt < num_rid; rid += 2ULL, rid_cnt++)
- e6.insert_fid(rid, u_int16_t(0));
- BOOST_CHECK_EQUAL(e6.size(), num_rid);
+ e7.insert_fid(rid, u_int16_t(0));
+ BOOST_CHECK_EQUAL(e7.size(), num_rid);
// insert odd rids with no dups
for (rid = rid_begin + 1, rid_cnt = u_int64_t(0); rid_cnt < num_rid; rid += 2ULL, rid_cnt++)
- e6.insert_fid(rid, u_int16_t(0));
- BOOST_CHECK_EQUAL(e6.size(), num_rid * 2);
- cout << "ok" << endl;
+ e7.insert_fid(rid, u_int16_t(0));
+ BOOST_CHECK_EQUAL(e7.size(), num_rid * 2);
// remove even rids
for (rid = rid_begin, rid_cnt = u_int64_t(0); rid_cnt < num_rid; rid += 2ULL, rid_cnt++)
- e6.get_remove_fid(rid);
- BOOST_CHECK_EQUAL(e6.size(), num_rid);
+ e7.get_remove_fid(rid);
+ BOOST_CHECK_EQUAL(e7.size(), num_rid);
+
+ cout << "ok" << endl;
}
QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/jtt/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/Makefile.am 2008-04-16 15:31:34 UTC (rev 1921)
+++ store/trunk/cpp/tests/jrnl/jtt/Makefile.am 2008-04-16 15:38:14 UTC (rev 1922)
@@ -69,6 +69,7 @@
test_case_set.hpp \
test_mgr.hpp
jtt_LDADD = \
+ ${LIBOBJDIR}/arr_cnt.o \
${LIBOBJDIR}/data_tok.o \
${LIBOBJDIR}/deq_rec.o \
${LIBOBJDIR}/enq_map.o \
@@ -116,6 +117,7 @@
test_case.o \
test_case_result.o \
test_case_result_agregation.o \
+ ${LIBOBJDIR}/arr_cnt.o \
${LIBOBJDIR}/data_tok.o \
${LIBOBJDIR}/deq_rec.o \
${LIBOBJDIR}/enq_map.o \
16 years, 2 months
rhmessaging commits: r1921 - store/branches/java.
by rhmessaging-commits@lists.jboss.org
Author: ritchiem
Date: 2008-04-16 11:31:34 -0400 (Wed, 16 Apr 2008)
New Revision: 1921
Added:
store/branches/java/M2.x/
Log:
Copied M2.1 to M2.x to mirror Apache Qpid change
Copied: store/branches/java/M2.x (from rev 1920, store/branches/java/M2.1)
16 years, 2 months
rhmessaging commits: r1920 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-15 20:57:44 -0400 (Tue, 15 Apr 2008)
New Revision: 1920
Modified:
mgmt/cumin/python/cumin/charts.py
Log:
Widen charts slightly, and shorten million+ values
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2008-04-16 00:47:10 UTC (rev 1919)
+++ mgmt/cumin/python/cumin/charts.py 2008-04-16 00:57:44 UTC (rev 1920)
@@ -11,7 +11,7 @@
class TimeSeriesChart(object):
def __init__(self, width, height):
- self.width = width - 60
+ self.width = width - 40
self.height = height - 20
self.surface = ImageSurface(FORMAT_ARGB32, width, height)
self.surface.set_device_offset(1.5, 5.5)
@@ -115,7 +115,9 @@
value = fraction * self.y_max - self.y_min
value = int(round(value + self.y_min))
- if value > 10000:
+ if value >= 10000000:
+ svalue = "%im" % int(round(value / 1000000.0, -1))
+ elif value >= 10000:
svalue = "%ik" % int(round(value / 1000.0, -1))
else:
svalue = str(value)
16 years, 2 months
rhmessaging commits: r1919 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-15 20:47:10 -0400 (Tue, 15 Apr 2008)
New Revision: 1919
Modified:
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/stat.strings
Log:
Reorganize exchange stats.
Adjust spacing.
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-04-16 00:46:10 UTC (rev 1918)
+++ mgmt/cumin/python/cumin/exchange.py 2008-04-16 00:47:10 UTC (rev 1919)
@@ -199,7 +199,7 @@
self.__tabs = TabbedModeSet(app, "tabs")
self.add_child(self.__tabs)
- self.__tabs.add_tab(ExchangeStatistics(app, "stats"))
+ self.__tabs.add_tab(ExchangeStats(app, "stats"))
self.__bindings = ExchangeBindingSet(app, "bindings")
self.__tabs.add_tab(self.__bindings)
@@ -358,57 +358,24 @@
def render_cancel_content(self, session, exchange):
return "No, Cancel"
-class ExchangeStatistics(TabbedModeSet):
+class ExchangeStats(TabbedModeSet):
def __init__(self, app, name):
- super(ExchangeStatistics, self).__init__(app, name)
+ super(ExchangeStats, self).__init__(app, name)
- self.add_tab(self.StatisticsCurrent(app, "current"))
- self.add_tab(self.StatisticsHistory(app, "history"))
+ self.add_child(StatSet(app, "general", "general"))
- def get_args(self, session):
- return self.frame.get_args(session)
+ chart = StatValueChart(app, "inout")
+ chart.stats = ("msgReceives", "msgRoutes")
+ chart.mode = "rate"
+ self.add_child(chart)
- def render_title(self, session, exchange):
+ chart = StatValueChart(app, "producers")
+ chart.stats = ("producers",)
+ self.add_child(chart)
+
+ def render_title(self, session):
return "Statistics"
- class StatisticsCurrent(Widget):
- def __init__(self, app, name):
- super(ExchangeStatistics.StatisticsCurrent, self).__init__ \
- (app, name)
-
- self.add_child(StatSet(app, "general", "general"))
-
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def render_title(self, session, exchange):
- return "Current"
-
- class StatisticsHistory(Widget):
- def __init__(self, app, name):
- super(ExchangeStatistics.StatisticsHistory, self).__init__ \
- (app, name)
-
- chart = StatValueChart(app, "received")
- chart.stats = ("msgReceives",)
- chart.mode = "rate"
- self.add_child(chart)
-
- chart = StatValueChart(app, "routed")
- chart.stats = ("msgRoutes",)
- chart.mode = "rate"
- self.add_child(chart)
-
- chart = StatValueChart(app, "dropped")
- chart.stats = ("msgDrops",)
- self.add_child(chart)
-
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def render_title(self, session, exchange):
- return "History"
-
class ExchangeProducerSet(ItemSet):
def get_args(self, session):
return self.frame.get_args(session)
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2008-04-16 00:46:10 UTC (rev 1918)
+++ mgmt/cumin/python/cumin/exchange.strings 2008-04-16 00:47:10 UTC (rev 1919)
@@ -197,11 +197,7 @@
<td class="ralign">{item_messages_matched}</td>
</tr>
-[ExchangeStatistics.html]
-<ul class="radiotabs tabs">{tabs}</ul>
-<div class="radiotabs mode">{mode}</div>
-
-[StatisticsCurrent.html]
+[ExchangeStats.html]
<table class="layout">
<tr>
<td class="twocol">
@@ -209,20 +205,12 @@
{general}
</td>
<td class="twocol">
+ {inout}
+ {producers}
</td>
</tr>
</table>
-[StatisticsHistory.html]
-<h2>Messages Received</h2>
-<div class="iblock chart">{received}</div>
-
-<h2>Messages Routed</h2>
-<div class="iblock chart">{routed}</div>
-
-<h2>Messages Dropped</h2>
-<div class="iblock chart">{dropped}</div>
-
[ExchangeProducerSet.html]
<div class="sactions">
<h2>Act on Selected Producers:</h2>
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2008-04-16 00:46:10 UTC (rev 1918)
+++ mgmt/cumin/python/cumin/page.strings 2008-04-16 00:47:10 UTC (rev 1919)
@@ -466,18 +466,9 @@
td.twocol {
width: 50%;
+ padding: 0 1em 0 0;
}
-td.twocol h2 {
- font-weight: bold;
- margin: 0;
-}
-
-td.twocol table {
- border: 1px dotted #ddd;
- margin: 1em;
-}
-
table.layout {
width: 100%;
}
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2008-04-16 00:46:10 UTC (rev 1918)
+++ mgmt/cumin/python/cumin/queue.strings 2008-04-16 00:47:10 UTC (rev 1919)
@@ -186,21 +186,19 @@
<div class="radiotabs mode">{mode}</div>
[GeneralQueueStats.html]
-<div class="rfloat" style="width: 50%">
- {enqdeq}
+<table class="layout">
+ <tr>
+ <td class="twocol">
+ {general}
+ </td>
+ <td class="twocol">
+ {enqdeq}
+ {depth}
+ {consumers}
+ </td>
+ </tr>
+</table>
- {depth}
-
- {consumers}
-</div>
-
-{general}
-
-<br/>
-<br/>
-<br/>
-<br/>
-
[QueueConsumerSet.html]
<div class="sactions">
<h2>Act on Selected Consumers:</h2>
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-04-16 00:46:10 UTC (rev 1918)
+++ mgmt/cumin/python/cumin/stat.strings 2008-04-16 00:47:10 UTC (rev 1919)
@@ -117,7 +117,7 @@
[StatValueChart.css]
div.StatValueChart {
font-size: 0.9em;
- margin: 0 0 1em 1em;
+ margin: 0 0 1em 0;
width: 30em;
}
16 years, 2 months