You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2013/09/20 20:59:50 UTC
svn commit: r1525101 [11/21] - in /qpid/branches/linearstore/qpid: ./ bin/
cpp/ cpp/bindings/ cpp/bindings/qmf/ cpp/bindings/qmf/python/
cpp/bindings/qmf/ruby/ cpp/bindings/qmf/tests/ cpp/bindings/qmf2/
cpp/bindings/qmf2/examples/cpp/ cpp/bindings/qmf2...
Modified: qpid/branches/linearstore/qpid/extras/dispatch/src/timer_private.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/extras/dispatch/src/timer_private.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/extras/dispatch/src/timer_private.h (original)
+++ qpid/branches/linearstore/qpid/extras/dispatch/src/timer_private.h Fri Sep 20 18:59:30 2013
@@ -8,9 +8,9 @@
* 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
Modified: qpid/branches/linearstore/qpid/extras/dispatch/src/work_queue.c
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/extras/dispatch/src/work_queue.c?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/extras/dispatch/src/work_queue.c (original)
+++ qpid/branches/linearstore/qpid/extras/dispatch/src/work_queue.c Fri Sep 20 18:59:30 2013
@@ -6,9 +6,9 @@
* 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
Modified: qpid/branches/linearstore/qpid/extras/dispatch/src/work_queue.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/extras/dispatch/src/work_queue.h?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/extras/dispatch/src/work_queue.h (original)
+++ qpid/branches/linearstore/qpid/extras/dispatch/src/work_queue.h Fri Sep 20 18:59:30 2013
@@ -8,9 +8,9 @@
* 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
Modified: qpid/branches/linearstore/qpid/extras/dispatch/tests/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/extras/dispatch/tests/CMakeLists.txt?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/extras/dispatch/tests/CMakeLists.txt (original)
+++ qpid/branches/linearstore/qpid/extras/dispatch/tests/CMakeLists.txt Fri Sep 20 18:59:30 2013
@@ -22,6 +22,7 @@
##
set(unit_test_SOURCES
alloc_test.c
+ compose_test.c
parse_test.c
run_unit_tests.c
server_test.c
@@ -51,3 +52,8 @@ add_test(unit_tests_size_2 unit_test
add_test(unit_tests_size_1 unit_tests_size 1)
add_test(unit_tests unit_tests ${CMAKE_CURRENT_SOURCE_DIR}/threads4.conf)
add_test(router_tests python ${CMAKE_CURRENT_SOURCE_DIR}/router_engine_test.py -v)
+add_test(system_tests_single python ${CMAKE_CURRENT_SOURCE_DIR}/system_tests_one_router.py -v)
+
+set_property(TEST system_tests_single PROPERTY
+ ENVIRONMENT "CTEST_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
+ )
Modified: qpid/branches/linearstore/qpid/extras/dispatch/tests/parse_test.c
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/extras/dispatch/tests/parse_test.c?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/extras/dispatch/tests/parse_test.c (original)
+++ qpid/branches/linearstore/qpid/extras/dispatch/tests/parse_test.c Fri Sep 20 18:59:30 2013
@@ -123,7 +123,7 @@ struct err_vector_t {
{"\xb0\x00\x00", 3, "Insufficient Data to Determine Length"}, // 6
{"\xb0\x00\x00\x00", 4, "Insufficient Data to Determine Length"}, // 7
{"\xc0\x04", 2, "Insufficient Data to Determine Count"}, // 8
-{"\xd0\x00\x00\x00\x00\x00\x00\x00\x01", 9, "Insufficient Data to Determine Tag"}, // 9
+{"\xd0\x00\x00\x00\x00\x00\x00\x00\x01", 9, "Insufficient Length to Determine Count"}, // 9
{0, 0, 0}
};
Modified: qpid/branches/linearstore/qpid/extras/dispatch/tests/router_engine_test.py
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/extras/dispatch/tests/router_engine_test.py?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/extras/dispatch/tests/router_engine_test.py (original)
+++ qpid/branches/linearstore/qpid/extras/dispatch/tests/router_engine_test.py Fri Sep 20 18:59:30 2013
@@ -18,8 +18,8 @@
#
import unittest
-from router.router_engine import NeighborEngine, PathEngine, Configuration
-from router.data import LinkState, MessageHELLO
+from qpid.dispatch.router.router_engine import NeighborEngine, PathEngine, Configuration
+from qpid.dispatch.router.data import LinkState, MessageHELLO
class Adapter(object):
def __init__(self, domain):
@@ -99,12 +99,19 @@ class NeighborTest(unittest.TestCase):
def local_link_state_changed(self, link_state):
self.local_link_state = link_state
+ def new_neighbor(self, rid):
+ self.neighbors[rid] = None
+
+ def lost_neighbor(self, rid):
+ self.neighbors.pop(rid)
+
def setUp(self):
self.sent = []
self.local_link_state = None
self.id = "R1"
self.area = "area"
self.config = Configuration()
+ self.neighbors = {}
def test_hello_sent(self):
self.sent = []
Modified: qpid/branches/linearstore/qpid/extras/dispatch/tests/run_unit_tests.c
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/extras/dispatch/tests/run_unit_tests.c?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/extras/dispatch/tests/run_unit_tests.c (original)
+++ qpid/branches/linearstore/qpid/extras/dispatch/tests/run_unit_tests.c Fri Sep 20 18:59:30 2013
@@ -25,6 +25,7 @@ int timer_tests();
int alloc_tests();
int server_tests();
int parse_tests();
+int compose_tests();
int main(int argc, char** argv)
{
@@ -39,6 +40,7 @@ int main(int argc, char** argv)
result += alloc_tests();
result += server_tests(argv[1]);
result += parse_tests(0);
+ result += compose_tests(0);
return result;
}
Modified: qpid/branches/linearstore/qpid/extras/qmf/setup.py
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/extras/qmf/setup.py?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/extras/qmf/setup.py (original)
+++ qpid/branches/linearstore/qpid/extras/qmf/setup.py Fri Sep 20 18:59:30 2013
@@ -20,7 +20,7 @@
from distutils.core import setup
setup(name="qpid-qmf",
- version="0.23",
+ version="0.25",
author="Apache Qpid",
author_email="dev@qpid.apache.org",
packages=["qmf"],
Modified: qpid/branches/linearstore/qpid/extras/qmf/src/py/qmf/console.py
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/extras/qmf/src/py/qmf/console.py?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/extras/qmf/src/py/qmf/console.py (original)
+++ qpid/branches/linearstore/qpid/extras/qmf/src/py/qmf/console.py Fri Sep 20 18:59:30 2013
@@ -3943,6 +3943,7 @@ class Event:
self.broker = agent.broker
if isinstance(v2Map,dict):
+ self.isV2 = True
self.classKey = None
self.schema = None
try:
@@ -3958,6 +3959,7 @@ class Event:
self.schema = self.session.schemaCache.getSchema(self.classKey)
elif codec is not None:
+ self.isV2 = None
self.classKey = ClassKey(codec)
self.classKey._setType(ClassKey.TYPE_EVENT)
self.timestamp = codec.read_int64()
Propchange: qpid/branches/linearstore/qpid/java/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java:r1501885-1525056
Modified: qpid/branches/linearstore/qpid/java/bdbstore/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/build.xml?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/build.xml (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/build.xml Fri Sep 20 18:59:30 2013
@@ -17,10 +17,12 @@
- under the License.
-->
<project name="bdbstore" xmlns:ivy="antlib:org.apache.ivy.ant" default="build">
- <property name="module.depends" value="common broker" />
- <property name="module.test.depends" value="client common/tests broker/tests management/common systests broker-plugins/management-jmx" />
+ <property name="module.depends" value="common broker broker-plugins/amqp-0-8-protocol broker-plugins/amqp-0-10-protocol" />
+ <property name="module.test.depends" value="client common/tests broker/tests management/common systests broker-plugins/management-jmx broker-plugins/memory-store broker-plugins/amqp-0-8-protocol broker-plugins/amqp-0-10-protocol broker-plugins/amqp-msg-conv-0-8-to-0-10" />
<property name="module.genpom" value="true"/>
- <property name="module.genpom.args" value="-Sqpid-common=provided -Sqpid-broker=provided -Sje=provided"/>
+ <property name="module.genpom.args" value="-Sqpid-common=provided -Sqpid-broker=provided -Sqpid-broker-plugins-amqp-0-8-protocol=provided -Sje=provided"/>
+
+ <property name="broker.plugin" value="true"/>
<import file="../module.xml" />
@@ -79,4 +81,9 @@ http://www.oracle.com/technetwork/databa
<target name="build" depends="check-request-props, bdb-jar-required, module.build" />
+ <!-- Overrides, target in module.xml -->
+ <target name="copy-broker-plugin-jars-deps" if="broker.plugin" description="copy broker plugins dependencies for use in release packaging">
+ <!-- NO-OP, we explicitly do not want to copy the dependencies for this optional functionality as we can't distribute them -->
+ </target>
+
</project>
Modified: qpid/branches/linearstore/qpid/java/bdbstore/jmx/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/jmx/build.xml?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/jmx/build.xml (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/jmx/build.xml Fri Sep 20 18:59:30 2013
@@ -18,7 +18,7 @@
-->
<project name="bdbstore-jmx" default="build">
<property name="module.depends" value="common broker broker-plugins/management-jmx management/common bdbstore" />
- <property name="module.test.depends" value="broker/tests common/tests management/common client systests bdbstore/tests" />
+ <property name="module.test.depends" value="broker/tests common/tests management/common client systests bdbstore/tests broker-plugins/memory-store" />
<property name="module.genpom" value="true"/>
<property name="module.genpom.args" value="-Sqpid-common=provided -Sqpid-broker=provided -Sqpid-broker-plugins-management-jmx=provided -Sqpid-management-common=provided -Sqpid-bdbstore=provided -Sje=provided"/>
@@ -28,4 +28,9 @@
<import file="../../module.xml" />
<target name="bundle" depends="bundle-tasks" />
+
+ <!-- Overrides target in module.xml -->
+ <target name="copy-broker-plugin-jars-deps" if="broker.plugin" description="copy broker plugins dependencies for use in release packaging">
+ <!-- NO-OP, we explicitly do not want to copy the dependencies for this optional functionality as we can't distribute them -->
+ </target>
</project>
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java Fri Sep 20 18:59:30 2013
@@ -21,24 +21,15 @@
package org.apache.qpid.server.store.berkeleydb;
import com.sleepycat.bind.tuple.ByteBinding;
+import com.sleepycat.bind.tuple.IntegerBinding;
import com.sleepycat.bind.tuple.LongBinding;
-import com.sleepycat.je.CheckpointConfig;
-import com.sleepycat.je.Cursor;
-import com.sleepycat.je.Database;
-import com.sleepycat.je.DatabaseConfig;
-import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.DatabaseException;
-import com.sleepycat.je.Environment;
-import com.sleepycat.je.EnvironmentConfig;
-import com.sleepycat.je.ExceptionEvent;
-import com.sleepycat.je.ExceptionListener;
-import com.sleepycat.je.LockConflictException;
-import com.sleepycat.je.LockMode;
-import com.sleepycat.je.OperationStatus;
+import com.sleepycat.je.*;
+import com.sleepycat.je.Transaction;
import java.io.File;
import java.lang.ref.SoftReference;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
@@ -76,24 +67,27 @@ public abstract class AbstractBDBMessage
private static final int LOCK_RETRY_ATTEMPTS = 5;
- public static final int VERSION = 6;
+ public static final int VERSION = 7;
private static final Map<String, String> ENVCONFIG_DEFAULTS = Collections.unmodifiableMap(new HashMap<String, String>()
{{
put(EnvironmentConfig.LOCK_N_LOCK_TABLES, "7");
+ put(EnvironmentConfig.STATS_COLLECT, "false"); // Turn off stats generation - feature introduced (and on by default) from BDB JE 5.0.84
}});
private Environment _environment;
- private String CONFIGURED_OBJECTS = "CONFIGURED_OBJECTS";
- private String MESSAGEMETADATADB_NAME = "MESSAGE_METADATA";
- private String MESSAGECONTENTDB_NAME = "MESSAGE_CONTENT";
- private String DELIVERYDB_NAME = "QUEUE_ENTRIES";
- private String BRIDGEDB_NAME = "BRIDGES";
- private String LINKDB_NAME = "LINKS";
- private String XIDDB_NAME = "XIDS";
+ private static String CONFIGURED_OBJECTS = "CONFIGURED_OBJECTS";
+ private static String MESSAGEMETADATADB_NAME = "MESSAGE_METADATA";
+ private static String MESSAGECONTENTDB_NAME = "MESSAGE_CONTENT";
+ private static String DELIVERYDB_NAME = "QUEUE_ENTRIES";
+ private static String BRIDGEDB_NAME = "BRIDGES";
+ private static String LINKDB_NAME = "LINKS";
+ private static String XIDDB_NAME = "XIDS";
+ private static String CONFIG_VERSION_DB = "CONFIG_VERSION";
private Database _configuredObjectsDb;
+ private Database _configVersionDb;
private Database _messageMetaDataDb;
private Database _messageContentDb;
private Database _deliveryDb;
@@ -145,6 +139,7 @@ public abstract class AbstractBDBMessage
private String _storeLocation;
private Map<String, String> _envConfigMap;
+ private VirtualHost _virtualHost;
public AbstractBDBMessageStore()
{
@@ -157,34 +152,58 @@ public abstract class AbstractBDBMessage
_eventManager.addEventListener(eventListener, events);
}
- public void configureConfigStore(String name,
- ConfigurationRecoveryHandler recoveryHandler,
- VirtualHost virtualHost) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception
{
_stateManager.attainState(State.INITIALISING);
_configRecoveryHandler = recoveryHandler;
-
- configure(name, virtualHost);
+ _virtualHost = virtualHost;
}
- public void configureMessageStore(String name,
- MessageStoreRecoveryHandler messageRecoveryHandler,
+ public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler messageRecoveryHandler,
TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
{
+ if(_stateManager.isInState(State.INITIAL))
+ {
+ // Is acting as a message store, but not a durable config store
+ _stateManager.attainState(State.INITIALISING);
+ }
+
_messageRecoveryHandler = messageRecoveryHandler;
_tlogRecoveryHandler = tlogRecoveryHandler;
+ _virtualHost = virtualHost;
+
+ completeInitialisation();
+ }
+
+ private void completeInitialisation() throws Exception
+ {
+ configure(_virtualHost);
_stateManager.attainState(State.INITIALISED);
}
public synchronized void activate() throws Exception
{
+ // check if acting as a durable config store, but not a message store
+ if(_stateManager.isInState(State.INITIALISING))
+ {
+ completeInitialisation();
+ }
_stateManager.attainState(State.ACTIVATING);
- recoverConfig(_configRecoveryHandler);
- recoverMessages(_messageRecoveryHandler);
- recoverQueueEntries(_tlogRecoveryHandler);
+ if(_configRecoveryHandler != null)
+ {
+ recoverConfig(_configRecoveryHandler);
+ }
+ if(_messageRecoveryHandler != null)
+ {
+ recoverMessages(_messageRecoveryHandler);
+ }
+ if(_tlogRecoveryHandler != null)
+ {
+ recoverQueueEntries(_tlogRecoveryHandler);
+ }
_stateManager.attainState(State.ACTIVE);
}
@@ -198,23 +217,38 @@ public abstract class AbstractBDBMessage
* Called after instantiation in order to configure the message store.
*
*
- * @param name The name of the virtual host using this store
- * @param virtualHost
+ *
+ * @param virtualHost The virtual host using this store
* @return whether a new store environment was created or not (to indicate whether recovery is necessary)
*
* @throws Exception If any error occurs that means the store is unable to configure itself.
*/
- public void configure(String name, VirtualHost virtualHost) throws Exception
+ public void configure(VirtualHost virtualHost) throws Exception
{
+ configure(virtualHost, _messageRecoveryHandler != null);
+ }
-
+ public void configure(VirtualHost virtualHost, boolean isMessageStore) throws Exception
+ {
+ String name = virtualHost.getName();
final String defaultPath = System.getProperty("QPID_WORK") + File.separator + "bdbstore" + File.separator + name;
-
- String storeLocation = (String) virtualHost.getAttribute(VirtualHost.STORE_PATH);
- if(storeLocation == null)
+ String storeLocation;
+ if(isMessageStore)
{
- storeLocation = defaultPath;
+ storeLocation = (String) virtualHost.getAttribute(VirtualHost.STORE_PATH);
+ if(storeLocation == null)
+ {
+ storeLocation = defaultPath;
+ }
+ }
+ else // we are acting only as the durable config store
+ {
+ storeLocation = (String) virtualHost.getAttribute(VirtualHost.CONFIG_STORE_PATH);
+ if(storeLocation == null)
+ {
+ storeLocation = defaultPath;
+ }
}
Object overfullAttr = virtualHost.getAttribute(MessageStoreConstants.OVERFULL_SIZE_ATTRIBUTE);
@@ -326,6 +360,7 @@ public abstract class AbstractBDBMessage
dbConfig.setReadOnly(false);
_configuredObjectsDb = openDatabase(CONFIGURED_OBJECTS, dbConfig);
+ _configVersionDb = openDatabase(CONFIG_VERSION_DB, dbConfig);
_messageMetaDataDb = openDatabase(MESSAGEMETADATADB_NAME, dbConfig);
_messageContentDb = openDatabase(MESSAGECONTENTDB_NAME, dbConfig);
_deliveryDb = openDatabase(DELIVERYDB_NAME, dbConfig);
@@ -399,6 +434,13 @@ public abstract class AbstractBDBMessage
_xidDb.close();
}
+
+ if (_configVersionDb != null)
+ {
+ LOGGER.info("Close config version database");
+ _configVersionDb.close();
+ }
+
closeEnvironment();
}
@@ -426,10 +468,15 @@ public abstract class AbstractBDBMessage
{
try
{
- recoveryHandler.beginConfigurationRecovery(this);
+ final int configVersion = getConfigVersion();
+ recoveryHandler.beginConfigurationRecovery(this, configVersion);
loadConfiguredObjects(recoveryHandler);
- recoveryHandler.completeConfigurationRecovery();
+ final int newConfigVersion = recoveryHandler.completeConfigurationRecovery();
+ if(newConfigVersion != configVersion)
+ {
+ updateConfigVersion(newConfigVersion);
+ }
}
catch (DatabaseException e)
{
@@ -438,6 +485,66 @@ public abstract class AbstractBDBMessage
}
+ private void updateConfigVersion(int newConfigVersion) throws AMQStoreException
+ {
+ Cursor cursor = null;
+ try
+ {
+ Transaction txn = _environment.beginTransaction(null, null);
+ cursor = _configVersionDb.openCursor(txn, null);
+ DatabaseEntry key = new DatabaseEntry();
+ ByteBinding.byteToEntry((byte) 0,key);
+ DatabaseEntry value = new DatabaseEntry();
+
+ while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS)
+ {
+ IntegerBinding.intToEntry(newConfigVersion, value);
+ OperationStatus status = cursor.put(key, value);
+ if (status != OperationStatus.SUCCESS)
+ {
+ throw new AMQStoreException("Error setting config version: " + status);
+ }
+ }
+ cursor.close();
+ cursor = null;
+ txn.commit();
+ }
+ finally
+ {
+ closeCursorSafely(cursor);
+ }
+
+ }
+
+ private int getConfigVersion() throws AMQStoreException
+ {
+ Cursor cursor = null;
+ try
+ {
+ cursor = _configVersionDb.openCursor(null, null);
+ DatabaseEntry key = new DatabaseEntry();
+ DatabaseEntry value = new DatabaseEntry();
+ while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS)
+ {
+ return IntegerBinding.entryToInt(value);
+ }
+
+ // Insert 0 as the default config version
+ IntegerBinding.intToEntry(0,value);
+ ByteBinding.byteToEntry((byte) 0,key);
+ OperationStatus status = _configVersionDb.put(null, key, value);
+ if (status != OperationStatus.SUCCESS)
+ {
+ throw new AMQStoreException("Error initialising config version: " + status);
+ }
+ return 0;
+ }
+ finally
+ {
+ closeCursorSafely(cursor);
+ }
+ }
+
private void loadConfiguredObjects(ConfigurationRecoveryHandler crh) throws DatabaseException
{
Cursor cursor = null;
@@ -743,7 +850,7 @@ public abstract class AbstractBDBMessage
{
LOGGER.debug("public void remove(id = " + id + ", type="+type+"): called");
}
- OperationStatus status = removeConfiguredObject(id);
+ OperationStatus status = removeConfiguredObject(null, id);
if (status == OperationStatus.NOTFOUND)
{
throw new AMQStoreException("Configured object of type " + type + " with id " + id + " not found");
@@ -751,8 +858,45 @@ public abstract class AbstractBDBMessage
}
@Override
+ public UUID[] removeConfiguredObjects(final UUID... objects) throws AMQStoreException
+ {
+ com.sleepycat.je.Transaction txn = _environment.beginTransaction(null, null);
+ Collection<UUID> removed = new ArrayList<UUID>(objects.length);
+ for(UUID id : objects)
+ {
+ if(removeConfiguredObject(txn, id) == OperationStatus.SUCCESS)
+ {
+ removed.add(id);
+ }
+ }
+
+ txn.commit();
+ return removed.toArray(new UUID[removed.size()]);
+ }
+
+ @Override
public void update(UUID id, String type, Map<String, Object> attributes) throws AMQStoreException
{
+ update(false, id, type, attributes, null);
+ }
+
+ public void update(ConfiguredObjectRecord... records) throws AMQStoreException
+ {
+ update(false, records);
+ }
+
+ public void update(boolean createIfNecessary, ConfiguredObjectRecord... records) throws AMQStoreException
+ {
+ com.sleepycat.je.Transaction txn = _environment.beginTransaction(null, null);
+ for(ConfiguredObjectRecord record : records)
+ {
+ update(createIfNecessary, record.getId(), record.getType(), record.getAttributes(), txn);
+ }
+ txn.commit();
+ }
+
+ private void update(boolean createIfNecessary, UUID id, String type, Map<String, Object> attributes, com.sleepycat.je.Transaction txn) throws AMQStoreException
+ {
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Updating " +type + ", id: " + id);
@@ -768,14 +912,14 @@ public abstract class AbstractBDBMessage
DatabaseEntry newValue = new DatabaseEntry();
ConfiguredObjectBinding configuredObjectBinding = ConfiguredObjectBinding.getInstance();
- OperationStatus status = _configuredObjectsDb.get(null, key, value, LockMode.DEFAULT);
- if (status == OperationStatus.SUCCESS)
+ OperationStatus status = _configuredObjectsDb.get(txn, key, value, LockMode.DEFAULT);
+ if (status == OperationStatus.SUCCESS || (createIfNecessary && status == OperationStatus.NOTFOUND))
{
ConfiguredObjectRecord newQueueRecord = new ConfiguredObjectRecord(id, type, attributes);
// write the updated entry to the store
configuredObjectBinding.objectToEntry(newQueueRecord, newValue);
- status = _configuredObjectsDb.put(null, key, newValue);
+ status = _configuredObjectsDb.put(txn, key, newValue);
if (status != OperationStatus.SUCCESS)
{
throw new AMQStoreException("Error updating queue details within the store: " + status);
@@ -1299,6 +1443,7 @@ public abstract class AbstractBDBMessage
{
if (_stateManager.isInState(State.ACTIVE))
{
+ LOGGER.debug("Storing configured object: " + configuredObject);
DatabaseEntry key = new DatabaseEntry();
UUIDTupleBinding keyBinding = UUIDTupleBinding.getInstance();
keyBinding.objectToEntry(configuredObject.getId(), key);
@@ -1324,14 +1469,16 @@ public abstract class AbstractBDBMessage
}
}
- private OperationStatus removeConfiguredObject(UUID id) throws AMQStoreException
+ private OperationStatus removeConfiguredObject(Transaction tx, UUID id) throws AMQStoreException
{
+
+ LOGGER.debug("Removing configured object: " + id);
DatabaseEntry key = new DatabaseEntry();
UUIDTupleBinding uuidBinding = UUIDTupleBinding.getInstance();
uuidBinding.objectToEntry(id, key);
try
{
- return _configuredObjectsDb.delete(null, key);
+ return _configuredObjectsDb.delete(tx, key);
}
catch (DatabaseException e)
{
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java Fri Sep 20 18:59:30 2013
@@ -122,14 +122,14 @@ public class BDBHAMessageStore extends A
private Map<String, String> _repConfig;
@Override
- public void configure(String name, VirtualHost virtualHost) throws Exception
+ public void configure(VirtualHost virtualHost) throws Exception
{
//Mandatory configuration
_groupName = getValidatedStringAttribute(virtualHost, "haGroupName");
_nodeName = getValidatedStringAttribute(virtualHost, "haNodeName");
_nodeHostPort = getValidatedStringAttribute(virtualHost, "haNodeAddress");
_helperHostPort = getValidatedStringAttribute(virtualHost, "haHelperAddress");
- _name = name;
+ _name = virtualHost.getName();
//Optional configuration
String durabilitySetting = getStringAttribute(virtualHost,"haDurability",null);
@@ -157,7 +157,7 @@ public class BDBHAMessageStore extends A
+ "! Please set highAvailability.coalescingSync to false in store configuration.");
}
- super.configure(name, virtualHost);
+ super.configure(virtualHost);
}
@@ -260,10 +260,10 @@ public class BDBHAMessageStore extends A
}
@Override
- public void configureMessageStore(String name, MessageStoreRecoveryHandler messageRecoveryHandler,
+ public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler messageRecoveryHandler,
TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
{
- super.configureMessageStore(name, messageRecoveryHandler, tlogRecoveryHandler);
+ super.configureMessageStore(virtualHost, messageRecoveryHandler, tlogRecoveryHandler);
final ReplicatedEnvironment replicatedEnvironment = getReplicatedEnvironment();
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java Fri Sep 20 18:59:30 2013
@@ -25,12 +25,14 @@ import org.apache.qpid.server.connection
import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.stats.StatisticsGatherer;
+import org.apache.qpid.server.store.DurableConfigurationRecoverer;
import org.apache.qpid.server.store.DurableConfigurationStore;
import org.apache.qpid.server.store.Event;
import org.apache.qpid.server.store.EventListener;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.OperationalLoggingListener;
import org.apache.qpid.server.virtualhost.AbstractVirtualHost;
+import org.apache.qpid.server.virtualhost.DefaultUpgraderProvider;
import org.apache.qpid.server.virtualhost.State;
import org.apache.qpid.server.virtualhost.VirtualHostConfigRecoveryHandler;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
@@ -58,7 +60,7 @@ public class BDBHAVirtualHost extends Ab
_messageStore = new BDBHAMessageStore();
final MessageStoreLogSubject storeLogSubject =
- new MessageStoreLogSubject(this, _messageStore.getClass().getSimpleName());
+ new MessageStoreLogSubject(getName(), _messageStore.getClass().getSimpleName());
OperationalLoggingListener.listen(_messageStore, storeLogSubject);
_messageStore.addEventListener(new BeforeActivationListener(), Event.BEFORE_ACTIVATE);
@@ -71,13 +73,16 @@ public class BDBHAVirtualHost extends Ab
_messageStore.addEventListener(new BeforePassivationListener(), Event.BEFORE_PASSIVATE);
VirtualHostConfigRecoveryHandler recoveryHandler = new VirtualHostConfigRecoveryHandler(this, getExchangeRegistry(), getExchangeFactory());
+ DurableConfigurationRecoverer configRecoverer =
+ new DurableConfigurationRecoverer(getName(), getDurableConfigurationRecoverers(),
+ new DefaultUpgraderProvider(this, getExchangeRegistry()));
- _messageStore.configureConfigStore(getName(),
- recoveryHandler,
- virtualHost);
+ _messageStore.configureConfigStore(
+ virtualHost, configRecoverer
+ );
- _messageStore.configureMessageStore(getName(),
- recoveryHandler,
+ _messageStore.configureMessageStore(
+ virtualHost, recoveryHandler,
recoveryHandler
);
}
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java Fri Sep 20 18:59:30 2013
@@ -26,10 +26,12 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory;
import org.apache.qpid.server.plugin.MessageStoreFactory;
+import org.apache.qpid.server.store.DurableConfigurationStore;
import org.apache.qpid.server.store.MessageStore;
-public class BDBMessageStoreFactory implements MessageStoreFactory
+public class BDBMessageStoreFactory implements MessageStoreFactory, DurableConfigurationStoreFactory
{
@Override
@@ -39,6 +41,12 @@ public class BDBMessageStoreFactory impl
}
@Override
+ public DurableConfigurationStore createDurableConfigurationStore()
+ {
+ return new BDBMessageStore();
+ }
+
+ @Override
public MessageStore createMessageStore()
{
return new BDBMessageStore();
@@ -76,12 +84,25 @@ public class BDBMessageStoreFactory impl
@Override
public void validateAttributes(Map<String, Object> attributes)
{
- Object storePath = attributes.get(VirtualHost.STORE_PATH);
- if(!(storePath instanceof String))
+ if(getType().equals(attributes.get(VirtualHost.STORE_TYPE)))
+ {
+ Object storePath = attributes.get(VirtualHost.STORE_PATH);
+ if(!(storePath instanceof String))
+ {
+ throw new IllegalArgumentException("Attribute '"+ VirtualHost.STORE_PATH
+ +"' is required and must be of type String.");
+
+ }
+ }
+ if(getType().equals(attributes.get(VirtualHost.CONFIG_STORE_TYPE)))
{
- throw new IllegalArgumentException("Attribute '"+ VirtualHost.STORE_PATH
- +"' is required and must be of type String.");
+ Object storePath = attributes.get(VirtualHost.CONFIG_STORE_PATH);
+ if(!(storePath instanceof String))
+ {
+ throw new IllegalArgumentException("Attribute '"+ VirtualHost.CONFIG_STORE_PATH
+ +"' is required and must be of type String.");
+ }
}
}
}
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MessageMetaDataBinding.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MessageMetaDataBinding.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MessageMetaDataBinding.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MessageMetaDataBinding.java Fri Sep 20 18:59:30 2013
@@ -26,7 +26,8 @@ import com.sleepycat.bind.tuple.TupleBin
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
-import org.apache.qpid.server.store.MessageMetaDataType;
+import org.apache.qpid.server.plugin.MessageMetaDataType;
+import org.apache.qpid.server.store.MessageMetaDataTypeRegistry;
import org.apache.qpid.server.store.StorableMessageMetaData;
/**
@@ -54,10 +55,8 @@ public class MessageMetaDataBinding exte
ByteBuffer buf = ByteBuffer.wrap(dataAsBytes);
buf.position(1);
buf = buf.slice();
- MessageMetaDataType type = MessageMetaDataType.values()[dataAsBytes[0]];
- StorableMessageMetaData metaData = type.getFactory().createMetaData(buf);
-
- return metaData;
+ MessageMetaDataType type = MessageMetaDataTypeRegistry.fromOrdinal(dataAsBytes[0]);
+ return type.createMetaData(buf);
}
@Override
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java Fri Sep 20 18:59:30 2013
@@ -40,7 +40,7 @@ import org.apache.qpid.framing.AMQShortS
import org.apache.qpid.framing.ContentHeaderBody;
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.server.message.MessageMetaData;
+import org.apache.qpid.server.protocol.v0_8.MessageMetaData;
import org.apache.qpid.server.store.StorableMessageMetaData;
import org.apache.qpid.server.store.berkeleydb.AMQShortStringEncoding;
import org.apache.qpid.server.store.berkeleydb.FieldTableEncoding;
@@ -148,7 +148,7 @@ public class UpgradeFrom4To5 extends Abs
// if the queue name is in the gathered list then inspect its binding arguments
// only topic exchange should have a JMS selector key in binding
if (potentialDurableSubs.contains(queueName)
- && exchangeName.equals(ExchangeDefaults.TOPIC_EXCHANGE_NAME))
+ && exchangeName.equals(AMQShortString.valueOf(ExchangeDefaults.TOPIC_EXCHANGE_NAME)))
{
if (arguments == null)
{
@@ -342,11 +342,11 @@ public class UpgradeFrom4To5 extends Abs
FieldTable emptyArguments = new FieldTable();
addBindingToDatabase(bindingTuple, newBindingsDatabase, transaction, queueNameAMQ,
- ExchangeDefaults.DIRECT_EXCHANGE_NAME, queueNameAMQ, emptyArguments);
+ AMQShortString.valueOf(ExchangeDefaults.DIRECT_EXCHANGE_NAME), queueNameAMQ, emptyArguments);
// TODO QPID-3490 we should not persist a default exchange binding
addBindingToDatabase(bindingTuple, newBindingsDatabase, transaction, queueNameAMQ,
- ExchangeDefaults.DEFAULT_EXCHANGE_NAME, queueNameAMQ, emptyArguments);
+ AMQShortString.valueOf(ExchangeDefaults.DEFAULT_EXCHANGE_NAME), queueNameAMQ, emptyArguments);
}
};
new DatabaseTemplate(environment, NEW_QUEUE_DB_NAME, NEW_BINDINGS_DB_NAME, transaction).run(queueCreateOperation);
@@ -364,7 +364,7 @@ public class UpgradeFrom4To5 extends Abs
DatabaseEntry key, DatabaseEntry value)
{
ExchangeRecord record = binding.entryToObject(value);
- if (ExchangeDefaults.TOPIC_EXCHANGE_CLASS.equals(record.getType()))
+ if (AMQShortString.valueOf(ExchangeDefaults.TOPIC_EXCHANGE_CLASS).equals(record.getType()))
{
topicExchanges.add(record.getName());
}
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java Fri Sep 20 18:59:30 2013
@@ -46,6 +46,7 @@ import org.apache.qpid.server.model.Life
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.queue.AMQQueueFactory;
+import org.apache.qpid.server.queue.QueueArgumentsConverter;
import org.apache.qpid.server.store.berkeleydb.AMQShortStringEncoding;
import org.apache.qpid.server.store.berkeleydb.FieldTableEncoding;
import org.apache.qpid.server.util.MapJsonSerializer;
@@ -86,11 +87,15 @@ public class UpgradeFrom5To6 extends Abs
static final String OLD_BRIDGES_DB_NAME = "bridges_v5";
static final String OLD_LINKS_DB_NAME = "links_v5";
- static final String[] DEFAULT_EXCHANGES = { ExchangeDefaults.DEFAULT_EXCHANGE_NAME.asString(),
- ExchangeDefaults.DEFAULT_EXCHANGE_NAME.asString(), ExchangeDefaults.FANOUT_EXCHANGE_NAME.asString(),
- ExchangeDefaults.HEADERS_EXCHANGE_NAME.asString(), ExchangeDefaults.TOPIC_EXCHANGE_NAME.asString(),
- ExchangeDefaults.DIRECT_EXCHANGE_NAME.asString() };
- private static final Set<String> DEFAULT_EXCHANGES_SET = new HashSet<String>(Arrays.asList(DEFAULT_EXCHANGES));
+ private static final Set<String> DEFAULT_EXCHANGES_SET =
+ new HashSet<String>(Arrays.asList(
+ ExchangeDefaults.DEFAULT_EXCHANGE_NAME,
+ ExchangeDefaults.FANOUT_EXCHANGE_NAME,
+ ExchangeDefaults.HEADERS_EXCHANGE_NAME,
+ ExchangeDefaults.TOPIC_EXCHANGE_NAME,
+ ExchangeDefaults.DIRECT_EXCHANGE_NAME));
+
+ private static final String ARGUMENTS = "arguments";
private MapJsonSerializer _serializer = new MapJsonSerializer();
@@ -452,8 +457,7 @@ public class UpgradeFrom5To6 extends Abs
{
// TODO: check and remove orphaned bindings
BindingRecord bindingRecord = binding.entryToObject(key);
- String exchangeName = bindingRecord.getExchangeName() == null ? ExchangeDefaults.DEFAULT_EXCHANGE_NAME
- .asString() : bindingRecord.getExchangeName().asString();
+ String exchangeName = bindingRecord.getExchangeName() == null ? ExchangeDefaults.DEFAULT_EXCHANGE_NAME : bindingRecord.getExchangeName().asString();
String queueName = bindingRecord.getQueueName().asString();
String routingKey = bindingRecord.getRoutingKey().asString();
FieldTable arguments = bindingRecord.getArguments();
@@ -580,10 +584,10 @@ public class UpgradeFrom5To6 extends Abs
if (moveNonExclusiveOwnerToDescription(owner, exclusive))
{
- _logger.info("Non-exclusive owner " + owner + " for queue " + queueName + " moved to " + AMQQueueFactory.X_QPID_DESCRIPTION);
+ _logger.info("Non-exclusive owner " + owner + " for queue " + queueName + " moved to " + QueueArgumentsConverter.X_QPID_DESCRIPTION);
attributesMap.put(Queue.OWNER, null);
- argumentsCopy.put(AMQShortString.valueOf(AMQQueueFactory.X_QPID_DESCRIPTION), owner);
+ argumentsCopy.put(AMQShortString.valueOf(QueueArgumentsConverter.X_QPID_DESCRIPTION), owner);
}
else
{
@@ -591,7 +595,7 @@ public class UpgradeFrom5To6 extends Abs
}
if (!argumentsCopy.isEmpty())
{
- attributesMap.put(Queue.ARGUMENTS, FieldTable.convertToMap(argumentsCopy));
+ attributesMap.put(ARGUMENTS, FieldTable.convertToMap(argumentsCopy));
}
return attributesMap;
}
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java Fri Sep 20 18:59:30 2013
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.server.store.berkeleydb.upgrade;
+import com.sleepycat.je.Cursor;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -73,7 +74,12 @@ public class Upgrader
}
int version = getSourceVersion(versionDb);
-
+ if(version > AbstractBDBMessageStore.VERSION)
+ {
+ throw new AMQStoreException("Database version " + version
+ + " is higher than the most recent known version: "
+ + AbstractBDBMessageStore.VERSION);
+ }
performUpgradeFromVersion(version, versionDb);
}
finally
@@ -87,19 +93,34 @@ public class Upgrader
int getSourceVersion(Database versionDb)
{
- int version = AbstractBDBMessageStore.VERSION + 1;
- OperationStatus result;
+ int version = -1;
- do
+ Cursor cursor = null;
+ try
{
- version--;
+ cursor = versionDb.openCursor(null, null);
+
DatabaseEntry key = new DatabaseEntry();
- IntegerBinding.intToEntry(version, key);
DatabaseEntry value = new DatabaseEntry();
- result = versionDb.get(null, key, value, LockMode.READ_COMMITTED);
+ while(cursor.getNext(key, value, null) == OperationStatus.SUCCESS)
+ {
+ int ver = IntegerBinding.entryToInt(key);
+ if(ver > version)
+ {
+ version = ver;
+ }
+ }
+ }
+ finally
+ {
+ if(cursor != null)
+ {
+ cursor.close();
+ }
}
- while(result == OperationStatus.NOTFOUND);
+
+
return version;
}
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/resources/virtualhost/bdb_ha/add.html
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/resources/virtualhost/bdb_ha/add.html?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/resources/virtualhost/bdb_ha/add.html (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/main/java/resources/virtualhost/bdb_ha/add.html Fri Sep 20 18:59:30 2013
@@ -31,7 +31,44 @@
<td class="tableContainer-labelCell" style="width: 300px;"><strong>Helper Address*: </strong></td>
<td class="tableContainer-valueCell">
<input dojoType="dijit/form/ValidationTextBox" id="formAddVirtualHost.specific.helperAddress"
- required="true" name="haHelperAddress" placeholder="host:port"/>
+ required="true" name="haHelperAddress" data-dojo-props="regExp:'([0-9a-zA-Z.-_]|::)+:[0-9]{1,5}', invalidMessage:'Must be of the form host:port'" placeholder="host:port"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="tableContainer-labelCell" style="width: 300px;"><strong>Durability: </strong></td>
+ <td class="tableContainer-valueCell">
+ <input dojoType="dijit/form/ValidationTextBox" id="formAddVirtualHost.specific.haDurability"
+ name="haDurability" placeholder="NO_SYNC,NO_SYNC,SIMPLE_MAJORITY"/>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="tableContainer-labelCell" style="width: 300px;"><strong>Coalesce local sync: </strong></td>
+ <td class="tableContainer-valueCell">
+ <input dojoType="dijit/form/CheckBox" id="formAddVirtualHost.specific.haCoalescingSync"
+ checked="true" onchange="require(['dijit/registry', 'dojo/domReady!'],
+ function(registry){
+ var checkbox = registry.byId('formAddVirtualHost.specific.haCoalescingSync');
+ var hidden = registry.byId('formAddVirtualHost.specific.haCoalescingSyncHidden');
+ hidden.set('value', checkbox.get('checked'));
+ })"/>
+
+ <input dojoType="dijit/form/TextBox" id="formAddVirtualHost.specific.haCoalescingSyncHidden" type="hidden" name="haCoalescingSync" value="true"/>
+ </td>
+
+ </tr>
+
+ <tr>
+ <td class="tableContainer-labelCell" style="width: 300px;"><strong>Designated Primary: </strong></td>
+ <td class="tableContainer-valueCell">
+ <input dojoType="dijit/form/CheckBox" id="formAddVirtualHost.specific.haDesignatedPrimary"
+ onchange="require(['dijit/registry', 'dojo/domReady!'],
+ function(registry){
+ var checkbox = registry.byId('formAddVirtualHost.specific.haDesignatedPrimary');
+ var hidden = registry.byId('formAddVirtualHost.specific.haDesignatedPrimaryHidden');
+ hidden.set('value', checkbox.get('checked'));
+ })"/>
+ <input dojoType="dijit/form/TextBox" id="formAddVirtualHost.specific.haDesignatedPrimaryHidden" type="hidden" name="haDesignatedPrimary" value="false"/>
</td>
</tr>
</table>
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreTest.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreTest.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreTest.java Fri Sep 20 18:59:30 2013
@@ -77,11 +77,11 @@ public class BDBHAMessageStoreTest exten
{
try
{
- FileUtils.delete(new File(_workDir), true);
if (_virtualHost != null)
{
_virtualHost.close();
}
+ FileUtils.delete(new File(_workDir), true);
}
finally
{
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java Fri Sep 20 18:59:30 2013
@@ -25,22 +25,35 @@ import org.apache.qpid.server.store.Dura
public class BDBMessageStoreConfigurationTest extends AbstractDurableConfigurationStoreTestCase
{
-
private BDBMessageStore _bdbMessageStore;
@Override
- protected void onReopenStore()
+ protected BDBMessageStore createMessageStore() throws Exception
{
- _bdbMessageStore = null;
+ createStoreIfNecessary();
+ return _bdbMessageStore;
}
@Override
- protected BDBMessageStore createMessageStore() throws Exception
+ protected void closeMessageStore() throws Exception
+ {
+ closeStoreIfNecessary();
+ }
+
+ @Override
+ protected DurableConfigurationStore createConfigStore() throws Exception
{
createStoreIfNecessary();
+
return _bdbMessageStore;
}
+ @Override
+ protected void closeConfigStore() throws Exception
+ {
+ closeStoreIfNecessary();
+ }
+
private void createStoreIfNecessary()
{
if(_bdbMessageStore == null)
@@ -49,11 +62,12 @@ public class BDBMessageStoreConfiguratio
}
}
- @Override
- protected DurableConfigurationStore createConfigStore() throws Exception
+ private void closeStoreIfNecessary() throws Exception
{
- createStoreIfNecessary();
-
- return _bdbMessageStore;
+ if (_bdbMessageStore != null)
+ {
+ _bdbMessageStore.close();
+ _bdbMessageStore = null;
+ }
}
}
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreQuotaEventsTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreQuotaEventsTest.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreQuotaEventsTest.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreQuotaEventsTest.java Fri Sep 20 18:59:30 2013
@@ -21,9 +21,7 @@
package org.apache.qpid.server.store.berkeleydb;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.configuration.XMLConfiguration;
import org.apache.log4j.Logger;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.store.MessageStore;
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java Fri Sep 20 18:59:30 2013
@@ -34,13 +34,14 @@ import org.apache.qpid.framing.ProtocolV
import org.apache.qpid.framing.abstraction.MessagePublishInfo;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.EnqueableMessage;
-import org.apache.qpid.server.message.MessageMetaData;
-import org.apache.qpid.server.message.MessageMetaData_0_10;
+import org.apache.qpid.server.protocol.v0_10.MessageMetaDataType_0_10;
+import org.apache.qpid.server.protocol.v0_8.MessageMetaData;
+import org.apache.qpid.server.protocol.v0_10.MessageMetaData_0_10;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.model.UUIDGenerator;
-import org.apache.qpid.server.model.VirtualHost;
-import org.apache.qpid.server.store.MessageMetaDataType;
+import org.apache.qpid.server.protocol.v0_8.MessageMetaDataType_0_8;
+import org.apache.qpid.server.store.MessageStoreTest;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StorableMessageMetaData;
import org.apache.qpid.server.store.StoredMessage;
@@ -55,15 +56,11 @@ import org.apache.qpid.transport.Message
import org.apache.qpid.transport.MessageProperties;
import org.apache.qpid.transport.MessageTransfer;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
/**
* Subclass of MessageStoreTest which runs the standard tests from the superclass against
* the BDB Store as well as additional tests specific to the BDB store-implementation.
*/
-public class BDBMessageStoreTest extends org.apache.qpid.server.store.MessageStoreTest
+public class BDBMessageStoreTest extends MessageStoreTest
{
private static byte[] CONTENT_BYTES = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
@@ -129,14 +126,14 @@ public class BDBMessageStoreTest extends
/*
* reload the store only (read-only)
*/
- bdbStore = reloadStore(bdbStore);
+ AbstractBDBMessageStore readOnlyStore = reloadStore(bdbStore);
/*
* Read back and validate the 0-8 message metadata and content
*/
- StorableMessageMetaData storeableMMD_0_8 = bdbStore.getMessageMetaData(messageid_0_8);
+ StorableMessageMetaData storeableMMD_0_8 = readOnlyStore.getMessageMetaData(messageid_0_8);
- assertEquals("Unexpected message type",MessageMetaDataType.META_DATA_0_8, storeableMMD_0_8.getType());
+ assertEquals("Unexpected message type", MessageMetaDataType_0_8.TYPE, storeableMMD_0_8.getType().ordinal());
assertTrue("Unexpected instance type", storeableMMD_0_8 instanceof MessageMetaData);
MessageMetaData returnedMMD_0_8 = (MessageMetaData) storeableMMD_0_8;
@@ -158,7 +155,7 @@ public class BDBMessageStoreTest extends
assertEquals("Property MessageID has changed", props_0_8.getMessageIdAsString(), returnedProperties_0_8.getMessageIdAsString());
ByteBuffer recoveredContent_0_8 = ByteBuffer.allocate((int) chb_0_8.getBodySize()) ;
- long recoveredCount_0_8 = bdbStore.getContent(messageid_0_8, 0, recoveredContent_0_8);
+ long recoveredCount_0_8 = readOnlyStore.getContent(messageid_0_8, 0, recoveredContent_0_8);
assertEquals("Incorrect amount of payload data recovered", chb_0_8.getBodySize(), recoveredCount_0_8);
String returnedPayloadString_0_8 = new String(recoveredContent_0_8.array());
assertEquals("Message Payload has changed", bodyText, returnedPayloadString_0_8);
@@ -166,9 +163,9 @@ public class BDBMessageStoreTest extends
/*
* Read back and validate the 0-10 message metadata and content
*/
- StorableMessageMetaData storeableMMD_0_10 = bdbStore.getMessageMetaData(messageid_0_10);
+ StorableMessageMetaData storeableMMD_0_10 = readOnlyStore.getMessageMetaData(messageid_0_10);
- assertEquals("Unexpected message type",MessageMetaDataType.META_DATA_0_10, storeableMMD_0_10.getType());
+ assertEquals("Unexpected message type", MessageMetaDataType_0_10.TYPE, storeableMMD_0_10.getType().ordinal());
assertTrue("Unexpected instance type", storeableMMD_0_10 instanceof MessageMetaData_0_10);
MessageMetaData_0_10 returnedMMD_0_10 = (MessageMetaData_0_10) storeableMMD_0_10;
@@ -189,11 +186,13 @@ public class BDBMessageStoreTest extends
assertEquals("Message content type has changed", msgProps_0_10.getContentType(), returnedMsgProps.getContentType());
ByteBuffer recoveredContent = ByteBuffer.allocate((int) msgProps_0_10.getContentLength()) ;
- long recoveredCount = bdbStore.getContent(messageid_0_10, 0, recoveredContent);
+ long recoveredCount = readOnlyStore.getContent(messageid_0_10, 0, recoveredContent);
assertEquals("Incorrect amount of payload data recovered", msgProps_0_10.getContentLength(), recoveredCount);
String returnedPayloadString_0_10 = new String(recoveredContent.array());
assertEquals("Message Payload has changed", bodyText, returnedPayloadString_0_10);
+
+ readOnlyStore.close();
}
private DeliveryProperties createDeliveryProperties_0_10()
@@ -231,7 +230,7 @@ public class BDBMessageStoreTest extends
messageStore.close();
AbstractBDBMessageStore newStore = new BDBMessageStore();
- newStore.configure("", getVirtualHostModel());
+ newStore.configure(getVirtualHostModel(),true);
newStore.startWithNoRecover();
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgradeTestPreparer.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgradeTestPreparer.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgradeTestPreparer.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgradeTestPreparer.java Fri Sep 20 18:59:30 2013
@@ -48,6 +48,7 @@ import org.apache.qpid.client.AMQConnect
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.server.queue.QueueArgumentsConverter;
import org.apache.qpid.url.URLSyntaxException;
/**
@@ -159,7 +160,7 @@ public class BDBStoreUpgradeTestPreparer
session = connection.createSession(true, Session.SESSION_TRANSACTED);
// Create a priority queue on broker
final Map<String,Object> priorityQueueArguments = new HashMap<String, Object>();
- priorityQueueArguments.put("x-qpid-priorities",10);
+ priorityQueueArguments.put(QueueArgumentsConverter.X_QPID_PRIORITIES,10);
createAndBindQueueOnBroker(session, PRIORITY_QUEUE_NAME, priorityQueueArguments);
// Create a queue that has a DLQ
@@ -342,4 +343,4 @@ public class BDBStoreUpgradeTestPreparer
BDBStoreUpgradeTestPreparer producer = new BDBStoreUpgradeTestPreparer();
producer.prepareBroker();
}
-}
\ No newline at end of file
+}
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java Fri Sep 20 18:59:30 2013
@@ -20,7 +20,6 @@
package org.apache.qpid.server.store.berkeleydb;
import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.XMLConfiguration;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.test.utils.QpidTestCase;
@@ -34,7 +33,7 @@ public class HAMessageStoreSmokeTest ext
{
try
{
- _store.configure("test", mock(VirtualHost.class));
+ _store.configure(mock(VirtualHost.class));
fail("Expected an exception to be thrown");
}
catch (ConfigurationException ce)
Modified: qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6Test.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6Test.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6Test.java (original)
+++ qpid/branches/linearstore/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6Test.java Fri Sep 20 18:59:30 2013
@@ -48,6 +48,7 @@ import org.apache.qpid.server.model.Life
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.queue.AMQQueueFactory;
+import org.apache.qpid.server.queue.QueueArgumentsConverter;
import org.apache.qpid.server.store.berkeleydb.entry.Xid;
import org.apache.qpid.server.store.berkeleydb.tuple.XidBinding;
import org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom5To6.CompoundKey;
@@ -76,6 +77,7 @@ import com.sleepycat.je.Transaction;
public class UpgradeFrom5To6Test extends AbstractUpgradeTestCase
{
private static final Logger _logger = Logger.getLogger(UpgradeFrom5To6Test.class);
+ private static final String ARGUMENTS = "arguments";
@Override
protected String getStoreDirectoryName()
@@ -287,12 +289,12 @@ public class UpgradeFrom5To6Test extends
expected.add(createExpectedQueueMap("clientid:myDurSubName", Boolean.TRUE, "clientid", null));
final Map<String, Object> queueWithOwnerArguments = new HashMap<String, Object>();
- queueWithOwnerArguments.put("x-qpid-priorities", 10);
- queueWithOwnerArguments.put(AMQQueueFactory.X_QPID_DESCRIPTION, "misused-owner-as-description");
+ queueWithOwnerArguments.put(QueueArgumentsConverter.X_QPID_PRIORITIES, 10);
+ queueWithOwnerArguments.put(QueueArgumentsConverter.X_QPID_DESCRIPTION, "misused-owner-as-description");
expected.add(createExpectedQueueMap("nonexclusive-with-erroneous-owner", Boolean.FALSE, null,queueWithOwnerArguments));
final Map<String, Object> priorityQueueArguments = new HashMap<String, Object>();
- priorityQueueArguments.put("x-qpid-priorities", 10);
+ priorityQueueArguments.put(QueueArgumentsConverter.X_QPID_PRIORITIES, 10);
expected.add(createExpectedQueueMap(PRIORITY_QUEUE_NAME, Boolean.FALSE, null, priorityQueueArguments));
final Map<String, Object> queueWithDLQArguments = new HashMap<String, Object>();
@@ -388,7 +390,7 @@ public class UpgradeFrom5To6Test extends
expectedQueueEntry.put(Queue.OWNER, owner);
if (argumentMap != null)
{
- expectedQueueEntry.put(Queue.ARGUMENTS, argumentMap);
+ expectedQueueEntry.put(ARGUMENTS, argumentMap);
}
return expectedQueueEntry;
}
Propchange: qpid/branches/linearstore/qpid/java/broker/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/broker:r1501885-1525056
Modified: qpid/branches/linearstore/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/RuleSetTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/RuleSetTest.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/RuleSetTest.java (original)
+++ qpid/branches/linearstore/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/RuleSetTest.java Fri Sep 20 18:59:30 2013
@@ -42,7 +42,7 @@ import org.apache.qpid.test.utils.QpidTe
* The ruleset is configured directly rather than using an external file by adding rules individually, calling the
* {@link RuleSet#grant(Integer, String, Permission, Operation, ObjectType, ObjectProperties)} method. Then, the
* access control mechanism is validated by checking whether operations would be authorised by calling the
- * {@link RuleSet#check(Principal, Operation, ObjectType, ObjectProperties)} method.
+ * {@link RuleSet#check(Subject, Operation, ObjectType, ObjectProperties)} method.
*
* It ensure that permissions can be granted correctly on users directly and on groups.
*/
@@ -53,9 +53,9 @@ public class RuleSetTest extends QpidTes
private static final String TEST_USER = "user";
// Common things that are passed to frame constructors
- private AMQShortString _queueName = new AMQShortString(this.getClass().getName() + "queue");
- private AMQShortString _exchangeName = new AMQShortString("amq.direct");
- private AMQShortString _exchangeType = new AMQShortString("direct");
+ private String _queueName = this.getClass().getName() + "queue";
+ private String _exchangeName = "amq.direct";
+ private String _exchangeType = "direct";
private Subject _testSubject = TestPrincipalUtils.createTestSubject(TEST_USER);
@Override
@@ -116,7 +116,7 @@ public class RuleSetTest extends QpidTes
public void testExchangeCreate()
{
ObjectProperties properties = new ObjectProperties(_exchangeName);
- properties.put(ObjectProperties.Property.TYPE, _exchangeType.asString());
+ properties.put(ObjectProperties.Property.TYPE, _exchangeType);
assertDenyGrantAllow(_testSubject, Operation.CREATE, ObjectType.EXCHANGE, properties);
}
Propchange: qpid/branches/linearstore/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0:r796646-796653
Merged /qpid/branches/0.5.x-dev/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0:r886720-886722,887145,892761,894875,916304,916325,930288,931179
Merged /qpid/branches/java-broker-vhost-refactor/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0:r1493674-1494547
Merged /qpid/branches/java-broker-0-10/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0:r795950-829653
Merged /qpid/branches/qpid-2935/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0:r1061302-1072333
Merged /qpid/branches/0.5.x-dev/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0:r886720-886722
Merged /qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0:r1503303-1525056
Merged /qpid/branches/java-network-refactor/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0:r805429-821809
Modified: qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/build.xml?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/build.xml (original)
+++ qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/build.xml Fri Sep 20 18:59:30 2013
@@ -22,6 +22,7 @@
<property name="module.genpom" value="true"/>
<property name="module.genpom.args" value="-Sqpid-common=provided -Sqpid-broker=provided"/>
+ <property name="broker-plugins-derby-store.libs" value="" />
<property name="broker.plugin" value="true"/>
Modified: qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java (original)
+++ qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java Fri Sep 20 18:59:30 2013
@@ -132,7 +132,7 @@ public class DerbyMessageStore extends A
_driverClass = (Class<Driver>) Class.forName(SQL_DRIVER_NAME);
String defaultPath = System.getProperty("QPID_WORK") + File.separator + "derbyDB";
- String databasePath = (String) virtualHost.getAttribute(VirtualHost.STORE_PATH);
+ String databasePath = isConfigStoreOnly() ? (String) virtualHost.getAttribute(VirtualHost.CONFIG_STORE_PATH) : (String) virtualHost.getAttribute(VirtualHost.STORE_PATH);
if(databasePath == null)
{
databasePath = defaultPath;
Modified: qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java (original)
+++ qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java Fri Sep 20 18:59:30 2013
@@ -24,10 +24,12 @@ import java.util.Collections;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory;
import org.apache.qpid.server.plugin.MessageStoreFactory;
+import org.apache.qpid.server.store.DurableConfigurationStore;
import org.apache.qpid.server.store.MessageStore;
-public class DerbyMessageStoreFactory implements MessageStoreFactory
+public class DerbyMessageStoreFactory implements MessageStoreFactory, DurableConfigurationStoreFactory
{
@Override
@@ -37,6 +39,12 @@ public class DerbyMessageStoreFactory im
}
@Override
+ public DurableConfigurationStore createDurableConfigurationStore()
+ {
+ return new DerbyMessageStore();
+ }
+
+ @Override
public MessageStore createMessageStore()
{
return new DerbyMessageStore();
@@ -52,12 +60,25 @@ public class DerbyMessageStoreFactory im
@Override
public void validateAttributes(Map<String, Object> attributes)
{
- Object storePath = attributes.get(VirtualHost.STORE_PATH);
- if(!(storePath instanceof String))
+ if(getType().equals(attributes.get(VirtualHost.STORE_TYPE)))
+ {
+ Object storePath = attributes.get(VirtualHost.STORE_PATH);
+ if(!(storePath instanceof String))
+ {
+ throw new IllegalArgumentException("Attribute '"+ VirtualHost.STORE_PATH
+ +"' is required and must be of type String.");
+
+ }
+ }
+ if(getType().equals(attributes.get(VirtualHost.CONFIG_STORE_TYPE)))
{
- throw new IllegalArgumentException("Attribute '"+ VirtualHost.STORE_PATH
- +"' is required and must be of type String.");
+ Object storePath = attributes.get(VirtualHost.CONFIG_STORE_PATH);
+ if(!(storePath instanceof String))
+ {
+ throw new IllegalArgumentException("Attribute '"+ VirtualHost.CONFIG_STORE_PATH
+ +"' is required and must be of type String.");
+ }
}
}
Modified: qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreConfigurationTest.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreConfigurationTest.java (original)
+++ qpid/branches/linearstore/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreConfigurationTest.java Fri Sep 20 18:59:30 2013
@@ -28,18 +28,17 @@ public class DerbyMessageStoreConfigurat
private DerbyMessageStore _derbyMessageStore;
@Override
- protected void onReopenStore()
- {
- _derbyMessageStore = null;
- }
-
- @Override
protected DerbyMessageStore createMessageStore() throws Exception
{
createStoreIfNecessary();
return _derbyMessageStore;
}
+ @Override
+ protected void closeMessageStore() throws Exception
+ {
+ closeStoreIfNecessary();
+ }
private void createStoreIfNecessary()
{
@@ -55,4 +54,19 @@ public class DerbyMessageStoreConfigurat
createStoreIfNecessary();
return _derbyMessageStore;
}
+
+ @Override
+ protected void closeConfigStore() throws Exception
+ {
+ closeStoreIfNecessary();
+ }
+
+ private void closeStoreIfNecessary() throws Exception
+ {
+ if (_derbyMessageStore != null)
+ {
+ _derbyMessageStore.close();
+ _derbyMessageStore = null;
+ }
+ }
}
Modified: qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-provider-bone/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-provider-bone/build.xml?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-provider-bone/build.xml (original)
+++ qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-provider-bone/build.xml Fri Sep 20 18:59:30 2013
@@ -21,6 +21,8 @@
<property name="module.genpom" value="true"/>
<property name="module.genpom.args" value="-Sqpid-common=provided -Sqpid-broker=provided"/>
+ <property name="broker.plugin" value="true"/>
+
<import file="../../module.xml" />
<condition property="download.bonecp.jar">
Modified: qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/build.xml?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/build.xml (original)
+++ qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/build.xml Fri Sep 20 18:59:30 2013
@@ -22,6 +22,7 @@
<property name="module.genpom" value="true"/>
<property name="module.genpom.args" value="-Sqpid-common=provided -Sqpid-broker=provided"/>
+ <property name="broker-plugins-jdbc-store.libs" value="" />
<property name="broker.plugin" value="true"/>
Modified: qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java (original)
+++ qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java Fri Sep 20 18:59:30 2013
@@ -51,6 +51,7 @@ public class JDBCMessageStore extends Ab
public static final String TYPE = "JDBC";
public static final String CONNECTION_URL = "connectionURL";
+ public static final String CONFIG_CONNECTION_URL = "configConnectionURL";
protected String _connectionURL;
private ConnectionProvider _connectionProvider;
@@ -280,11 +281,20 @@ public class JDBCMessageStore extends Ab
throws ClassNotFoundException, SQLException
{
+ String connectionURL;
+ if(!isConfigStoreOnly())
+ {
+ connectionURL = virtualHost.getAttribute(CONNECTION_URL) == null
+ ? String.valueOf(virtualHost.getAttribute(VirtualHost.STORE_PATH))
+ : String.valueOf(virtualHost.getAttribute(CONNECTION_URL));
+ }
+ else
+ {
+ connectionURL = virtualHost.getAttribute(CONFIG_CONNECTION_URL) == null
+ ? String.valueOf(virtualHost.getAttribute(VirtualHost.CONFIG_STORE_PATH))
+ : String.valueOf(virtualHost.getAttribute(CONFIG_CONNECTION_URL));
- String connectionURL = virtualHost.getAttribute(CONNECTION_URL) == null
- ? String.valueOf(virtualHost.getAttribute(VirtualHost.STORE_PATH))
- : String.valueOf(virtualHost.getAttribute(CONNECTION_URL));
-
+ }
JDBCDetails details = null;
String[] components = connectionURL.split(":",3);
Modified: qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java?rev=1525101&r1=1525100&r2=1525101&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java (original)
+++ qpid/branches/linearstore/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java Fri Sep 20 18:59:30 2013
@@ -24,10 +24,12 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory;
import org.apache.qpid.server.plugin.MessageStoreFactory;
+import org.apache.qpid.server.store.DurableConfigurationStore;
import org.apache.qpid.server.store.MessageStore;
-public class JDBCMessageStoreFactory implements MessageStoreFactory
+public class JDBCMessageStoreFactory implements MessageStoreFactory, DurableConfigurationStoreFactory
{
@Override
@@ -43,6 +45,12 @@ public class JDBCMessageStoreFactory imp
}
@Override
+ public DurableConfigurationStore createDurableConfigurationStore()
+ {
+ return new JDBCMessageStore();
+ }
+
+ @Override
public Map<String, Object> convertStoreConfiguration(Configuration storeConfiguration)
{
Map<String,Object> convertedMap = new HashMap<String,Object>();
@@ -67,15 +75,32 @@ public class JDBCMessageStoreFactory imp
@Override
public void validateAttributes(Map<String, Object> attributes)
{
- Object connectionURL = attributes.get(JDBCMessageStore.CONNECTION_URL);
- if(!(connectionURL instanceof String))
+ if(getType().equals(attributes.get(VirtualHost.STORE_TYPE)))
+ {
+ Object connectionURL = attributes.get(JDBCMessageStore.CONNECTION_URL);
+ if(!(connectionURL instanceof String))
+ {
+ Object storePath = attributes.get(VirtualHost.STORE_PATH);
+ if(!(storePath instanceof String))
+ {
+ throw new IllegalArgumentException("Attribute '"+ JDBCMessageStore.CONNECTION_URL
+ +"' is required and must be of type String.");
+
+ }
+ }
+ }
+ if(getType().equals(attributes.get(VirtualHost.CONFIG_STORE_TYPE)))
{
- Object storePath = attributes.get(VirtualHost.STORE_PATH);
- if(!(storePath instanceof String))
+ Object connectionURL = attributes.get(JDBCMessageStore.CONFIG_CONNECTION_URL);
+ if(!(connectionURL instanceof String))
{
- throw new IllegalArgumentException("Attribute '"+ JDBCMessageStore.CONNECTION_URL
- +"' is required and must be of type String.");
+ Object storePath = attributes.get(VirtualHost.CONFIG_STORE_PATH);
+ if(!(storePath instanceof String))
+ {
+ throw new IllegalArgumentException("Attribute '"+ JDBCMessageStore.CONFIG_CONNECTION_URL
+ +"' is required and must be of type String.");
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org