diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-10-13 10:16:18 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-10-13 10:16:18 +0200 |
commit | becc47cef625bfabf53589bb98ca10c352a4c824 (patch) | |
tree | 236708c8ce638bb904834bede6a3e9f70089d56c | |
parent | f7575cb9a81ed80848e21ea0cb31b6657f908f5d (diff) | |
download | rsyslog-becc47cef625bfabf53589bb98ca10c352a4c824.tar.gz rsyslog-becc47cef625bfabf53589bb98ca10c352a4c824.tar.xz rsyslog-becc47cef625bfabf53589bb98ca10c352a4c824.zip |
enhanced omfile to support transactional interface
This will increase performance in many cases.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | tools/omfile.c | 21 |
2 files changed, 22 insertions, 3 deletions
@@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 5.3.2 [DEVEL] (rgerhards), 2009-10-?? +- enhanced omfile to support transactional interface. This will increase + performance in many cases. - added multi-ruleset support to imudp - re-enabled input thread termination handling that does avoid thread cancellation where possible. This provides a more reliable mode of @@ -20,7 +22,7 @@ Version 5.3.2 [DEVEL] (rgerhards), 2009-10-?? way of message creation/submission. This enables older plugins to be used together with the new interface. The removal also enables us to drop a lot of duplicate code, reducing complexity and increasing - maintainibility. + maintainability. --------------------------------------------------------------------------- Version 5.3.1 [DEVEL] (rgerhards), 2009-10-05 - added $AbortOnUncleanConfig directive - permits to prevent startup when diff --git a/tools/omfile.c b/tools/omfile.c index 65140ac4..a724a695 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -624,12 +624,26 @@ BEGINtryResume CODESTARTtryResume ENDtryResume +BEGINbeginTransaction +CODESTARTbeginTransaction + /* we have nothing to do to begin a transaction */ +ENDbeginTransaction + + +BEGINendTransaction +CODESTARTendTransaction + if(pData->bFlushOnTXEnd) { + CHKiRet(strm.Flush(pData->pStrm)); + } +finalize_it: +ENDendTransaction + + BEGINdoAction CODESTARTdoAction DBGPRINTF("file to log to: %s\n", pData->f_fname); CHKiRet(writeFile(ppString, iMsgOpts, pData)); - if(pData->bFlushOnTXEnd) { - /* TODO v5: do this in endTransaction only! */ + if(!bCoreSupportsBatching && pData->bFlushOnTXEnd) { CHKiRet(strm.Flush(pData->pStrm)); } finalize_it: @@ -780,6 +794,7 @@ ENDmodExit BEGINqueryEtryPt CODESTARTqueryEtryPt CODEqueryEtryPt_STD_OMOD_QUERIES +CODEqueryEtryPt_TXIF_OMOD_QUERIES /* we support the transactional interface! */ CODEqueryEtryPt_doHUP ENDqueryEtryPt @@ -790,6 +805,8 @@ CODESTARTmodInit CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); CHKiRet(objUse(strm, CORE_COMPONENT)); + INITChkCoreFeature(bCoreSupportsBatching, CORE_FEATURE_BATCHING); + DBGPRINTF("omfile: %susing transactional output interface.\n", bCoreSupportsBatching ? "" : "not "); CHKiRet(omsdRegCFSLineHdlr((uchar *)"dynafilecachesize", 0, eCmdHdlrInt, (void*) setDynaFileCacheSize, NULL, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"omfileziplevel", 0, eCmdHdlrInt, NULL, &iZipLevel, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"omfileflushinterval", 0, eCmdHdlrInt, NULL, &iFlushInterval, STD_LOADABLE_MODULE_ID)); |