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

Fix a bug in backend health state change timestamps.

When admin commands control health, we report the timestamp of that
override operation.

When probing controls health, we report the timestamp of last
probing state change.

Otherwise, we report the timestamp of last admin health command.
parent b301c17c
......@@ -688,17 +688,6 @@ VRT_delete_backend(VRT_CTX, VCL_BACKEND *dp)
// this is why we don't bust the director's magic number.
}
void
VBE_SetHappy(const struct backend *be, uint64_t happy)
{
CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC);
Lck_Lock(&backends_mtx);
if (be->vsc != NULL)
be->vsc->happy = happy;
Lck_Unlock(&backends_mtx);
}
/*---------------------------------------------------------------------*/
void
......
......@@ -79,9 +79,6 @@ struct backend {
* Prototypes
*/
/* cache_backend_cfg.c */
void VBE_SetHappy(const struct backend *, uint64_t);
/* cache_backend_probe.c */
void VBP_Update_Backend(struct vbp_target *vt);
void VBP_Insert(struct backend *b, struct vrt_backend_probe const *p,
......
......@@ -54,6 +54,8 @@
#include "cache_backend.h"
#include "cache_conn_pool.h"
#include "VSC_vbe.h"
/* Default averaging rate, we want something pretty responsive */
#define AVG_RATE 4
......@@ -153,7 +155,6 @@ vbp_has_poked(struct vbp_target *vt)
void
VBP_Update_Backend(struct vbp_target *vt)
{
const struct director *dir;
unsigned i = 0, chg;
char bits[10];
......@@ -171,12 +172,6 @@ VBP_Update_Backend(struct vbp_target *vt)
return;
}
dir = vt->backend->director;
if (dir == NULL) {
Lck_Unlock(&vbp_mtx);
return;
}
i = (vt->good < vt->threshold);
chg = (i != vt->backend->sick);
vt->backend->sick = i;
......@@ -187,12 +182,9 @@ VBP_Update_Backend(struct vbp_target *vt)
i ? "sick" : "healthy", bits,
vt->good, vt->threshold, vt->window,
vt->last, vt->avg, vt->resp_buf);
VBE_SetHappy(vt->backend, vt->happy);
if (chg) {
vt->backend->vsc->happy = vt->happy;
if (chg)
vt->backend->changed = VTIM_real();
VRT_SetChanged(dir, vt->backend->changed);
}
Lck_Unlock(&vbp_mtx);
}
......
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