[6.0] 3c338fcb3 Properly count vsm segments and rebuild _.index when retired segments dominate the _.index file.

Martin Blix Grydeland martin at varnish-software.com
Fri Oct 18 13:23:06 UTC 2019


commit 3c338fcb35e37c9d0875600f5a6615853cc6c8e8
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 a98cfeae9..0439084df 100644
--- a/bin/varnishd/common/common_vsmw.c
+++ b/bin/varnishd/common/common_vsmw.c
@@ -206,7 +206,6 @@ vsmw_append_record(struct vsmw *vsmw, struct vsmwseg *seg, char act)
 	s = write(fd, VSB_data(vsmw->vsb), VSB_len(vsmw->vsb));
 	assert(s == VSB_len(vsmw->vsb)); // XXX handle ENOSPC? #2764
 	AZ(close(fd));
-	vsmw->nsegs++;
 }
 
 /*--------------------------------------------------------------------*/
@@ -238,7 +237,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