You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by pm...@apache.org on 2017/05/18 11:26:33 UTC
qpid-cpp git commit: QPID-7788: Linearstore doesnt move to EFP latest
journal files when deleting a durable queue
Repository: qpid-cpp
Updated Branches:
refs/heads/master e7f533f0d -> cbc50981b
QPID-7788: Linearstore doesnt move to EFP latest journal files when deleting a durable queue
After closing current file ptr, smarter call of
LinearFileControlle::purgeEmptyFilesToEfp() shall return to EFP each and every
remaining jrnl file.
Signed-off-by: Pavel Moravec <pm...@redhat.com>
Project: http://git-wip-us.apache.org/repos/asf/qpid-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-cpp/commit/cbc50981
Tree: http://git-wip-us.apache.org/repos/asf/qpid-cpp/tree/cbc50981
Diff: http://git-wip-us.apache.org/repos/asf/qpid-cpp/diff/cbc50981
Branch: refs/heads/master
Commit: cbc50981ba477ce4074e5e676100daaec3169627
Parents: e7f533f
Author: Pavel Moravec <pm...@redhat.com>
Authored: Thu May 18 13:21:47 2017 +0200
Committer: Pavel Moravec <pm...@redhat.com>
Committed: Thu May 18 13:21:47 2017 +0200
----------------------------------------------------------------------
.../linearstore/journal/LinearFileController.cpp | 17 +++++++++++------
.../linearstore/journal/LinearFileController.h | 3 ++-
src/qpid/linearstore/journal/jcntl.cpp | 3 ++-
3 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/cbc50981/src/qpid/linearstore/journal/LinearFileController.cpp
----------------------------------------------------------------------
diff --git a/src/qpid/linearstore/journal/LinearFileController.cpp b/src/qpid/linearstore/journal/LinearFileController.cpp
index 08d565c..9cb873d 100644
--- a/src/qpid/linearstore/journal/LinearFileController.cpp
+++ b/src/qpid/linearstore/journal/LinearFileController.cpp
@@ -49,16 +49,20 @@ void LinearFileController::initialize(const std::string& journalDirectory,
}
void LinearFileController::finalize() {
- if (currentJournalFilePtr_) {
- currentJournalFilePtr_->close();
- currentJournalFilePtr_ = 0;
- }
+ closeCurrentJournal();
while (!journalFileList_.empty()) {
delete journalFileList_.front();
journalFileList_.pop_front();
}
}
+void LinearFileController::closeCurrentJournal() {
+ if (currentJournalFilePtr_) {
+ currentJournalFilePtr_->close();
+ currentJournalFilePtr_ = 0;
+ }
+}
+
void LinearFileController::addJournalFile(JournalFile* journalFilePtr,
const uint32_t completedDblkCount,
const bool makeCurrentFlag) {
@@ -105,9 +109,10 @@ void LinearFileController::restoreEmptyFile(const std::string& fileName) {
addJournalFile(fileName, emptyFilePoolPtr_->getIdentity(), getNextFileSeqNum(), 0);
}
-void LinearFileController::purgeEmptyFilesToEfp() {
+void LinearFileController::purgeEmptyFilesToEfp(bool force_all) {
slock l(journalFileListMutex_);
- while (journalFileList_.front()->isNoEnqueuedRecordsRemaining() && journalFileList_.size() > 1) { // Can't purge last file, even if it has no enqueued records
+ while ((force_all && (journalFileList_.size() > 0)) || // when deleting the queue, remove really all journal files, otherwise ..
+ ((journalFileList_.size() > 1) && (journalFileList_.front()->isNoEnqueuedRecordsRemaining()))) { // .. dont purge last file, even if it has no enqueued records
emptyFilePoolPtr_->returnEmptyFileSymlink(journalFileList_.front()->getFqFileName());
delete journalFileList_.front();
journalFileList_.pop_front();
http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/cbc50981/src/qpid/linearstore/journal/LinearFileController.h
----------------------------------------------------------------------
diff --git a/src/qpid/linearstore/journal/LinearFileController.h b/src/qpid/linearstore/journal/LinearFileController.h
index 3cdfb72..83824c9 100644
--- a/src/qpid/linearstore/journal/LinearFileController.h
+++ b/src/qpid/linearstore/journal/LinearFileController.h
@@ -60,6 +60,7 @@ public:
EmptyFilePool* emptyFilePoolPtr,
uint64_t initialFileNumberVal);
void finalize();
+ void closeCurrentJournal();
void addJournalFile(JournalFile* journalFilePtr,
const uint32_t completedDblkCount,
@@ -71,7 +72,7 @@ public:
uint64_t getNextRecordId();
void removeFileToEfp(const std::string& fileName);
void restoreEmptyFile(const std::string& fileName);
- void purgeEmptyFilesToEfp();
+ void purgeEmptyFilesToEfp(bool force_all=false);
// Functions for manipulating counts of non-current JournalFile instances in journalFileList_
uint32_t getEnqueuedRecordCount(const uint64_t fileSeqNumber);
http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/cbc50981/src/qpid/linearstore/journal/jcntl.cpp
----------------------------------------------------------------------
diff --git a/src/qpid/linearstore/journal/jcntl.cpp b/src/qpid/linearstore/journal/jcntl.cpp
index cc31f2e..f207b9b 100644
--- a/src/qpid/linearstore/journal/jcntl.cpp
+++ b/src/qpid/linearstore/journal/jcntl.cpp
@@ -145,7 +145,8 @@ void
jcntl::delete_jrnl_files()
{
stop(true); // wait for AIO to complete
- _linearFileController.purgeEmptyFilesToEfp();
+ _linearFileController.closeCurrentJournal();
+ _linearFileController.purgeEmptyFilesToEfp(true);
_jdir.delete_dir();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org