rhmessaging commits: r4355 - store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb.
by rhmessaging-commits@lists.jboss.org
Author: rgemmell
Date: 2010-09-28 10:34:49 -0400 (Tue, 28 Sep 2010)
New Revision: 4355
Modified:
store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/MessageContentKey.java
Log:
remove unused code block containing issues highlighted by FindBugs
Modified: store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/MessageContentKey.java
===================================================================
--- store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/MessageContentKey.java 2010-09-28 13:01:23 UTC (rev 4354)
+++ store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/MessageContentKey.java 2010-09-28 14:34:49 UTC (rev 4355)
@@ -20,9 +20,6 @@
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
-import java.util.Comparator;
-import java.io.Serializable;
-
/**
* @author Apache Software Foundation
*/
@@ -42,6 +39,12 @@
chunk = ti.readInt();
}
+ public MessageContentKey(long messageId, int chunk)
+ {
+ this.chunk = chunk;
+ this.messageId = messageId;
+ }
+
public static class TupleBinding extends com.sleepycat.bind.tuple.TupleBinding
{
public Object entryToObject(TupleInput tupleInput)
@@ -58,166 +61,5 @@
tupleOutput.writeLong(mk.messageId);
tupleOutput.writeInt(mk.chunk);
}
-
-
}
-
- public static void writeModifiedLong(TupleOutput t, long l)
- {
- int ln = (int) (0x0F & l);
- int hn = (int) (0xF0 & l);
- t.writeByte(((ln <<4) | (hn>>4)) ^ 0x55);
- t.writeByte((int) (0xFF & (l >> 8)));
- t.writeByte((int) (0xFF & (l >> 16)));
- t.writeByte((int) (0xFF & (l >> 24)));
- t.writeByte((int) (0xFF & (l >> 32)));
- t.writeByte((int) (0xFF & (l >> 40)));
- t.writeByte((int) (0xFF & (l >> 48)));
- t.writeByte((int) (0xFF & (l >> 56)));
-
- }
-
- public static long readModifiedLong(TupleInput t)
- {
- byte b0 = (byte) (0xFF & (t.readByte() ^ 0x55));
- long l = (0x0f & (b0 >> 4)) | ((0xf0 & (b0 << 4)));
-
- l |= ((long) (0xFF & t.readByte())) << 8;
- l |= ((long) (0xFF & t.readByte())) << 16;
- l |= ((long) (0xFF & t.readByte())) << 24;
- l |= ((long) (0xFF & t.readByte())) << 32;
- l |= ((long) (0xFF & t.readByte())) << 40;
- l |= ((long) (0xFF & t.readByte())) << 48;
- l |= ((long) (0xFF & t.readByte())) << 56;
-
- return l;
- }
-
-
- public static class ContentKeyComparator implements Comparator, Serializable
- {
-
- public int compare(Object o1, Object o2)
- {
- byte[] b1 = (byte[]) o1;
- byte[] b2 = (byte[]) o2;
-
- MessageContentKey ck1 = new MessageContentKey(b1);
- MessageContentKey ck2 = new MessageContentKey(b2);
- if (ck1.messageId == ck2.messageId)
- {
- // reminder of Comparator return value:
- // return a negative integer if the first item is "less" than the second, 0 if equal
- return ck1.chunk - ck2.chunk;
- }
- else
- {
- return (int) (ck1.messageId - ck2.messageId);
- }
- }
- }
-
- public MessageContentKey(long messageId, int chunk)
- {
- this.chunk = chunk;
- this.messageId = messageId;
- }
-
-
-
- private static final char[] HEX = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
-
- private static StringBuilder appendHex(StringBuilder str, byte b)
- {
- str.append(HEX[0xF & (b >> 4)]);
- str.append(HEX[0xF & b]);
- return str;
- }
-
- private static StringBuilder appendHex(StringBuilder str, byte[] b)
- {
- for(int i = 0; i < b.length; i++)
- {
- appendHex(str,b[i]);
- }
- return str;
- }
-
- private static StringBuilder appendHex(StringBuilder str, int i)
- {
- appendHex(str,(byte)(0xFF & (i >> 24)));
- appendHex(str,(byte)(0xFF & (i >> 16)));
- appendHex(str,(byte)(0xFF & (i >> 8)));
- appendHex(str,(byte)(0xFF & i));
- return str;
- }
-
-
- private static StringBuilder appendHex(StringBuilder str, long l)
- {
- appendHex(str,(byte)(0xFF & (l >> 56)));
- appendHex(str,(byte)(0xFF & (l >> 48)));
- appendHex(str,(byte)(0xFF & (l >> 40)));
- appendHex(str,(byte)(0xFF & (l >> 32)));
- appendHex(str,(byte)(0xFF & (l >> 24)));
- appendHex(str,(byte)(0xFF & (l >> 16)));
- appendHex(str,(byte)(0xFF & (l >> 8)));
- appendHex(str,(byte)(0xFF & l));
- return str;
- }
-
-
-
-
- private static byte[] convertLong(long l)
- {
- byte[] b = new byte[8];
- int ln = (int) (0x0F & l);
- int hn = (int) (0xF0 & l);
- b[0] = (byte)(((ln <<4) | (hn>>4)) ^ 0x55);
- b[1] = ((byte)(0xFF & (l >> 8)));
- b[2] = ((byte)(0xFF & (l >> 16)));
- b[3] = ((byte)(0xFF & (l >> 24)));
- b[4] = ((byte)(0xFF & (l >> 32)));
- b[5] = ((byte)(0xFF & (l >> 40)));
- b[6] = ((byte)(0xFF & (l >> 48)));
- b[7] = ((byte)(0xFF & (l >> 56)));
-
- return b;
-
- }
-
-
- private static long readModifiedLong(byte[] b)
- {
- byte b0 = (byte) (b[0] ^ 0x55);
- long l = (0x0f & (b0 >> 4)) | ((0xf0 & (b0 << 4)));
- l |= ((long) b[1]) << 8;
- l |= ((long) b[2]) << 16;
- l |= ((long) b[3]) << 24;
- l |= ((long) b[4]) << 32;
- l |= ((long) b[5]) << 40;
- l |= ((long) b[6]) << 48;
- l |= ((long) b[7]) << 56;
-
-
- return l;
- }
-
-
- public static void main(String[] args)
- {
- StringBuilder s = new StringBuilder();
-
-
-
- for(long i = 1000; i < 1010; i++)
- {
- byte[] b = convertLong(i);
- System.out.println(appendHex(new StringBuilder(),b));
- System.out.println(readModifiedLong(b));
-
- }
-
- }
}
15 years, 7 months
rhmessaging commits: r4354 - store/trunk/cpp/tests/python_tests.
by rhmessaging-commits@lists.jboss.org
Author: jonathan.robie
Date: 2010-09-28 09:01:23 -0400 (Tue, 28 Sep 2010)
New Revision: 4354
Modified:
store/trunk/cpp/tests/python_tests/client_persistence.py
Log:
Added test to make sure that rejected messages are also dequeued, and will not reappear on broker restart.
This is a test for Bug 621468.
Modified: store/trunk/cpp/tests/python_tests/client_persistence.py
===================================================================
--- store/trunk/cpp/tests/python_tests/client_persistence.py 2010-09-28 12:38:47 UTC (rev 4353)
+++ store/trunk/cpp/tests/python_tests/client_persistence.py 2010-09-28 13:01:23 UTC (rev 4354)
@@ -23,8 +23,7 @@
from qpid.brokertest import EXPECT_EXIT_OK
from store_test import StoreTest, Qmf, store_args
-from qpid.messaging import Message
-
+from qpid.messaging import *
class ExchangeQueueTests(StoreTest):
"""
@@ -116,9 +115,25 @@
self.check_messages(broker, "q1", [msg1, msg2], True)
self.check_messages(broker, "q2", [msg1, msg2], True)
self.check_messages(broker, "q3", [msg1, msg2], True)
+
+
+ def test_message_reject(self):
+ broker = self.broker(store_args(), name="test_message_reject", expect=EXPECT_EXIT_OK)
+ ssn = broker.connect().session()
+ snd = ssn.sender("tmr; {create:always, node:{type:queue, durable:True}}")
+ rcv = ssn.receiver("tmr; {create:always, node:{type:queue, durable:True}}")
+ m1 = Message("test_message_reject", durable=True, correlation_id="Msg0001")
+ snd.send(m1)
+ m2 = rcv.fetch()
+ ssn.acknowledge(message=m2, disposition=Disposition(REJECTED))
+ broker.terminate()
+
+ broker = self.broker(store_args(), name="test_message_reject")
+ qmf = Qmf(broker)
+ assert qmf.queue_message_count("tmr") == 0
-class AlternateExchagePropertyTests(StoreTest):
+class AlternateExchangePropertyTests(StoreTest):
"""
Test the persistence of the Alternate Exchange property for exchanges and queues.
"""
15 years, 7 months
rhmessaging commits: r4352 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-27 17:42:52 -0400 (Mon, 27 Sep 2010)
New Revision: 4352
Modified:
mgmt/newdata/mint/python/mint/vacuum.py
Log:
For bz 637977, perform vacuum operations on a separate thread
Modified: mgmt/newdata/mint/python/mint/vacuum.py
===================================================================
--- mgmt/newdata/mint/python/mint/vacuum.py 2010-09-27 17:55:18 UTC (rev 4351)
+++ mgmt/newdata/mint/python/mint/vacuum.py 2010-09-27 21:42:52 UTC (rev 4352)
@@ -9,33 +9,30 @@
if self.stop_requested:
break
- up = VacuumUpdate(self.app.model)
- self.app.update_thread.enqueue(up)
+ try:
+ self.vacuum()
+ except:
+ log.exception("Vacuum failed")
- sleep(60 * 60)
+ now = datetime.now()
+ secs = 3600 - ((now.minute * 60) + now.second)
+ then = now + timedelta(seconds=secs)
-class VacuumUpdate(Update):
- def do_process(self, cursor, stats):
- log.info("Vacuuming tables")
+ log.info("Next vacuum is at %s", then.strftime("%H:%M"))
- conn = self.model.app.update_thread.conn
+ sleep(secs + 1)
- level = conn.isolation_level
+ def vacuum(self):
+ conn = self.app.database.get_connection()
conn.set_isolation_level(0)
- for pkg in self.model._packages:
- for cls in pkg._classes:
- if cls._storage == "none":
- continue
+ try:
+ cursor = conn.cursor()
- self.vacuum(cursor, cls)
+ log.info("Starting vacuum")
- conn.set_isolation_level(level)
+ cursor.execute("vacuum analyze")
- log.info("Vacuumed tables")
-
- def vacuum(self, cursor, cls):
- sql = "vacuum analyze verbose %s"
-
- cursor.execute(sql % cls.sql_table.identifier)
- cursor.execute(sql % cls.sql_samples_table.identifier)
+ log.info("Finished vacuum")
+ finally:
+ conn.close()
15 years, 7 months
rhmessaging commits: r4351 - in mgmt/newdata/cumin: etc and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-27 13:55:18 -0400 (Mon, 27 Sep 2010)
New Revision: 4351
Modified:
mgmt/newdata/cumin/bin/cumin-database
mgmt/newdata/cumin/etc/sysvinit-cumin
Log:
For bz 632592, in the init script, first check that postgresql is
running.
Before dropping the database, issue a warning and get explicit
confirmation.
Modified: mgmt/newdata/cumin/bin/cumin-database
===================================================================
--- mgmt/newdata/cumin/bin/cumin-database 2010-09-27 17:31:00 UTC (rev 4350)
+++ mgmt/newdata/cumin/bin/cumin-database 2010-09-27 17:55:18 UTC (rev 4351)
@@ -99,8 +99,16 @@
If, however, none of these changes affect your existing deployment, it
is safe to proceed.
-Enter 'yes' to proceed or Ctrl-C to cancel:
EOF
+
+ get-explicit-confirmation
+
+ install
+}
+
+function get-explicit-confirmation {
+ echo "Enter 'yes' to proceed or Ctrl-C to cancel:"
+
while read word; do
if [[ "$word" == "yes" ]]; then
break
@@ -108,8 +116,6 @@
echo "Enter 'yes' to proceed or Ctrl-C to cancel:"
done
-
- install
}
function install {
@@ -207,6 +213,19 @@
run "dropuser ${dbname}" postgres
}
+function confirm-drop {
+ cat <<EOF
+WARNING
+
+This operation will discard the contents of the cumin database.
+
+EOF
+
+ get-explicit-confirmation
+
+ drop
+}
+
function confirm-annihilate {
check-environment || exit 1
@@ -265,6 +284,9 @@
echo "The database is ready"
;;
+ check-started)
+ check-started || exit 1
+ ;;
install)
confirm-install
echo "The database is installed"
@@ -290,7 +312,7 @@
echo "The database is created"
;;
drop)
- drop
+ confirm-drop
echo "The database is dropped"
;;
annihilate)
Modified: mgmt/newdata/cumin/etc/sysvinit-cumin
===================================================================
--- mgmt/newdata/cumin/etc/sysvinit-cumin 2010-09-27 17:31:00 UTC (rev 4350)
+++ mgmt/newdata/cumin/etc/sysvinit-cumin 2010-09-27 17:55:18 UTC (rev 4351)
@@ -11,6 +11,12 @@
test -x /usr/bin/cumin || exit 1
test -x /usr/bin/cumin-database || exit 1
+cumin-database check-started &> /dev/null || {
+ echo "Cumin's database server is not running"
+ echo "Run 'cumin-database start' as root"
+ exit 1
+}
+
cumin-database check &> /dev/null || {
echo "Cumin's database is not yet installed"
echo "Run 'cumin-database install' as root"
15 years, 7 months
rhmessaging commits: r4350 - mgmt/newdata/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-09-27 13:31:00 -0400 (Mon, 27 Sep 2010)
New Revision: 4350
Modified:
mgmt/newdata/cumin/python/cumin/grid/pool.py
Log:
Use collector.pool == negotiator.name when finding a negotiator.
Todo: remove the check for multiple negotiators per collector.
Modified: mgmt/newdata/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-09-27 17:07:06 UTC (rev 4349)
+++ mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-09-27 17:31:00 UTC (rev 4350)
@@ -107,7 +107,7 @@
pool = self.collector.get(session)
if pool:
- negotiators = cls.get_selection(session.cursor, Pool=pool.Name)
+ negotiators = cls.get_selection(session.cursor, Pool=pool.Pool)
# use the most recently updated one if there are multiple
if len(negotiators) > 0:
recent_negotiator = negotiators[0]
15 years, 7 months
rhmessaging commits: r4349 - mgmt/newdata/wooly/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-27 13:07:06 -0400 (Mon, 27 Sep 2010)
New Revision: 4349
Modified:
mgmt/newdata/wooly/python/wooly/__init__.py
Log:
Additional fix for bz 622506; better handling of malformed query strings
Modified: mgmt/newdata/wooly/python/wooly/__init__.py
===================================================================
--- mgmt/newdata/wooly/python/wooly/__init__.py 2010-09-27 15:27:39 UTC (rev 4348)
+++ mgmt/newdata/wooly/python/wooly/__init__.py 2010-09-27 17:07:06 UTC (rev 4349)
@@ -552,7 +552,11 @@
vars = query.split(";")
for var in sorted(vars):
- key, value = var.split("=")
+ try:
+ key, value = var.split("=")
+ except ValueError:
+ continue
+
writer.write(" %-30s %s\n" % (key, value))
writer.write("\n")
@@ -751,16 +755,17 @@
for var in vars:
try:
skey, svalue = var.split("=")
- key = unquote(skey)
- value = unquote_plus(svalue)
+ except ValueError:
+ continue
- param = self.page.get_page_parameter_by_path(key)
+ key = unquote(skey)
+ value = unquote_plus(svalue)
- if param:
- param.add(self, param.unmarshal(value), key)
- except ValueError:
- pass
+ param = self.page.get_page_parameter_by_path(key)
+ if param:
+ param.add(self, param.unmarshal(value), key)
+
def marshal_cookies(self):
"""
Produce a list of strings representing cookies newly set on
15 years, 7 months
rhmessaging commits: r4348 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-27 11:27:39 -0400 (Mon, 27 Sep 2010)
New Revision: 4348
Modified:
mgmt/newdata/mint/python/mint/update.py
Log:
Instead of producing an error, drop updates for classes not in the model
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-09-27 15:14:39 UTC (rev 4347)
+++ mgmt/newdata/mint/python/mint/update.py 2010-09-27 15:27:39 UTC (rev 4348)
@@ -266,15 +266,14 @@
try:
pkg = self.model._packages_by_name[name]
except KeyError:
- raise PackageUnknown(name)
+ raise UpdateDropped()
name = class_key.getClassName()
try:
cls = pkg._classes_by_lowercase_name[name.lower()]
except KeyError:
- # XXX UpdateDropped instead?
- raise ClassUnknown(name)
+ raise UpdateDropped()
return cls
@@ -625,22 +624,6 @@
class UpdateDropped(Exception):
pass
-class UpdateException(Exception):
- def __init__(self, name):
- self.name = name
-
- def __str__(self):
- return "%s(%s)" % (self.__class__.__name__, self.name)
-
-class PackageUnknown(UpdateException):
- pass
-
-class ClassUnknown(UpdateException):
- pass
-
-class ObjectUnknown(UpdateException):
- pass
-
class MappingException(Exception):
pass
15 years, 7 months
rhmessaging commits: r4347 - mgmt/newdata/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-09-27 11:14:39 -0400 (Mon, 27 Sep 2010)
New Revision: 4347
Modified:
mgmt/newdata/cumin/python/cumin/grid/negotiator.py
Log:
Avoid exception when the get group names call succeeds, but the get values doesn't complete before the page updates.
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-09-27 13:56:47 UTC (rev 4346)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-09-27 15:14:39 UTC (rev 4347)
@@ -245,13 +245,16 @@
def render_content(self, session, group):
value = self.parent.group_helper.get_config_value(session, group, "GROUP_QUOTA_DYNAMIC")
self.task.form.group_leader.set(session, group)
- if not "loading" in value:
- href = self.task.get_href(session)
- content = "%s%%" % str(round(float(value) * 100.0, 2))
- return fmt_link(href, content, "", "", self.fmt_hover(""))
- else:
- return value
+ try:
+ if "loading" in value:
+ return value
+ except TypeError:
+ pass
+ href = self.task.get_href(session)
+ content = "%s%%" % str(round(float(value) * 100.0, 2))
+ return fmt_link(href, content, "", "", self.fmt_hover(""))
+
class SpacerColumn(ItemTableColumn):
def render_title(self, session, *args):
return ""
@@ -384,7 +387,7 @@
info = self.get_config_for_groups(session, config, [group])
return info[group][config]
except:
- return "loading"
+ return "<em>loading</em>"
def get_unclaimed_dyn_quota(self, session, groups):
info = self.get_config_info(session)
15 years, 7 months