[master] e1535c8 gc beresp.storage_hint

Nils Goroll nils.goroll at uplex.de
Tue Nov 28 12:11:10 UTC 2017


commit e1535c8d14aa9b7a796b426101780e7237e8ab97
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Nov 28 08:47:15 2017 +0100

    gc beresp.storage_hint
    
    it was deprecated since varnish 5.1.
    
    motivated by the bereq.retries cleanup, see #2405

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 14ba352..4b27caf 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -443,7 +443,6 @@ struct busyobj {
 	/* Acct */
 	struct acct_bereq	acct;
 
-	const char		*storage_hint;
 	const struct stevedore	*storage;
 	const struct director	*director_req;
 	const struct director	*director_resp;
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 2ad7854..cf3389a 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -63,7 +63,6 @@ vbf_allocobj(struct busyobj *bo, unsigned l)
 		stv = bo->storage;
 
 	bo->storage = NULL;
-	bo->storage_hint = NULL;
 
 	if (stv == NULL)
 		return (0);
@@ -175,7 +174,6 @@ vbf_stp_mkbereq(struct worker *wrk, struct busyobj *bo)
 
 	assert(bo->fetch_objcore->boc->state == BOS_INVALID);
 	AZ(bo->storage);
-	AZ(bo->storage_hint);
 
 	HTTP_Setup(bo->bereq0, bo->ws, bo->vsl, SLT_BereqMethod);
 	http_FilterReq(bo->bereq0, bo->req->http,
@@ -238,7 +236,6 @@ vbf_stp_retry(struct worker *wrk, struct busyobj *bo)
 
 	/* reset other bo attributes - See VBO_GetBusyObj */
 	bo->storage = NULL;
-	bo->storage_hint = NULL;
 	bo->do_esi = 0;
 	bo->do_stream = 1;
 
@@ -264,7 +261,6 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 
 	AZ(bo->storage);
-	AZ(bo->storage_hint);
 
 	bo->storage = STV_next();
 
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 0f1d018..01e5997 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -330,42 +330,6 @@ VRT_r_beresp_backend_ip(VRT_CTX)
 
 /*--------------------------------------------------------------------*/
 
-const char *
-VRT_r_beresp_storage_hint(VRT_CTX)
-{
-	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
-	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
-	if (ctx->bo->storage_hint != NULL)
-		return (ctx->bo->storage_hint);
-	else
-		return (NULL);
-}
-
-void
-VRT_l_beresp_storage_hint(VRT_CTX, const char *str, ...)
-{
-	const struct stevedore *stv;
-	va_list ap;
-	const char *b;
-
-	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
-	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
-	va_start(ap, str);
-	b = VRT_String(ctx->bo->ws, NULL, str, ap);	// XXX: ctx->ws ?
-	va_end(ap);
-	if (b == NULL) {
-		VSLb(ctx->vsl, SLT_LostHeader, "storage_hint");
-		WS_MarkOverflow(ctx->bo->beresp->ws);
-		return;
-	}
-	ctx->bo->storage_hint = b;
-	stv = STV_find(b);
-	if (stv != NULL)
-		ctx->bo->storage = stv;
-}
-
-/*--------------------------------------------------------------------*/
-
 VCL_STEVEDORE
 VRT_r_req_storage(VRT_CTX)
 {
diff --git a/bin/varnishtest/tests/c00078.vtc b/bin/varnishtest/tests/c00078.vtc
index b1fcc60..d5464ef 100644
--- a/bin/varnishtest/tests/c00078.vtc
+++ b/bin/varnishtest/tests/c00078.vtc
@@ -1,4 +1,4 @@
-varnishtest "Stevedores RR, beresp.storage and beresp.storage_hint"
+varnishtest "Stevedores RR, beresp.storage"
 
 server s1 -repeat 6 {
 	rxreq
@@ -12,10 +12,8 @@ varnish v1 \
     -vcl+backend {
 	import vtc;
 	sub vcl_backend_response {
-		if (bereq.url == "/1") {
-			set beresp.storage_hint = "invalid";
-		} else if (bereq.url == "/2") {
-			set beresp.storage_hint = "s1";
+		if (bereq.url == "/2") {
+			set beresp.storage = storage.s1;
 		} else if (bereq.url == "/6") {
 			set beresp.storage = vtc.no_stevedore();
 		}
diff --git a/bin/varnishtest/tests/v00025.vtc b/bin/varnishtest/tests/v00025.vtc
index 8e96582..aadaa83 100644
--- a/bin/varnishtest/tests/v00025.vtc
+++ b/bin/varnishtest/tests/v00025.vtc
@@ -43,7 +43,6 @@ varnish v1 -arg "-i J.F.Nobody" -vcl+backend {
 		set beresp.http.beresp_backend = beresp.backend;
 		set beresp.http.keep = beresp.keep;
 		set beresp.http.stv = beresp.storage;
-		set beresp.http.hint = beresp.storage_hint;
 		set beresp.http.be_ip = beresp.backend.ip;
 		set beresp.http.be_nm = beresp.backend.name;
 		set beresp.http.unc = bereq.uncacheable;
diff --git a/doc/changes.rst b/doc/changes.rst
index 0e70047..fe09dea 100644
--- a/doc/changes.rst
+++ b/doc/changes.rst
@@ -41,6 +41,8 @@ VCL
   ``req.hash_always_miss`` are now accessible from all of the client
   side subs, not just ``vcl_recv{}``
 
+* Removed ``beresp.storage_hint`` (was deprecated since Varnish 5.1)
+
 C APIs (for vmod and utility authors)
 -------------------------------------
 
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index 524e4b3..3b4972b 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -670,15 +670,6 @@ sp_variables = [
 		The storage backend to use to save this object.
 		"""
 	),
-	('beresp.storage_hint',
-		'STRING',
-		('backend_response', 'backend_error'),
-		('backend_response', 'backend_error'), """
-		Deprecated. Hint to Varnish that you want to
-		save this object to a particular storage backend.
-		Use beresp.storage instead.
-		"""
-	),
 	('obj.proto',
 		'STRING',
 		('hit',),


More information about the varnish-commit mailing list