[master] cbdfa1a Only update VSM segments which actually _have_ changed
Nils Goroll
nils.goroll at uplex.de
Mon Nov 6 21:14:09 UTC 2017
commit cbdfa1aaddfa05e0db290c93436ec2a204f07d3b
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon Nov 6 21:56:27 2017 +0100
Only update VSM segments which actually _have_ changed
a vav[0] is the error or NULL if ok. vsm_cmp_av considers NULL the end
of the av, so we would always comare vg and the av equal and begin insertion
of new vgs. This would lead to all vsm segments be removed and newly added.
Fixes #2470
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 2b8c7e6..d623538 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -447,6 +447,10 @@ vsm_refresh_set2(struct vsm *vd, struct vsm_set *vs, struct vsb *vsb)
VTAILQ_FOREACH(vg, &vs->segs, list)
vg->markscan = 0;
+ /*
+ * Efficient comparison walking the two lists side-by-side is ok because
+ * segment inserts always happen at the tail (VSMW_Allocv)
+ */
vg = VTAILQ_FIRST(&vs->segs);
while (p != NULL && *p != '\0') {
e = strchr(p, '\n');
@@ -463,7 +467,7 @@ vsm_refresh_set2(struct vsm *vd, struct vsm_set *vs, struct vsb *vsb)
VAV_Free(av);
break;
}
- while (vg != NULL && !vsm_cmp_av(vg->av, av))
+ while (vg != NULL && !vsm_cmp_av(&vg->av[1], &av[1]))
vg = VTAILQ_NEXT(vg, list);
if (vg != NULL) {
More information about the varnish-commit
mailing list