diff options
| author | Kim van der Riet <kpvdr@apache.org> | 2013-11-26 08:13:30 +0000 |
|---|---|---|
| committer | Kim van der Riet <kpvdr@apache.org> | 2013-11-26 08:13:30 +0000 |
| commit | eb342c306d556dc5d58c2d90d76e96345dc5cb1c (patch) | |
| tree | 630e595c95000d0e216d9b79ca55a416b20078aa /qpid/cpp | |
| parent | 8f4c7e637f1baa622289ee36e0bda3792b0ee17d (diff) | |
| download | qpid-python-eb342c306d556dc5d58c2d90d76e96345dc5cb1c.tar.gz | |
QPID-5357 "Linearstore: Empty file recycling not functional": Fix which implements the empty file check for trailing empty files.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1545563 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
| -rw-r--r-- | qpid/cpp/src/linearstore.cmake | 4 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/linearstore/journal/LinearFileController.cpp | 13 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/linearstore/journal/LinearFileController.h | 1 |
3 files changed, 14 insertions, 4 deletions
diff --git a/qpid/cpp/src/linearstore.cmake b/qpid/cpp/src/linearstore.cmake index 2930ef9531..8568cdbb77 100644 --- a/qpid/cpp/src/linearstore.cmake +++ b/qpid/cpp/src/linearstore.cmake @@ -147,10 +147,10 @@ if (BUILD_LINEARSTORE) ) if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/db-inc.h) - message(STATUS "Including BDB from ${DB_INCLUDE_DIR}/db_cxx.h") + message(STATUS "Including BDB from ${DB_CXX_INCLUDE_DIR}/db_cxx.h") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/db-inc.h - "#include <${DB_INCLUDE_DIR}/db_cxx.h>\n") + "#include <${DB_CXX_INCLUDE_DIR}/db_cxx.h>\n") endif() add_library (linearstoreutils SHARED diff --git a/qpid/cpp/src/qpid/linearstore/journal/LinearFileController.cpp b/qpid/cpp/src/qpid/linearstore/journal/LinearFileController.cpp index 99b7f0f381..aa0f6da0de 100644 --- a/qpid/cpp/src/qpid/linearstore/journal/LinearFileController.cpp +++ b/qpid/cpp/src/qpid/linearstore/journal/LinearFileController.cpp @@ -36,7 +36,8 @@ LinearFileController::LinearFileController(jcntl& jcntlRef) : emptyFilePoolPtr_(0), currentJournalFilePtr_(0), fileSeqCounter_("LinearFileController::fileSeqCounter", 0), - recordIdCounter_("LinearFileController::recordIdCounter", 0) + recordIdCounter_("LinearFileController::recordIdCounter", 0), + decrCounter_("LinearFileController::decrCounter", 0) {} LinearFileController::~LinearFileController() {} @@ -106,7 +107,15 @@ uint32_t LinearFileController::incrEnqueuedRecordCount(const efpFileCount_t file uint32_t LinearFileController::decrEnqueuedRecordCount(const efpFileCount_t fileSeqNumber) { slock l(journalFileListMutex_); uint32_t r = find(fileSeqNumber)->decrEnqueuedRecordCount(); -// purgeEmptyFilesToEfpNoLock(); + + // TODO: Re-evaluate after testing and profiling + // This is the first go at implementing auto-purge, which checks for all trailing empty files and recycles + // them back to the EFP. This version checks every 100 decrements using decrCounter_ (an action which releases + // records). We need to check this rather simple scheme works for outlying scenarios (large and tiny data + // records) without impacting performance or performing badly (leaving excessive empty files in the journals). + if (decrCounter_.increment() % 100ULL == 0ULL) { + purgeEmptyFilesToEfpNoLock(); + } return r; } diff --git a/qpid/cpp/src/qpid/linearstore/journal/LinearFileController.h b/qpid/cpp/src/qpid/linearstore/journal/LinearFileController.h index 61226d3015..fa8327007a 100644 --- a/qpid/cpp/src/qpid/linearstore/journal/LinearFileController.h +++ b/qpid/cpp/src/qpid/linearstore/journal/LinearFileController.h @@ -47,6 +47,7 @@ protected: JournalFile* currentJournalFilePtr_; AtomicCounter<uint64_t> fileSeqCounter_; AtomicCounter<uint64_t> recordIdCounter_; + AtomicCounter<uint64_t> decrCounter_; JournalFileList_t journalFileList_; smutex journalFileListMutex_; |
