diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-07-07 17:21:37 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-07-07 17:21:37 +0200 |
commit | 8e4ad77e54c9d9272cef41f71d94ae277965711e (patch) | |
tree | 9947e7ab8e00762a20691f1fb548c5fc1fc77ab6 | |
parent | 3250a710abb07bf4cfda1c3030b767286b39eff2 (diff) | |
parent | 9e9322585d632b20d714cdbf37e86be624b60642 (diff) | |
download | rsyslog-8e4ad77e54c9d9272cef41f71d94ae277965711e.tar.gz rsyslog-8e4ad77e54c9d9272cef41f71d94ae277965711e.tar.xz rsyslog-8e4ad77e54c9d9272cef41f71d94ae277965711e.zip |
Merge branch 'v4-beta'
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | runtime/msg.c | 43 | ||||
-rw-r--r-- | runtime/queue.c | 4 |
3 files changed, 35 insertions, 18 deletions
@@ -44,6 +44,12 @@ increase. output module interface --------------------------------------------------------------------------- Version 4.5.1 [DEVEL] (rgerhards), 2009-07-?? +- bugfix: properties inputname, fromhost, fromhost-ip, msg were lost when + working with disk queues +- performance enhancement: much faster, up to twice as fast (depending + on configuration) +- bugfix: abort condition when RecvFrom was not set and message reduction + was on. Happend e.g. with imuxsock. - added $klogConsoleLogLevel directive which permits to set a new console log level while rsyslog is active --------------------------------------------------------------------------- diff --git a/runtime/msg.c b/runtime/msg.c index 6c272d1f..63ed0083 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -864,12 +864,18 @@ msg_t* MsgDup(msg_t* pOld) pNew->iProtocolVersion = pOld->iProtocolVersion; pNew->ttGenTime = pOld->ttGenTime; pNew->offMSG = pOld->offMSG; - pNew->pRcvFrom = pOld->pRcvFrom; - prop.AddRef(pNew->pRcvFrom); - pNew->pRcvFromIP = pOld->pRcvFromIP; - prop.AddRef(pNew->pRcvFromIP); - pNew->pInputName = pOld->pInputName; - prop.AddRef(pNew->pInputName); + if(pOld->pRcvFrom != NULL) { + pNew->pRcvFrom = pOld->pRcvFrom; + prop.AddRef(pNew->pRcvFrom); + } + if(pOld->pRcvFromIP != NULL) { + pNew->pRcvFromIP = pOld->pRcvFromIP; + prop.AddRef(pNew->pRcvFromIP); /* XXX */ + } + if(pOld->pInputName != NULL) { + pNew->pInputName = pOld->pInputName; + prop.AddRef(pNew->pInputName); + } /* enable this, if someone actually uses UxTradMsg, delete after some time has * passed and nobody complained -- rgerhards, 2009-06-16 pNew->offAfterPRI = pOld->offAfterPRI; @@ -936,14 +942,11 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm) assert(pThis != NULL); assert(pStrm != NULL); - /* "pump" some property values into strings */ - /* then serialize elements */ CHKiRet(obj.BeginSerialize(pStrm, (obj_t*) pThis)); objSerializeSCALAR(pStrm, iProtocolVersion, SHORT); objSerializeSCALAR(pStrm, iSeverity, SHORT); objSerializeSCALAR(pStrm, iFacility, SHORT); - objSerializeSCALAR(pStrm, offMSG, SHORT); objSerializeSCALAR(pStrm, msgFlags, INT); objSerializeSCALAR(pStrm, ttGenTime, INT); objSerializeSCALAR(pStrm, tRcvdAt, SYSLOGTIME); @@ -959,17 +962,22 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm) objSerializePTR(pStrm, pszRawMsg, PSZ); objSerializePTR(pStrm, pszHOSTNAME, PSZ); getInputName(pThis, &psz, &len); - objSerializeSCALAR_VAR(pStrm, "pszInputName", PSZ, psz); + CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszInputName"), PROPTYPE_PSZ, (void*) psz)); psz = getRcvFrom(pThis); - objSerializeSCALAR_VAR(pStrm, "pszRcvFrom", PSZ, psz); + CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszRcvFrom"), PROPTYPE_PSZ, (void*) psz)); psz = getRcvFromIP(pThis); - objSerializeSCALAR_VAR(pStrm, "pszRcvFromIP", PSZ, psz); + CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszRcvFromIP"), PROPTYPE_PSZ, (void*) psz)); objSerializePTR(pStrm, pCSStrucData, CSTR); objSerializePTR(pStrm, pCSAPPNAME, CSTR); objSerializePTR(pStrm, pCSPROCID, CSTR); objSerializePTR(pStrm, pCSMSGID, CSTR); + /* offset must be serialized after pszRawMsg, because we need that to obtain the correct + * MSG size. + */ + objSerializeSCALAR(pStrm, offMSG, SHORT); + CHKiRet(obj.EndSerialize(pStrm)); finalize_it: @@ -1153,14 +1161,16 @@ int getMSGLen(msg_t *pM) char *getMSG(msg_t *pM) { + char *ret; if(pM == NULL) - return ""; + ret = ""; else { if(pM->offMSG == -1) - return ""; + ret = ""; else - return (char*)(pM->pszRawMsg + pM->offMSG); + ret = (char*)(pM->pszRawMsg + pM->offMSG); } + return ret; } @@ -2283,6 +2293,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, return "**INVALID PROPERTY NAME**"; } + /* If we did not receive a template pointer, we are already done... */ if(pTpe == NULL) { return pRes; @@ -2921,7 +2932,7 @@ rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp) } else if(isProp("msgFlags")) { pThis->msgFlags = pProp->val.num; } else if(isProp("offMSG")) { - pThis->offMSG = pProp->val.num; + MsgSetMSGoffs(pThis, pProp->val.num); } else if(isProp("pszRawMsg")) { MsgSetRawMsg(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr), cstrLen(pProp->val.pStr)); /* enable this, if someone actually uses UxTradMsg, delete after some time has diff --git a/runtime/queue.c b/runtime/queue.c index 7438fbaa..2568717b 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -1703,11 +1703,11 @@ DequeueConsumable(qqueue_t *pThis, wti_t *pWti, int iCancelStateSave) * now that we dequeue batches of pointers, this is much less an issue... * rgerhards, 2009-04-22 */ - if(iQueueSize < pThis->iFullDlyMrk) { + if(iQueueSize < pThis->iFullDlyMrk / 2) { pthread_cond_broadcast(&pThis->belowFullDlyWtrMrk); } - if(iQueueSize < pThis->iLightDlyMrk) { + if(iQueueSize < pThis->iLightDlyMrk / 2) { pthread_cond_broadcast(&pThis->belowLightDlyWtrMrk); } |