Browse Source

ckdb - limit reload queue and fix reload lost ∞ loop

master
kanoi 10 years ago
parent
commit
6832433eeb
  1. 16
      src/ckdb.c
  2. 2
      src/ckdb.h

16
src/ckdb.c

@ -4145,6 +4145,21 @@ static void *socketer(__maybe_unused void *arg)
workqueue->code = (char *)__func__; workqueue->code = (char *)__func__;
workqueue->inet = inet_default; workqueue->inet = inet_default;
k_add_tail(workqueue_store, wq_item); k_add_tail(workqueue_store, wq_item);
/* Stop the reload queue from growing too big
* Use a size that should be big enough */
if (reloading && workqueue_store->count > 250000) {
K_ITEM *wq2_item = k_unlink_head(workqueue_store);
K_WUNLOCK(workqueue_free);
WORKQUEUE *wq;
DATA_WORKQUEUE(wq, wq2_item);
K_ITEM *ml_item = wq->msgline_item;
free_msgline_data(ml_item, true, false);
K_WLOCK(msgline_free);
k_add_head(msgline_free, ml_item);
K_WUNLOCK(msgline_free);
K_WLOCK(workqueue_free);
k_add_head(workqueue_free, wq2_item);
}
K_WUNLOCK(workqueue_free); K_WUNLOCK(workqueue_free);
ml_item = NULL; ml_item = NULL;
mutex_lock(&wq_waitlock); mutex_lock(&wq_waitlock);
@ -4744,6 +4759,7 @@ static void *listener(void *arg)
seqdata++; seqdata++;
} }
} }
ss_item = ss_item->next;
} }
} }
seqdata_reload_lost = false; seqdata_reload_lost = false;

2
src/ckdb.h

@ -55,7 +55,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.0" #define DB_VERSION "1.0.0"
#define CKDB_VERSION DB_VERSION"-1.104" #define CKDB_VERSION DB_VERSION"-1.105"
#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