Commit ad8e8f8e authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Do not update mgt's mirrored VCL temp state on child temp state failures

The child expects mgt to be consistent in its VCL state changes,
e.g. not ask the child to 'use' a VCL that isn't warm. Not doing so
will cause the child to assert (see asserts in
cache_vcl.c:ccf_config_use). This could trigger because the mgt
erranously would set its recorded temp regardless of the child's reply
in mgt_vcl_setstate.

This patch changes it to only record the new temp in mgt if the child
replied success. If the child isn't running the new temp is always
recorded.

Slightly update v00044.vtc test case to reflect the need to update the
state before restarting the child.
parent 6cb0c666
......@@ -399,16 +399,15 @@ mgt_vcl_setstate(struct cli *cli, struct vclprog *vp, const char *vs)
if (vp->warm == warm)
return (0);
vp->warm = warm;
if (vp->warm == 0)
vp->go_cold = 0;
if (!MCH_Running())
if (!MCH_Running()) {
vp->warm = warm;
if (vp->warm == 0)
vp->go_cold = 0;
return (0);
}
i = mgt_cli_askchild(&status, &p, "vcl.state %s %d%s\n",
vp->name, vp->warm, vp->state);
vp->name, warm, vp->state);
if (i && cli != NULL) {
VCLI_SetResult(cli, status);
VCLI_Out(cli, "%s", p);
......@@ -416,8 +415,15 @@ mgt_vcl_setstate(struct cli *cli, struct vclprog *vp, const char *vs)
MGT_Complain(C_ERR,
"Please file ticket: VCL poker problem: "
"'vcl.state %s %d%s' -> %03d '%s'",
vp->name, vp->warm, vp->state, i, p);
vp->name, warm, vp->state, i, p);
} else {
/* Success, update mgt's VCL state to reflect child's
state */
vp->warm = warm;
if (vp->warm == 0)
vp->go_cold = 0;
}
free(p);
return (i);
}
......
......@@ -90,4 +90,5 @@ varnish v1 -clierr 300 "vcl.state vcl1 warm"
# A warm-up failure can also fail a child start
varnish v1 -cliok stop
varnish v1 -cliok "vcl.state vcl1 warm"
varnish v1 -clierr 300 start
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