Browse Source

ckdb - delay queue complete until pool0+pool first hits zero - as it did before

master
kanoi 9 years ago
parent
commit
2fb9e95676
  1. 14
      src/ckdb.c
  2. 2
      src/ckdb.h

14
src/ckdb.c

@ -5455,8 +5455,8 @@ static bool reload_from(tv_t *start)
ck_wlock(&fpm_lock); ck_wlock(&fpm_lock);
if (first_pool_message) { if (first_pool_message) {
LOGERR("%s() reload didn't find the first ckpool queue '%.32s...", LOGEMERG("%s() reload didn't find the first ckpool queue '%.32s...",
__func__, st = safe_text(first_pool_message)); __func__, st = safe_text(first_pool_message));
FREENULL(st); FREENULL(st);
FREENULL(first_pool_message); FREENULL(first_pool_message);
} }
@ -5646,6 +5646,8 @@ static void *listener(void *arg)
/* Process queued work - ensure pool0 is emptied first, /* Process queued work - ensure pool0 is emptied first,
* even if there is pending pool0 data being processed by breaker() */ * even if there is pending pool0 data being processed by breaker() */
pool0 = true; pool0 = true;
// Override checking until pool0 is complete
wqcount = -1;
while (!everyone_die) { while (!everyone_die) {
wq_item = NULL; wq_item = NULL;
K_WLOCK(workqueue_free); K_WLOCK(workqueue_free);
@ -5658,11 +5660,13 @@ static void *listener(void *arg)
earlysock_left--; earlysock_left--;
} }
} }
if (!pool0) if (!pool0) {
wq_item = k_unlink_head(pool_workqueue_store); wq_item = k_unlink_head(pool_workqueue_store);
wqcount = pool_workqueue_store->count;
}
K_WUNLOCK(workqueue_free); K_WUNLOCK(workqueue_free);
if (!pool0 && wq_stt.tv_sec != 0L) if (wqcount == 0 && wq_stt.tv_sec != 0L)
setnow(&wq_fin); setnow(&wq_fin);
/* Don't keep a connection for more than ~10s or ~10000 items /* Don't keep a connection for more than ~10s or ~10000 items
@ -5680,7 +5684,7 @@ static void *listener(void *arg)
tick(); tick();
} }
if (!pool0 && wq_stt.tv_sec != 0L) { if (wqcount == 0 && wq_stt.tv_sec != 0L) {
sec = tvdiff(&wq_fin, &wq_stt); sec = tvdiff(&wq_fin, &wq_stt);
min = floor(sec / 60.0); min = floor(sec / 60.0);
sec -= min * 60.0; sec -= min * 60.0;

2
src/ckdb.h

@ -51,7 +51,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.5" #define DB_VERSION "1.0.5"
#define CKDB_VERSION DB_VERSION"-2.008" #define CKDB_VERSION DB_VERSION"-2.009"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__

Loading…
Cancel
Save