qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1541122 - in /qpid/trunk/qpid/cpp/src/qpid: DataDir.cpp broker/Broker.cpp broker/Broker.h broker/QueueFactory.cpp
Date Tue, 12 Nov 2013 16:03:21 GMT
Author: gsim
Date: Tue Nov 12 16:03:20 2013
New Revision: 1541122

URL: http://svn.apache.org/r1541122
Log:
QPID-5316: add paging-dir option

Modified:
    qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h
    qpid/trunk/qpid/cpp/src/qpid/broker/QueueFactory.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp?rev=1541122&r1=1541121&r2=1541122&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp Tue Nov 12 16:03:20 2013
@@ -30,18 +30,15 @@ DataDir::DataDir (std::string path) :
     enabled (!path.empty ()),
     dirPath (path)
 {
-    if (!enabled)
+    if (enabled)
     {
-        QPID_LOG (info, "No data directory - Disabling persistent configuration");
-        return;
+        sys::FileSysDir dir(dirPath);
+        if (!dir.exists())
+            dir.mkdir();
+        std::string lockFileName(path);
+        lockFileName += "/lock";
+        lockFile = std::auto_ptr<sys::LockFile>(new sys::LockFile(lockFileName, true));
     }
-
-    sys::FileSysDir dir(dirPath);
-    if (!dir.exists())
-        dir.mkdir();
-    std::string lockFileName(path);
-    lockFileName += "/lock";
-    lockFile = std::auto_ptr<sys::LockFile>(new sys::LockFile(lockFileName, true));
 }
 
 DataDir::~DataDir () {}

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1541122&r1=1541121&r2=1541122&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Tue Nov 12 16:03:20 2013
@@ -163,6 +163,7 @@ Broker::Options::Options(const std::stri
     addOptions()
         ("data-dir", optValue(dataDir,"DIR"), "Directory to contain persistent data generated
by the broker")
         ("no-data-dir", optValue(noDataDir), "Don't use a data directory.  No persistent
configuration will be loaded or stored")
+        ("paging-dir", optValue(pagingDir,"DIR"), "Directory in which paging files will be
created for paged queues")
         ("port,p", optValue(port,"PORT"), "Tells the broker to listen on PORT")
         ("interface", optValue(listenInterfaces, "<interface name>|<interface address>"),
"Which network interfaces to use to listen for incoming connections")
         ("listen-disable", optValue(listenDisabled, "<transport name>"), "Transports
to disable listening")
@@ -216,6 +217,7 @@ Broker::Broker(const Broker::Options& co
     store(new NullMessageStore),
     acl(0),
     dataDir(conf.noDataDir ? std::string() : conf.dataDir),
+    pagingDir(conf.pagingDir),
     queues(this),
     exchanges(this),
     links(this),
@@ -231,6 +233,9 @@ Broker::Broker(const Broker::Options& co
     expiryPolicy(new ExpiryPolicy),
     getKnownBrokers(boost::bind(&Broker::getKnownBrokersImpl, this))
 {
+    if (!dataDir.isEnabled()) {
+        QPID_LOG (info, "No data directory - Disabling persistent configuration");
+    }
     try {
     if (conf.enableMgmt) {
         QPID_LOG(info, "Management enabled");
@@ -380,6 +385,11 @@ Broker::Broker(const Broker::Options& co
     }
 }
 
+std::string Broker::getPagingDirectoryPath()
+{
+    return pagingDir.isEnabled() ? pagingDir.getPath() : dataDir.getPath();
+}
+
 void Broker::declareStandardExchange(const std::string& name, const std::string&
type)
 {
     bool storeEnabled = store.get() != NULL;

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h?rev=1541122&r1=1541121&r2=1541122&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h Tue Nov 12 16:03:20 2013
@@ -91,6 +91,7 @@ class Broker : public sys::Runnable, pub
 
         bool noDataDir;
         std::string dataDir;
+        std::string pagingDir;
         uint16_t port;
         std::vector<std::string> listenInterfaces;
         std::vector<std::string> listenDisabled;
@@ -175,6 +176,7 @@ class Broker : public sys::Runnable, pub
     std::auto_ptr<MessageStore> store;
     AclModule* acl;
     DataDir dataDir;
+    DataDir pagingDir;
     ConnectionObservers connectionObservers;
     BrokerObservers brokerObservers;
 
@@ -239,6 +241,7 @@ class Broker : public sys::Runnable, pub
     Options& getOptions() { return config; }
     ProtocolRegistry& getProtocolRegistry() { return protocolRegistry; }
     ObjectFactoryRegistry& getObjectFactoryRegistry() { return objectFactory; }
+    std::string getPagingDirectoryPath();
 
     void setExpiryPolicy(const boost::intrusive_ptr<ExpiryPolicy>& e) { expiryPolicy
= e; }
     boost::intrusive_ptr<ExpiryPolicy> getExpiryPolicy() { return expiryPolicy; }

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueueFactory.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/QueueFactory.cpp?rev=1541122&r1=1541121&r2=1541122&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/QueueFactory.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/QueueFactory.cpp Tue Nov 12 16:03:20 2013
@@ -76,7 +76,7 @@ boost::shared_ptr<Queue> QueueFactory::c
         } else if (!qpid::sys::MemoryMappedFile::isSupported()) {
             QPID_LOG(warning, "Cannot create paged queue; memory mapped file support not
available on this platform");
         } else {
-            queue->messages = std::auto_ptr<Messages>(new PagedQueue(name, broker->getOptions().dataDir,
+            queue->messages = std::auto_ptr<Messages>(new PagedQueue(name, broker->getPagingDirectoryPath(),
                                                                      settings.maxPages ?
settings.maxPages : 4,
                                                                      settings.pageFactor
? settings.pageFactor : 1,
                                                                      broker->getProtocolRegistry()));



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message