summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--action.c19
-rw-r--r--action.h3
-rw-r--r--runtime/ruleset.c6
-rw-r--r--runtime/wti.h1
4 files changed, 11 insertions, 18 deletions
diff --git a/action.c b/action.c
index bae4e589..e63a01e3 100644
--- a/action.c
+++ b/action.c
@@ -332,6 +332,7 @@ rsRetVal actionConstruct(action_t **ppThis)
pThis->iSecsExecOnceInterval = 0;
pThis->bExecWhenPrevSusp = 0;
pThis->bRepMsgHasMsg = 0;
+ pThis->bDisabled = 0;
pThis->tLastOccur = datetime.GetTime(NULL); /* done once per action on startup only */
pThis->iActionNbr = iActionNbr;
pthread_mutex_init(&pThis->mutAction, NULL);
@@ -501,8 +502,6 @@ static uchar *getActStateName(action_t *pThis, wti_t *pWti)
return (uchar*) "rtry";
case ACT_STATE_SUSP:
return (uchar*) "susp";
- case ACT_STATE_DIED:
- return (uchar*) "died";
case ACT_STATE_COMM:
return (uchar*) "comm";
default:
@@ -535,7 +534,6 @@ static rsRetVal getReturnCode(action_t *pThis, wti_t *pWti)
iRet = RS_RET_SUSPENDED;
break;
case ACT_STATE_SUSP:
- case ACT_STATE_DIED:
iRet = RS_RET_ACTION_FAILED;
break;
default:
@@ -585,9 +583,9 @@ static void actionRetry(action_t *pThis, wti_t *pWti)
* depends on output module.
* rgerhards, 2007-08-02
*/
-static void actionDisable(action_t *pThis, wti_t *pWti)
+static void actionDisable(action_t *pThis)
{
- actionSetState(pThis, pWti, ACT_STATE_DIED);
+ pThis->bDisabled = 1;
}
@@ -669,7 +667,7 @@ actionDoRetry(action_t *pThis, wti_t *pWti)
}
}
} else if(iRet == RS_RET_DISABLE_ACTION) {
- actionDisable(pThis, pWti);
+ actionDisable(pThis);
}
}
@@ -765,7 +763,7 @@ dbgprintf("DDDDD: calling beginTransaction for action %d\n", pThis->iActionNbr);
actionRetry(pThis, pWti);
break;
case RS_RET_DISABLE_ACTION:
- actionDisable(pThis, pWti);
+ actionDisable(pThis);
break;
default:FINALIZE;
}
@@ -940,7 +938,7 @@ actionCallDoAction(action_t *pThis, int msgFlags, void *actParams, wti_t *pWti)
actionRetry(pThis, pWti);
break;
case RS_RET_DISABLE_ACTION:
- actionDisable(pThis, pWti);
+ actionDisable(pThis);
break;
default:/* permanent failure of this message - no sense in retrying. This is
* not yet handled (but easy TODO)
@@ -1011,7 +1009,7 @@ dbgprintf("DDDDD: calling endTransaction for action %d\n", pThis->iActionNbr);
actionRetry(pThis, pWti);
break;
case RS_RET_DISABLE_ACTION:
- actionDisable(pThis, pWti);
+ actionDisable(pThis);
break;
case RS_RET_DEFER_COMMIT:
DBGPRINTF("output plugin error: endTransaction() returns RS_RET_DEFER_COMMIT "
@@ -1338,8 +1336,7 @@ DEFFUNC_llExecFunc(doActivateActions)
errmsg.LogError(0, localRet, "file prefix (work directory?) "
"is missing");
}
-#warning think how to handle this:
- //actionDisable(pThis);
+ actionDisable(pThis);
}
DBGPRINTF("Action %s[%p]: queue %p started\n", modGetName(pThis->pMod),
pThis, pThis->pQueue);
diff --git a/action.h b/action.h
index bcb85859..5b2143b9 100644
--- a/action.h
+++ b/action.h
@@ -45,8 +45,9 @@ struct action_s {
int iActionNbr; /* this action's number (ID) */
sbool bExecWhenPrevSusp;/* execute only when previous action is suspended? */
sbool bWriteAllMarkMsgs;/* should all mark msgs be written (not matter how recent the action was executed)? */
- int iSecsExecOnceInterval; /* if non-zero, minimum seconds to wait until action is executed again */
sbool bHadAutoCommit; /* did an auto-commit happen during doAction()? */
+ sbool bDisabled;
+ int iSecsExecOnceInterval; /* if non-zero, minimum seconds to wait until action is executed again */
time_t ttResumeRtry; /* when is it time to retry the resume? */
int iResumeInterval;/* resume interval for this action */
int iResumeRetryCount;/* how often shall we retry a suspended action? (-1 --> eternal) */
diff --git a/runtime/ruleset.c b/runtime/ruleset.c
index 822150d9..2e8d1f0f 100644
--- a/runtime/ruleset.c
+++ b/runtime/ruleset.c
@@ -165,11 +165,7 @@ finalize_it:
static void
execAct(struct cnfstmt *stmt, msg_t *pMsg, wti_t *pWti)
{
-// TODO: check here if bPrevWasSuspsended was required and, if so
-// if we actually are permitted to execute this action.
-// NOTE: this will primarily be handled by end-of-batch processing
-
- if(getActionState(pWti, stmt->d.act) == ACT_STATE_DIED) {
+ if(stmt->d.act->bDisabled) {
DBGPRINTF("action %d died, do NOT execute\n", stmt->d.act->iActionNbr);
goto done;
}
diff --git a/runtime/wti.h b/runtime/wti.h
index 2a408c0a..57c2bfea 100644
--- a/runtime/wti.h
+++ b/runtime/wti.h
@@ -34,7 +34,6 @@
#define ACT_STATE_COMM 2 /* transaction finished (a transient state) */
#define ACT_STATE_RTRY 3 /* failure occured, trying to restablish ready state */
#define ACT_STATE_SUSP 4 /* suspended due to failure (return fail until timeout expired) */
-#define ACT_STATE_DIED 7 /* action permanently failed and now disabled */
/* note: 3 bit bit field --> highest value is 7! */
/* The following structure defines immutable parameters which need to