[master] 51ec48a Implement incremental freeing of body of private oc's (aka: pass) during streaming delivery.

Poul-Henning Kamp phk at FreeBSD.org
Sat Mar 12 01:29:04 CET 2016


commit 51ec48a93299a22a1ac72812b05c559c8728adf0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sat Mar 12 00:23:49 2016 +0000

    Implement incremental freeing of body of private oc's (aka: pass)
    during streaming delivery.
    
    This will only happen if the object fills multiple storage segments,
    ie: if backend sends using chunked encoding or if the object is
    multiple times larger than ${fetch_maxchunksize}.

diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c
index c0f8c09..39d2bac 100644
--- a/bin/varnishd/storage/storage_simple.c
+++ b/bin/varnishd/storage/storage_simple.c
@@ -311,6 +311,11 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
 			sl += st->len;
 			st = VTAILQ_NEXT(st, list);
 			if (VTAILQ_NEXT(st, list) != NULL) {
+				if (final && checkpoint != NULL) {
+					VTAILQ_REMOVE(&obj->list,
+					    checkpoint, list);
+					sml_stv_free(stv, checkpoint);
+				}
 				checkpoint = st;
 				checkpoint_len = sl;
 			}
@@ -322,7 +327,7 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
 			st = NULL;
 		Lck_Unlock(&boc->mtx);
 		assert(l > 0 || boc->state == BOS_FINISHED);
-		if (func(priv, st != NULL ? 0 : 1, p, l)) {
+		if (func(priv, st != NULL ? final : 1, p, l)) {
 			ret = -1;
 			break;
 		}



More information about the varnish-commit mailing list