QPID-7877: Rolled back changes to linearstore journal-flush-timeout option made in QPID-7666. The original qpid::sys::Duration implementation which is more flexible and allows the use of units is restored.
diff --git a/src/qpid/linearstore/MessageStoreImpl.cpp b/src/qpid/linearstore/MessageStoreImpl.cpp
index 76cf415..946242d 100644
--- a/src/qpid/linearstore/MessageStoreImpl.cpp
+++ b/src/qpid/linearstore/MessageStoreImpl.cpp
@@ -58,7 +58,7 @@
tplWCachePgSizeSblks(0),
tplWCacheNumPages(0),
highestRid(0),
- journalFlushTimeoutNs(0),
+ journalFlushTimeout(defJournalFlushTimeoutNs),
isInit(false),
envPath(envpath_),
broker(broker_),
@@ -158,7 +158,7 @@
uint16_t jrnlWrCacheNumPages = chkJrnlWrCacheNumPages(opts->wCacheNumPages, "wcache-num-pages");
uint32_t tplJrnlWrCachePageSizeKib = chkJrnlWrPageCacheSize(opts->tplWCachePageSizeKib, "tpl-wcache-page-size");
uint16_t tplJrnlWrCacheNumPages = chkJrnlWrCacheNumPages(opts->tplWCacheNumPages, "tpl-wcache-num-pages");
- journalFlushTimeoutNs = opts->journalFlushTimeoutMs * 1000000;
+ journalFlushTimeout = opts->journalFlushTimeout;
// Pass option values to init()
return init(opts->storeDir,
@@ -207,7 +207,7 @@
QLS_LOG(info, "> TPL write cache page size: " << tplWCachePageSizeKib_ << " (KiB)");
QLS_LOG(info, "> TPL number of write cache pages: " << tplWCacheNumPages);
QLS_LOG(info, "> Overwrite before return to EFP: " << (overwriteBeforeReturnFlag?"True":"False"));
- QLS_LOG(info, "> Maximum journal flush time: " << (journalFlushTimeoutNs/1000000) << "ms");
+ QLS_LOG(info, "> Maximum journal flush time: " << journalFlushTimeout);
return isInit;
}
@@ -262,7 +262,7 @@
// NOTE: during normal initialization, agent == 0 because the store is initialized before the management infrastructure.
// However during a truncated initialization in a cluster, agent != 0. We always pass 0 as the agent for the
// TplStore to keep things consistent in a cluster. See https://bugzilla.redhat.com/show_bug.cgi?id=681026
- tplStorePtr.reset(new TplJournalImpl(broker->getTimer(), "TplStore", getTplBaseDir(), jrnlLog, defJournalGetEventsTimeoutNs, journalFlushTimeoutNs, 0));
+ tplStorePtr.reset(new TplJournalImpl(broker->getTimer(), "TplStore", getTplBaseDir(), jrnlLog, defJournalGetEventsTimeoutNs, journalFlushTimeout, 0));
isInit = true;
} catch (const DbException& e) {
if (e.get_errno() == DB_VERSION_MISMATCH)
@@ -423,7 +423,7 @@
}
jQueue = new JournalImpl(broker->getTimer(), queue_.getName(), getJrnlDir(queue_.getName()), jrnlLog,
- defJournalGetEventsTimeoutNs, journalFlushTimeoutNs, agent,
+ defJournalGetEventsTimeoutNs, journalFlushTimeout, agent,
boost::bind(&MessageStoreImpl::journalDeleted, this, _1));
{
qpid::sys::Mutex::ScopedLock sl(journalListLock);
@@ -742,7 +742,7 @@
break;
}
jQueue = new JournalImpl(broker->getTimer(), queueName, getJrnlDir(queueName),jrnlLog,
- defJournalGetEventsTimeoutNs, journalFlushTimeoutNs, agent,
+ defJournalGetEventsTimeoutNs, journalFlushTimeout, agent,
boost::bind(&MessageStoreImpl::journalDeleted, this, _1));
{
qpid::sys::Mutex::ScopedLock sl(journalListLock);
@@ -1545,7 +1545,7 @@
efpPartition(defEfpPartition),
efpFileSizeKib(defEfpFileSizeKib),
overwriteBeforeReturnFlag(defOverwriteBeforeReturnFlag),
- journalFlushTimeoutMs(defJournalFlushTimeoutMs)
+ journalFlushTimeout(defJournalFlushTimeoutNs)
{
addOptions()
("store-dir", qpid::optValue(storeDir, "DIR"),
@@ -1576,8 +1576,9 @@
"it to the Empty File Pool. When not in use (the default), then old message data remains "
"in the file, but is overwritten on next use. This option should only be used where security "
"considerations justify it as it makes the store somewhat slower.")
- ("journal-flush-timeout", qpid::optValue(journalFlushTimeoutMs, "MS"),
- "Maximum time to wait to flush journal in milliseconds")
+ ("journal-flush-timeout", qpid::optValue(journalFlushTimeout, "SECONDS"),
+ "Maximum time to wait to flush journal. Use ms, us units for "
+ "small time values (eg 10ms) - no space between value and unit.")
;
}
diff --git a/src/qpid/linearstore/MessageStoreImpl.h b/src/qpid/linearstore/MessageStoreImpl.h
index 0d230a7..0025100 100644
--- a/src/qpid/linearstore/MessageStoreImpl.h
+++ b/src/qpid/linearstore/MessageStoreImpl.h
@@ -86,7 +86,7 @@
uint16_t efpPartition;
uint64_t efpFileSizeKib;
bool overwriteBeforeReturnFlag;
- uint32_t journalFlushTimeoutMs;
+ qpid::sys::Duration journalFlushTimeout;
};
private:
@@ -113,7 +113,7 @@
// FIXME aconway 2010-03-09: was 10ms
static const uint64_t defJournalGetEventsTimeoutNs = 1 * 1000000; // 1ms
- static const uint64_t defJournalFlushTimeoutMs = 500;
+ static const uint64_t defJournalFlushTimeoutNs = 500 * 1000000; // 500ms
std::list<db_ptr> dbs;
dbEnv_ptr dbenv;
@@ -144,7 +144,7 @@
uint32_t tplWCachePgSizeSblks;
uint16_t tplWCacheNumPages;
uint64_t highestRid;
- qpid::sys::Duration journalFlushTimeoutNs;
+ qpid::sys::Duration journalFlushTimeout;
bool isInit;
const char* envPath;
qpid::broker::Broker* broker;