Author: kpvdr
Date: 2009-11-05 13:18:42 -0500 (Thu, 05 Nov 2009)
New Revision: 3701
Modified:
store/trunk/cpp/lib/MessageStoreImpl.cpp
store/trunk/cpp/lib/MessageStoreImpl.h
Log:
Fix for Bug 533169 - "clustered qpidd run as service (configured in /etc/qpidd.conf)
causes delete of /var/lib/qpidd/qpidd.sasldb"
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-11-04 22:20:31 UTC (rev 3700)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-11-05 18:18:42 UTC (rev 3701)
@@ -373,9 +373,9 @@
}
}
-void MessageStoreImpl::pushDown(const char* dirName, const char* bakDirName)
+void MessageStoreImpl::pushDown(const std::string& dirName, const std::string&
targetDir, const std::string& bakDirName)
{
- DIR* dir = ::opendir(dirName);
+ DIR* dir = ::opendir(dirName.c_str());
if (dir)
{
std::ostringstream oss;
@@ -385,15 +385,15 @@
// Create new bak dir
mrg::journal::jdir::create_dir(oss.str());
- // Copy contents of current dir into bak dir
+ // Copy contents of targetDir into bak dir
struct dirent* entry;
while ((entry = ::readdir(dir)) != 0) {
- // Ignore . and .. and backup dir
- if (std::strcmp(entry->d_name, ".") != 0 &&
std::strcmp(entry->d_name, "..") != 0 &&
std::strcmp(entry->d_name, bakDirName)) {
+ // Search for targetDir in dirName
+ if (std::strcmp(entry->d_name, targetDir.c_str()) == 0) {
std::ostringstream oldname;
- oldname << dirName << "/" <<
entry->d_name;
+ oldname << dirName << "/" << targetDir;
std::ostringstream newname;
- newname << oss.str() << "/" <<
entry->d_name;
+ newname << oss.str() << "/" << targetDir;
::rename(oldname.str().c_str(), newname.str().c_str());
}
}
@@ -416,11 +416,11 @@
dbenv->close(0);
}
if (pushDownStoreFiles)
- pushDown(storeDir.c_str(), "cluster_bak");
+ pushDown(storeDir, storeTopLevelDir, "cluster_bak");
else {
- QPID_LOG(notice, "Store in " << storeDir << "
truncated.");
std::ostringstream oss;
oss << storeDir << "/" << storeTopLevelDir;
+ QPID_LOG(notice, "Store in " << oss.str() << "
truncated.");
mrg::journal::jdir::delete_dir(oss.str().c_str());
}
init();
Modified: store/trunk/cpp/lib/MessageStoreImpl.h
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.h 2009-11-04 22:20:31 UTC (rev 3700)
+++ store/trunk/cpp/lib/MessageStoreImpl.h 2009-11-05 18:18:42 UTC (rev 3701)
@@ -169,7 +169,7 @@
void init();
- void pushDown(const char* dir, const char* bakDirName = "bak");
+ void pushDown(const std::string& dir, const std::string& targetDir, const
std::string& bakDirName = "bak");
void recoverQueues(TxnCtxt& txn,
qpid::broker::RecoveryManager& recovery,
Show replies by date