Commit dbc39e9f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Disable backend probes in cold vcls

parent d4ec606c
......@@ -332,6 +332,10 @@ VRT_event_vbe(VRT_CTX, enum vcl_event_e ev, const struct director *d,
assert(d->priv2 == vrt);
CAST_OBJ_NOTNULL(be, d->priv, BACKEND_MAGIC);
if (be->probe != NULL && ev == VCL_EVENT_WARM)
VBP_Control(be, 0);
if (be->probe != NULL && ev == VCL_EVENT_COLD)
VBP_Control(be, 1);
}
void
......
......@@ -113,6 +113,7 @@ void VBE_DeleteBackend(struct backend *);
void VBP_Insert(struct backend *b, struct vrt_backend_probe const *p,
const char *hosthdr);
void VBP_Remove(struct backend *b);
void VBP_Control(const struct backend *b, int stop);
void VBP_Status(struct cli *cli, const struct backend *, int details);
struct tcp_pool *VBT_Ref(const struct suckaddr *ip4,
......
......@@ -58,6 +58,7 @@ struct vbp_target {
#define VBP_TARGET_MAGIC 0x6b7cb656
struct lock mtx;
int disable;
int stop;
struct backend *backend;
......@@ -259,7 +260,8 @@ vbp_has_poked(struct vbp_target *vt)
vt->backend->vcl_name, logmsg, bits,
vt->good, vt->probe.threshold, vt->probe.window,
vt->last, vt->avg, vt->resp_buf);
vt->backend->vsc->happy = vt->happy;
if (!vt->disable)
vt->backend->vsc->happy = vt->happy;
}
Lck_Unlock(&vt->mtx);
}
......@@ -281,9 +283,11 @@ vbp_wrk_poll_backend(void *priv)
AN(vt->req);
assert(vt->req_len > 0);
vbp_start_poke(vt);
vbp_poke(vt);
vbp_has_poked(vt);
if (!vt->disable) {
vbp_start_poke(vt);
vbp_poke(vt);
vbp_has_poked(vt);
}
if (!vt->stop)
VTIM_sleep(vt->probe.interval);
......@@ -412,6 +416,24 @@ vbp_set_defaults(struct vbp_target *vt)
vt->probe.initial = vt->probe.threshold;
}
/*--------------------------------------------------------------------
*/
void
VBP_Control(const struct backend *be, int stop)
{
struct vbp_target *vt;
ASSERT_CLI();
CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC);
vt = be->probe;
CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC);
Lck_Lock(&vt->mtx);
vt->disable = stop;
Lck_Unlock(&vt->mtx);
}
/*--------------------------------------------------------------------
* Insert/Remove/Use called from cache_backend.c
*/
......
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