Commit 33a3d782 authored by Geoff Simmons's avatar Geoff Simmons

mempool init/fini on the warm/cold events for the first/last instance.

parent 871da25b
......@@ -35,6 +35,20 @@ varnish v1 -expect MEMPOOL.pesi.pool > 0
varnish v1 -expect MEMPOOL.pesi.sz_wanted > 0
varnish v1 -expect MEMPOOL.pesi.sz_actual > 0
varnish v1 -cli "vcl.state vcl2 cold"
varnish v1 -vsc MEMPOOL.pesi.*
varnish v1 -expect MEMPOOL.pesi.pool > 0
varnish v1 -expect MEMPOOL.pesi.sz_wanted > 0
varnish v1 -expect MEMPOOL.pesi.sz_actual > 0
varnish v1 -cli "vcl.state vcl2 warm"
varnish v1 -vsc MEMPOOL.pesi.*
varnish v1 -expect MEMPOOL.pesi.pool > 0
varnish v1 -expect MEMPOOL.pesi.sz_wanted > 0
varnish v1 -expect MEMPOOL.pesi.sz_actual > 0
varnish v1 -cli "vcl.show vcl1"
varnish v1 -cli "vcl.use vcl2"
varnish v1 -cli "vcl.discard vcl1"
......
......@@ -285,7 +285,7 @@ fini_data(struct req *req, struct node *node);
/* shared object globals */
static unsigned loadcnt = 0;
static unsigned loadcnt = 0, warmcnt = 0;
static struct VSC_lck *lck_bytes_tree, *lck_pesi_tree;
static struct vsc_seg *vsc_seg = NULL;
static struct mempool *mempool = NULL;
......@@ -2625,27 +2625,36 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
"pesi.pesi_tree");
AN(lck_bytes_tree);
AN(lck_pesi_tree);
AZ(mempool);
mempool = mpl_init();
AN(mempool);
}
VRT_AddVDP(ctx, &VDP_pesi);
return (0);
break;
case VCL_EVENT_DISCARD:
VRT_RemoveVDP(ctx, &VDP_pesi);
AN(loadcnt);
if (--loadcnt == 0) {
if (--loadcnt == 0)
Lck_DestroyClass(&vsc_seg);
break;
case VCL_EVENT_WARM:
if (warmcnt++ == 0) {
AZ(mempool);
mempool = mpl_init();
AN(mempool);
}
break;
case VCL_EVENT_COLD:
AN(warmcnt);
if (--warmcnt == 0) {
AN(mempool);
mpl_fini(&mempool);
AZ(mempool);
}
return (0);
break;
default:
return (0);
WRONG("Illegal event enum");
}
return (0);
}
/* Functions */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment