summaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-11-06 11:28:44 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-11-06 11:28:44 +0100
commit176dea765449df3fc057623cb3762bed2754d8fa (patch)
tree2b4f2ef1c3a6ebc8b94a87a666765ed3c2fe3f2e /action.c
parent08c262011d7436dcc189949d759cfad80d928a7e (diff)
downloadrsyslog-176dea765449df3fc057623cb3762bed2754d8fa.tar.gz
rsyslog-176dea765449df3fc057623cb3762bed2754d8fa.tar.bz2
rsyslog-176dea765449df3fc057623cb3762bed2754d8fa.zip
make batches of 1 commit automatically after each action
This improves failover handling and makes it consistent with doc (precise handling for batches of one).
Diffstat (limited to 'action.c')
-rw-r--r--action.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/action.c b/action.c
index e9395e23..718d9038 100644
--- a/action.c
+++ b/action.c
@@ -996,7 +996,7 @@ actionTryCommit(action_t *pThis, wti_t *pWti)
iparamCurr = iparamCurr->next;
free(iparamDel); // TODO: memleak strings!
}
- wrkrInfo->iparamLast = NULL;
+ wrkrInfo->iparamRoot = wrkrInfo->iparamLast = NULL;
}
CHKiRet(actionPrepare(pThis, pWti));
@@ -1102,14 +1102,14 @@ dbgprintf("DDDD: processMsgMain[act %d], %s\n", pAction->iActionNbr, pMsg->pszRa
pWti);
releaseDoActionParams(pAction, pWti);
finalize_it:
+ if(pWti->execState.bDoAutoCommit)
+ iRet = actionCommit(pAction, pWti);
pWti->execState.bPrevWasSuspended = (iRet == RS_RET_SUSPENDED || iRet == RS_RET_ACTION_FAILED);
dbgprintf("DDDD: bPrevWasSuspended now %d, action state %d\n", (int)pWti->execState.bPrevWasSuspended, getActionState(pWti, pAction));
RETiRet;
}
-/* receive an array of to-process user pointers and submit them
- * for processing.
- * rgerhards, 2009-04-22
+/* This entry point is called by the ACTION queue (not main queue!)
*/
static rsRetVal
processBatchMain(void *pVoid, batch_t *pBatch, wti_t *pWti)
@@ -1120,7 +1120,7 @@ processBatchMain(void *pVoid, batch_t *pBatch, wti_t *pWti)
struct syslogTime ttNow;
DEFiRet;
- pWti->execState.bPrevWasSuspended = 0;
+ wtiResetExecState(pWti, pBatch);
/* indicate we have not yet read the date */
ttNow.year = 0;
@@ -1133,7 +1133,8 @@ processBatchMain(void *pVoid, batch_t *pBatch, wti_t *pWti)
}
}
- iRet = actionCommit(pAction, pWti);
+ if(!pWti->execState.bDoAutoCommit)
+ iRet = actionCommit(pAction, pWti);
dbgprintf("DDDD: processBatchMain - end\n");
RETiRet;
}