summaryrefslogtreecommitdiffstats
path: root/tools/omfile.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-10-13 10:16:18 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-10-13 10:16:18 +0200
commitbecc47cef625bfabf53589bb98ca10c352a4c824 (patch)
tree236708c8ce638bb904834bede6a3e9f70089d56c /tools/omfile.c
parentf7575cb9a81ed80848e21ea0cb31b6657f908f5d (diff)
downloadrsyslog-becc47cef625bfabf53589bb98ca10c352a4c824.tar.gz
rsyslog-becc47cef625bfabf53589bb98ca10c352a4c824.tar.xz
rsyslog-becc47cef625bfabf53589bb98ca10c352a4c824.zip
enhanced omfile to support transactional interface
This will increase performance in many cases.
Diffstat (limited to 'tools/omfile.c')
-rw-r--r--tools/omfile.c21
1 files changed, 19 insertions, 2 deletions
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));