From 745bb66251a12747f89c45ff0e8095443f34b129 Mon Sep 17 00:00:00 2001 From: yifan hao Date: Tue, 5 May 2020 00:02:56 -0600 Subject: [PATCH] Only increment wWorkerPool.nextId when wWorkerPool.nextId is launched Only increment wWorkerPool.nextId when wWorkerPool.nextId is launched --- src/dnode/src/dnodeWrite.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dnode/src/dnodeWrite.c b/src/dnode/src/dnodeWrite.c index 1e877108ca..c02ca950a7 100644 --- a/src/dnode/src/dnodeWrite.c +++ b/src/dnode/src/dnodeWrite.c @@ -132,8 +132,6 @@ void *dnodeAllocateWqueue(void *pVnode) { taosCloseQueue(queue); return NULL; } - wWorkerPool.nextId = (wWorkerPool.nextId + 1) % wWorkerPool.max; - pthread_attr_t thAttr; pthread_attr_init(&thAttr); pthread_attr_setdetachstate(&thAttr, PTHREAD_CREATE_JOINABLE); @@ -146,6 +144,7 @@ void *dnodeAllocateWqueue(void *pVnode) { queue = NULL; } else { dTrace("write worker:%d is launched", pWorker->workerId); + wWorkerPool.nextId = (wWorkerPool.nextId + 1) % wWorkerPool.max; } pthread_attr_destroy(&thAttr); -- GitLab