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(-) 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