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 | bdbd978b38cec8f5d336d24d6370bec40704d53f (patch) | |
| tree | 92b99c7346b7074a38689a6fd31fb413e2e8b1ee /cpp/src/qpid/linearstore/journal/LinearFileController.cpp | |
| parent | 7e01aebde53c3bdb29492e6eb056d7249aa8c611 (diff) | |
| download | qpid-python-bdbd978b38cec8f5d336d24d6370bec40704d53f.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/qpid@1545563 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/linearstore/journal/LinearFileController.cpp')
| -rw-r--r-- | cpp/src/qpid/linearstore/journal/LinearFileController.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cpp/src/qpid/linearstore/journal/LinearFileController.cpp b/cpp/src/qpid/linearstore/journal/LinearFileController.cpp index 99b7f0f381..aa0f6da0de 100644 --- a/cpp/src/qpid/linearstore/journal/LinearFileController.cpp +++ b/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; } |
