summaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-11-26 17:30:58 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-11-26 17:30:58 +0100
commite5fe270bdbcfbdd22cf9dcc71e7a83b6cc88a979 (patch)
tree7b34ad99f4efcbc1c3445ea219dd51dec7c387fc /action.c
parent1f48ed19f369b7324c15c432d56258f22791761b (diff)
downloadrsyslog-e5fe270bdbcfbdd22cf9dcc71e7a83b6cc88a979.tar.gz
rsyslog-e5fe270bdbcfbdd22cf9dcc71e7a83b6cc88a979.tar.xz
rsyslog-e5fe270bdbcfbdd22cf9dcc71e7a83b6cc88a979.zip
bugfix: commit transaction was not properly conveyed to message layer,
potentially resulting in non-message destruction and thus hangs
Diffstat (limited to 'action.c')
-rw-r--r--action.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/action.c b/action.c
index 07f14c24..9178b991 100644
--- a/action.c
+++ b/action.c
@@ -760,8 +760,9 @@ finalize_it:
* rgerhards, 2008-01-28
*/
static rsRetVal
-finishBatch(action_t *pThis)
+finishBatch(action_t *pThis, batch_t *pBatch)
{
+ int i;
DEFiRet;
ASSERT(pThis != NULL);
@@ -772,9 +773,14 @@ finishBatch(action_t *pThis)
CHKiRet(actionPrepare(pThis));
if(pThis->eState == ACT_STATE_ITX) {
iRet = pThis->pMod->mod.om.endTransaction(pThis->pModData);
+dbgprintf("XXX: finishBatch, result of endTranscation %d\n", iRet);
switch(iRet) {
case RS_RET_OK:
actionCommitted(pThis);
+ /* flag messages as committed */
+ for(i = 0 ; i < pBatch->nElem ; ++i) {
+ pBatch->pElem[i].state = BATCH_STATE_COMM;
+ }
break;
case RS_RET_SUSPENDED:
actionRetry(pThis);
@@ -842,11 +848,12 @@ tryDoAction(action_t *pAction, batch_t *pBatch, int *pnElem, int *pbShutdownImme
pBatch->pElem[iCommittedUpTo++].state = BATCH_STATE_COMM;
}
pBatch->pElem[i].state = BATCH_STATE_SUB;
- } else if(localRet == RS_RET_PREVIOUS_COMMITTED) {
+ } else if(localRet == RS_RET_DEFER_COMMIT) {
pBatch->pElem[i].state = BATCH_STATE_SUB;
} else if(localRet == RS_RET_DISCARDMSG) {
pBatch->pElem[i].state = BATCH_STATE_DISC;
} else {
+ dbgprintf("tryDoAction: unexpected error code %d, finalizing\n", localRet);
iRet = localRet;
FINALIZE;
}
@@ -892,7 +899,7 @@ submitBatch(action_t *pAction, batch_t *pBatch, int nElem, int *pbShutdownImmedi
/* try commit transaction, once done, we can simply do so as if
* that return state was returned from tryDoAction().
*/
- localRet = finishBatch(pAction);
+ localRet = finishBatch(pAction, pBatch); // TODO: careful, do we need the elem counter?
}
if( localRet == RS_RET_OK
@@ -942,7 +949,7 @@ processAction(action_t *pAction, batch_t *pBatch, int *pbShutdownImmediate)
assert(pBatch != NULL);
pBatch->iDoneUpTo = 0;
CHKiRet(submitBatch(pAction, pBatch, pBatch->nElem, pbShutdownImmediate));
- iRet = finishBatch(pAction);
+ iRet = finishBatch(pAction, pBatch);
finalize_it:
RETiRet;