From 4f88aa20b4e5ace523a2fb4b5f221d9e70e26d13 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 6 Nov 2013 19:06:27 +0100 Subject: do not complain for queue size on DA queues --- runtime/queue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/queue.c') diff --git a/runtime/queue.c b/runtime/queue.c index 30269152..7ad2b849 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -2106,7 +2106,8 @@ qqueueStart(qqueue_t *pThis) /* this is the ConstructionFinalizer */ break; } - if(pThis->iMaxQueueSize < 100) { + if(pThis->iMaxQueueSize < 100 + && (pThis->qType == QUEUETYPE_LINKEDLIST || pThis->qType == QUEUETYPE_FIXED_ARRAY)) { errmsg.LogError(0, RS_RET_OK_WARN, "Note: queue.size=\"%d\" is very " "low and can lead to unpredictable results. See also " "http://www.rsyslog.com/lower-bound-for-queue-sizes/", -- cgit v1.2.3 From 3f258be41684ff149e24adc3a3f80a47820614fa Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 7 Nov 2013 08:57:16 +0100 Subject: do not adjust batch size for disk queues --- runtime/queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/queue.c') diff --git a/runtime/queue.c b/runtime/queue.c index 7ad2b849..30516876 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -2123,7 +2123,7 @@ qqueueStart(qqueue_t *pThis) /* this is the ConstructionFinalizer */ if(pThis->iLightDlyMrk == -1 || pThis->iLightDlyMrk > pThis->iMaxQueueSize) pThis->iLightDlyMrk = pThis->iMaxQueueSize - (pThis->iMaxQueueSize / 100) * 30; /* default 70% */ - if(pThis->iDeqBatchSize > pThis->iMaxQueueSize) + if(pThis->iMaxQueueSize > 0 && pThis->iDeqBatchSize > pThis->iMaxQueueSize) pThis->iDeqBatchSize = pThis->iMaxQueueSize; /* finalize some initializations that could not yet be done because it is -- cgit v1.2.3 From 248e6bf819312e6ab43df0e46269080a8518a2f9 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 7 Nov 2013 12:25:46 +0100 Subject: cleanup no longer needed code --- runtime/queue.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'runtime/queue.c') diff --git a/runtime/queue.c b/runtime/queue.c index 30516876..ec9470c7 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -484,7 +484,6 @@ InitDA(qqueue_t *pThis, int bLockMutex) CHKiRet(wtpSetpfDoWork (pThis->pWtpDA, (rsRetVal (*)(void *pUsr, void *pWti)) ConsumerDA)); CHKiRet(wtpSetpfObjProcessed (pThis->pWtpDA, (rsRetVal (*)(void *pUsr, wti_t *pWti)) batchProcessed)); CHKiRet(wtpSetpmutUsr (pThis->pWtpDA, pThis->mut)); - CHKiRet(wtpSetpcondBusy (pThis->pWtpDA, &pThis->notEmpty)); CHKiRet(wtpSetiNumWorkerThreads (pThis->pWtpDA, 1)); CHKiRet(wtpSettoWrkShutdown (pThis->pWtpDA, pThis->toWrkShutdown)); CHKiRet(wtpSetpUsr (pThis->pWtpDA, pThis)); @@ -2140,7 +2139,6 @@ qqueueStart(qqueue_t *pThis) /* this is the ConstructionFinalizer */ pthread_mutex_init(&pThis->mutThrdMgmt, NULL); pthread_cond_init (&pThis->notFull, NULL); - pthread_cond_init (&pThis->notEmpty, NULL); pthread_cond_init (&pThis->belowFullDlyWtrMrk, NULL); pthread_cond_init (&pThis->belowLightDlyWtrMrk, NULL); @@ -2181,7 +2179,6 @@ qqueueStart(qqueue_t *pThis) /* this is the ConstructionFinalizer */ CHKiRet(wtpSetpfDoWork (pThis->pWtpReg, (rsRetVal (*)(void *pUsr, void *pWti)) ConsumerReg)); CHKiRet(wtpSetpfObjProcessed (pThis->pWtpReg, (rsRetVal (*)(void *pUsr, wti_t *pWti)) batchProcessed)); CHKiRet(wtpSetpmutUsr (pThis->pWtpReg, pThis->mut)); - CHKiRet(wtpSetpcondBusy (pThis->pWtpReg, &pThis->notEmpty)); CHKiRet(wtpSetiNumWorkerThreads (pThis->pWtpReg, pThis->iNumWorkerThreads)); CHKiRet(wtpSettoWrkShutdown (pThis->pWtpReg, pThis->toWrkShutdown)); CHKiRet(wtpSetpUsr (pThis->pWtpReg, pThis)); @@ -2446,7 +2443,6 @@ CODESTARTobjDestruct(qqueue) } pthread_mutex_destroy(&pThis->mutThrdMgmt); pthread_cond_destroy(&pThis->notFull); - pthread_cond_destroy(&pThis->notEmpty); pthread_cond_destroy(&pThis->belowFullDlyWtrMrk); pthread_cond_destroy(&pThis->belowLightDlyWtrMrk); -- cgit v1.2.3 From ded6957225ae23f096dfa842caf28c0f34e9512c Mon Sep 17 00:00:00 2001 From: Pavel Levshin Date: Thu, 7 Nov 2013 12:42:37 +0100 Subject: bugfix: regular workers are no longer started if DA worker is active form mail: Look, below, if it is time to activate DA worker, we call it explicitly. But in this case we do not advise regular workers. They are likely already running at this point, but it is not guaranteed. What if, for example, the system is set to start additional workers when the queue is going over high watermark? What if HighWatermark is set to 1? Regular workers will not be started, and DA worker may fail. Thus, it is reasonable to advise regular workers even if we are going DA. --- runtime/queue.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'runtime/queue.c') diff --git a/runtime/queue.c b/runtime/queue.c index ec9470c7..e0d60249 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -351,16 +351,15 @@ qqueueAdviseMaxWorkers(qqueue_t *pThis) if(pThis->bIsDA && getLogicalQueueSize(pThis) >= pThis->iHighWtrMrk) { DBGOPRINT((obj_t*) pThis, "(re)activating DA worker\n"); wtpAdviseMaxWorkers(pThis->pWtpDA, 1); /* disk queues have always one worker */ + } + if(getLogicalQueueSize(pThis) == 0) { + iMaxWorkers = 0; + } else if(pThis->qType == QUEUETYPE_DISK || pThis->iMinMsgsPerWrkr == 0) { + iMaxWorkers = 1; } else { - if(getLogicalQueueSize(pThis) == 0) { - iMaxWorkers = 0; - } else if(pThis->qType == QUEUETYPE_DISK || pThis->iMinMsgsPerWrkr == 0) { - iMaxWorkers = 1; - } else { - iMaxWorkers = getLogicalQueueSize(pThis) / pThis->iMinMsgsPerWrkr + 1; - } - wtpAdviseMaxWorkers(pThis->pWtpReg, iMaxWorkers); + iMaxWorkers = getLogicalQueueSize(pThis) / pThis->iMinMsgsPerWrkr + 1; } + wtpAdviseMaxWorkers(pThis->pWtpReg, iMaxWorkers); } RETiRet; -- cgit v1.2.3