[master] 925a949eb Properly count vsm segments and rebuild _.index when retired segments dominate the _.index file.

Poul-Henning Kamp phk at FreeBSD.org
Mon Aug 5 10:37:09 UTC 2019


commit 925a949ebcc85f28ce8605b040936d972c6f3e7a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 5 10:25:36 2019 +0000

    Properly count vsm segments and rebuild _.index when retired
    segments dominate the _.index file.

diff --git a/bin/varnishd/common/common_vsmw.c b/bin/varnishd/common/common_vsmw.c
index c37b0d22e..feb94cff9 100644
--- a/bin/varnishd/common/common_vsmw.c
+++ b/bin/varnishd/common/common_vsmw.c
@@ -204,7 +204,6 @@ vsmw_append_record(struct vsmw *vsmw, struct vsmwseg *seg, char act)
 	AZ(VSB_finish(vsmw->vsb));
 	XXXAZ(VSB_tofile(fd, vsmw->vsb)); // XXX handle ENOSPC? #2764
 	closefd(&fd);
-	vsmw->nsegs++;
 }
 
 /*--------------------------------------------------------------------*/
@@ -235,7 +234,7 @@ vsmw_delseg(struct vsmw *vsmw, struct vsmwseg *seg, int fixidx)
 	VTAILQ_REMOVE(&vsmw->segs, seg, list);
 
 	vsmw->nsegs--;
-	if (vsmw->nsubs < vsmw->nsegs || !fixidx) {
+	if (vsmw->nsubs * 2 < vsmw->nsegs || !fixidx) {
 		vsmw_append_record(vsmw, seg, '-');
 		vsmw->nsubs++;
 	} else {


More information about the varnish-commit mailing list