[master] e7d5afe Allocate a unique "vxid" to all sessions, requests and backend requests (busyobj).

Poul-Henning Kamp phk at varnish-cache.org
Mon Aug 13 11:30:49 CEST 2012


commit e7d5afec68f4a62ca8037d928c6298fca7691287
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 13 09:27:41 2012 +0000

    Allocate a unique "vxid" to all sessions, requests and backend requests
    (busyobj).
    
    This replaces the current "VID" as visible in the X-Varnish header.
    
    The new "stolen numbers" causes a lot of testcases to need updates,
    most trivial, but a few needed more extensive work to be predictable
    under the new circumstances.
    
    Next step is to carry this change through in VSL, and link all
    the VXID's to each other.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 71bba01..35c2b52 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -543,7 +543,7 @@ VTAILQ_HEAD(storagehead, storage);
 struct object {
 	unsigned		magic;
 #define OBJECT_MAGIC		0x32851d42
-	unsigned		xid;
+	uint32_t		vxid;
 	struct storage		*objstore;
 	struct objcore		*objcore;
 
@@ -584,7 +584,6 @@ struct req {
 #define REQ_MAGIC		0x2751aaa1
 
 	uint32_t		vxid;
-	unsigned		xid;
 	int			restarts;
 	int			esi_level;
 	int			disable_esi;
@@ -769,7 +768,6 @@ void HTTP1_Session(struct worker *, struct req *);
 
 /* cache_req_fsm.c [CNT] */
 int CNT_Request(struct worker *, struct req *);
-void CNT_Init(void);
 
 /* cache_cli.c [CLI] */
 void CLI_Init(void);
@@ -1054,7 +1052,7 @@ char *WS_Alloc(struct ws *ws, unsigned bytes);
 char *WS_Snapshot(struct ws *ws);
 
 /* rfc2616.c */
-void RFC2616_Ttl(struct busyobj *, unsigned xid);
+void RFC2616_Ttl(struct busyobj *);
 enum body_status RFC2616_Body(struct busyobj *, struct dstat *);
 unsigned RFC2616_Req_Gzip(const struct http *);
 int RFC2616_Do_Cond(const struct req *sp);
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 4164e4b..c949acc 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -758,7 +758,7 @@ ban_check_object(struct object *o, struct vsl_log *vsl,
 		oc_updatemeta(oc);
 		/* BAN also changed, but that is not important any more */
 		/* XXX: no req in lurker */
-		VSLb(vsl, SLT_ExpBan, "%u was banned", o->xid);
+		VSLb(vsl, SLT_ExpBan, "%u was banned", o->vxid);
 		EXP_Rearm(o);
 		return (1);
 	}
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index eb5998a..3b9ae2e 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -852,7 +852,7 @@ http_FilterReq(const struct req *req, unsigned how)
 	else
 		http_linkh(hp, req->http, HTTP_HDR_PROTO);
 	http_filterfields(hp, req->http, how);
-	http_PrintfHeader(hp, "X-Varnish: %u", req->xid);
+	http_PrintfHeader(hp, "X-Varnish: %u", req->vxid);
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c
index 31e0a46..d181d11 100644
--- a/bin/varnishd/cache/cache_http1_fsm.c
+++ b/bin/varnishd/cache/cache_http1_fsm.c
@@ -101,7 +101,6 @@ http1_wait(struct sess *sp, struct worker *wrk, struct req *req)
 	AZ(req->vcl);
 	AZ(req->obj);
 	AZ(req->esi_level);
-	assert(req->xid == 0);
 	assert(isnan(req->t_req));
 	assert(isnan(req->t_resp));
 
@@ -196,9 +195,6 @@ http1_cleanup(struct sess *sp, struct worker *wrk, struct req *req)
 	}
 
 	sp->t_idle = W_TIM_real(wrk);
-	if (req->xid == 0)
-		req->t_resp = sp->t_idle;
-	req->xid = 0;
 	VSL_Flush(req->vsl, 0);
 
 	req->t_req = NAN;
@@ -225,7 +221,6 @@ http1_cleanup(struct sess *sp, struct worker *wrk, struct req *req)
 
 	WS_Reset(req->ws, NULL);
 	WS_Reset(wrk->aws, NULL);
-	req->vxid = VXID_Get(&wrk->vxid_pool);
 
 	if (HTC_Reinit(req->htc) == HTC_COMPLETE) {
 		req->t_req = sp->t_idle;
@@ -341,6 +336,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 			if (done == 2)
 				return;
 			assert(done == 1);
+			assert(req->vxid == 0);
 			sdr = http1_cleanup(sp, wrk, req);
 			switch (sdr) {
 			case SESS_DONE_RET_GONE:
diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index c48a3d9..37aea3a 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -35,6 +35,8 @@
 #include "cache.h"
 #include "common/heritage.h"
 
+#include "vcli_priv.h"
+
 #include "waiter/waiter.h"
 #include "hash/hash_slinger.h"
 
@@ -93,6 +95,7 @@ THR_GetName(void)
  */
 
 static uint32_t vxid_base;
+static uint32_t vxid_chunk = 32768;
 static struct lock vxid_lock;
 
 uint32_t
@@ -102,8 +105,8 @@ VXID_Get(struct vxid_pool *v)
 		if (v->count == 0) {
 			Lck_Lock(&vxid_lock);
 			v->next = vxid_base;
-			v->count = 32768;
-			vxid_base = v->count;
+			v->count = vxid_chunk;
+			vxid_base += v->count;
 			Lck_Unlock(&vxid_lock);
 		}
 		v->count--;
@@ -113,6 +116,52 @@ VXID_Get(struct vxid_pool *v)
 }
 
 /*--------------------------------------------------------------------
+ * Debugging aids
+ */
+
+/*
+ * Dumb down the VXID allocation to make it predictable for
+ * varnishtest cases
+ */
+static void
+cli_debug_xid(struct cli *cli, const char * const *av, void *priv)
+{
+	(void)priv;
+	if (av[2] != NULL) {
+		vxid_base = strtoul(av[2], NULL, 0);
+		vxid_chunk = 1;
+	}
+	VCLI_Out(cli, "XID is %u", vxid_base);
+}
+
+/*
+ * Default to seed=1, this is the only seed value POSIXl guarantees will
+ * result in a reproducible random number sequence.
+ */
+static void
+cli_debug_srandom(struct cli *cli, const char * const *av, void *priv)
+{
+	(void)priv;
+	unsigned seed = 1;
+
+	if (av[2] != NULL)
+		seed = strtoul(av[2], NULL, 0);
+	srandom(seed);
+	srand48(random());
+	VCLI_Out(cli, "Random(3) seeded with %u", seed);
+}
+
+static struct cli_proto debug_cmds[] = {
+	{ "debug.xid", "debug.xid",
+		"\tExamine or set XID\n", 0, 1, "d", cli_debug_xid },
+	{ "debug.srandom", "debug.srandom",
+		"\tSeed the random(3) function\n", 0, 1, "d",
+		cli_debug_srandom },
+	{ NULL }
+};
+
+
+/*--------------------------------------------------------------------
  * XXX: Think more about which order we start things
  */
 
@@ -142,7 +191,6 @@ child_main(void)
 	CLI_Init();
 	Fetch_Init();
 
-	CNT_Init();
 	VCL_Init();
 
 	HTTP_Init();
@@ -168,6 +216,10 @@ child_main(void)
 
 	BAN_Compile();
 
+	srandomdev();
+	srand48(random());
+	CLI_AddFuncs(debug_cmds);
+
 	/* Wait for persistent storage to load if asked to */
 	if (cache_param->diag_bitmap & 0x00020000)
 		SMP_Ready();
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index ff9a65b..c38da38 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -164,7 +164,7 @@ pan_object(const struct object *o)
 	const struct storage *st;
 
 	VSB_printf(pan_vsp, "  obj = %p {\n", o);
-	VSB_printf(pan_vsp, "    xid = %u,\n", o->xid);
+	VSB_printf(pan_vsp, "    vxid = %u,\n", o->vxid);
 	pan_ws(o->ws_o, 4);
 	pan_http("obj", o->http, 4);
 	VSB_printf(pan_vsp, "    len = %jd,\n", (intmax_t)o->len);
@@ -236,8 +236,8 @@ pan_req(const struct req *req)
 
 	VSB_printf(pan_vsp, "req = %p {\n", req);
 
-	VSB_printf(pan_vsp, "  sp = %p, xid = %u,",
-	    req->sp, req->xid);
+	VSB_printf(pan_vsp, "  sp = %p, vxid = %u,",
+	    req->sp, req->vxid);
 
 	switch (req->req_step) {
 #define REQ_STEP(l, u, arg) case R_STP_##u: stp = "R_STP_" #u; break;
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 0fbca29..6e03e4c 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -62,7 +62,6 @@ DOT acceptor -> start [style=bold,color=green]
 #include "config.h"
 
 #include <math.h>
-#include <poll.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -70,7 +69,6 @@ DOT acceptor -> start [style=bold,color=green]
 
 #include "hash/hash_slinger.h"
 #include "vcl.h"
-#include "vcli_priv.h"
 #include "vsha256.h"
 #include "vtim.h"
 
@@ -78,7 +76,6 @@ DOT acceptor -> start [style=bold,color=green]
 #include "compat/srandomdev.h"
 #endif
 
-static unsigned xids;
 /*--------------------------------------------------------------------
  * We have a refcounted object on the session, and possibly the busyobj
  * which is fetching it, prepare a response.
@@ -289,7 +286,7 @@ cnt_error(struct worker *wrk, struct req *req)
 		return(1);
 	}
 	CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
-	req->obj->xid = req->xid;
+	req->obj->vxid = req->vxid;
 	req->obj->exp.entered = req->t_req;
 
 	h = req->obj->http;
@@ -406,7 +403,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
 		 */
 		EXP_Clr(&bo->exp);
 		bo->exp.entered = W_TIM_real(wrk);
-		RFC2616_Ttl(bo, req->xid);
+		RFC2616_Ttl(bo);
 
 		/* pass from vclrecv{} has negative TTL */
 		if (req->objcore->objhead == NULL)
@@ -629,7 +626,7 @@ cnt_fetchbody(struct worker *wrk, struct req *req)
 		VSB_delete(vary);
 	}
 
-	req->obj->xid = req->xid;
+	req->obj->vxid = req->vxid;
 	req->obj->response = req->err_code;
 	WS_Assert(req->obj->ws_o);
 
@@ -845,7 +842,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
 
 	if (oc->flags & OC_F_PASS) {
 		wrk->stats.cache_hitpass++;
-		VSLb(req->vsl, SLT_HitPass, "%u", req->obj->xid);
+		VSLb(req->vsl, SLT_HitPass, "%u", req->obj->vxid);
 		(void)HSH_Deref(&wrk->stats, NULL, &req->obj);
 		AZ(req->objcore);
 		req->req_step = R_STP_PASS;
@@ -853,7 +850,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
 	}
 
 	wrk->stats.cache_hit++;
-	VSLb(req->vsl, SLT_Hit, "%u", req->obj->xid);
+	VSLb(req->vsl, SLT_Hit, "%u", req->obj->vxid);
 	req->req_step = R_STP_HIT;
 	return (0);
 }
@@ -1106,9 +1103,8 @@ cnt_recv(const struct worker *wrk, struct req *req)
 	AZ(req->busyobj);
 
 	/* Assign XID and log */
-	req->xid = ++xids;				/* XXX not locked */
 	VSLb(req->vsl, SLT_ReqStart, "%s %s %u",
-	    req->sp->addr, req->sp->port, req->xid);
+	    req->sp->addr, req->sp->port, req->vxid);
 
 	if (req->err_code) {
 		req->req_step = R_STP_ERROR;
@@ -1211,6 +1207,9 @@ CNT_Request(struct worker *wrk, struct req *req)
 	    req->req_step == R_STP_LOOKUP ||
 	    req->req_step == R_STP_RECV);
 
+	if (req->req_step == R_STP_RECV)
+		req->vxid = VXID_Get(&wrk->vxid_pool);
+
 	req->wrk = wrk;
 
 	for (done = 0; !done; ) {
@@ -1245,7 +1244,7 @@ CNT_Request(struct worker *wrk, struct req *req)
 			    (uintmax_t)req->req_bodybytes);
 		}
 		VSLb(req->vsl, SLT_ReqEnd, "%u %.9f %.9f %.9f %.9f %.9f",
-		    req->xid,
+		    req->vxid,
 		    req->t_req,
 		    req->sp->t_idle,
 		    req->sp->t_idle - req->t_resp,
@@ -1254,6 +1253,7 @@ CNT_Request(struct worker *wrk, struct req *req)
 
 		/* done == 2 was charged by cache_hash.c */
 		SES_Charge(wrk, req);
+		req->vxid = 0;
 	}
 
 	req->wrk = NULL;
@@ -1265,56 +1265,3 @@ CNT_Request(struct worker *wrk, struct req *req)
 /*
 DOT }
 */
-
-/*--------------------------------------------------------------------
- * Debugging aids
- */
-
-static void
-cli_debug_xid(struct cli *cli, const char * const *av, void *priv)
-{
-	(void)priv;
-	if (av[2] != NULL)
-		xids = strtoul(av[2], NULL, 0);
-	VCLI_Out(cli, "XID is %u", xids);
-}
-
-/*
- * Default to seed=1, this is the only seed value POSIXl guarantees will
- * result in a reproducible random number sequence.
- */
-static void
-cli_debug_srandom(struct cli *cli, const char * const *av, void *priv)
-{
-	(void)priv;
-	unsigned seed = 1;
-
-	if (av[2] != NULL)
-		seed = strtoul(av[2], NULL, 0);
-	srandom(seed);
-	srand48(random());
-	VCLI_Out(cli, "Random(3) seeded with %u", seed);
-}
-
-static struct cli_proto debug_cmds[] = {
-	{ "debug.xid", "debug.xid",
-		"\tExamine or set XID\n", 0, 1, "d", cli_debug_xid },
-	{ "debug.srandom", "debug.srandom",
-		"\tSeed the random(3) function\n", 0, 1, "d",
-		cli_debug_srandom },
-	{ NULL }
-};
-
-/*--------------------------------------------------------------------
- *
- */
-
-void
-CNT_Init(void)
-{
-
-	srandomdev();
-	srand48(random());
-	xids = random();
-	CLI_AddFuncs(debug_cmds);
-}
diff --git a/bin/varnishd/cache/cache_response.c b/bin/varnishd/cache/cache_response.c
index fda117d..0a554f4 100644
--- a/bin/varnishd/cache/cache_response.c
+++ b/bin/varnishd/cache/cache_response.c
@@ -134,11 +134,11 @@ RES_BuildHttp(struct req *req)
 	VTIM_format(VTIM_real(), time_str);
 	http_PrintfHeader(req->resp, "Date: %s", time_str);
 
-	if (req->xid != req->obj->xid)
+	if (req->vxid != req->obj->vxid)
 		http_PrintfHeader(req->resp,
-		    "X-Varnish: %u %u", req->xid, req->obj->xid);
+		    "X-Varnish: %u %u", req->vxid, req->obj->vxid);
 	else
-		http_PrintfHeader(req->resp, "X-Varnish: %u", req->xid);
+		http_PrintfHeader(req->resp, "X-Varnish: %u", req->vxid);
 	http_PrintfHeader(req->resp, "Age: %.0f",
 	    req->obj->exp.age + req->t_resp -
 	    req->obj->exp.entered);
diff --git a/bin/varnishd/cache/cache_rfc2616.c b/bin/varnishd/cache/cache_rfc2616.c
index 905b744..7f5fd35 100644
--- a/bin/varnishd/cache/cache_rfc2616.c
+++ b/bin/varnishd/cache/cache_rfc2616.c
@@ -63,7 +63,7 @@
  */
 
 void
-RFC2616_Ttl(struct busyobj *bo, unsigned xid)
+RFC2616_Ttl(struct busyobj *bo)
 {
 	unsigned max_age, age;
 	double h_date, h_expires;
@@ -170,7 +170,7 @@ RFC2616_Ttl(struct busyobj *bo, unsigned xid)
 	/* calculated TTL, Our time, Date, Expires, max-age, age */
 	VSLb(bo->vsl, SLT_TTL,
 	    "%u RFC %.0f %.0f %.0f %.0f %.0f %.0f %.0f %u",
-	    xid, expp->ttl, -1., -1., expp->entered,
+	    bo->vxid, expp->ttl, -1., -1., expp->entered,
 	    expp->age, h_date, h_expires, max_age);
 }
 
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 9d3d3cb..c7b9a4a 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -163,8 +163,6 @@ ses_sess_pool_task(struct worker *wrk, void *arg)
 	req = SES_GetReq(sp);
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
-	req->vxid = VXID_Get(&wrk->vxid_pool);
-
 	sp->sess_step = S_STP_NEWREQ;
 	ses_req_pool_task(wrk, req);
 }
@@ -199,8 +197,8 @@ ses_vsl_socket(struct sess *sp, const char *lsockname)
 		strcpy(laddr, "-");
 		strcpy(lport, "-");
 	}
-	VSL(SLT_SessOpen, sp->vxid, "%s %s %s %s %s %.6f",
-	    sp->addr, sp->port, lsockname, laddr, lport, sp->t_open);
+	VSL(SLT_SessOpen, sp->vxid, "%u %s %s %s %s %s %.6f",
+	    sp->vxid, sp->addr, sp->port, lsockname, laddr, lport, sp->t_open);
 }
 
 /*--------------------------------------------------------------------
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 7563184..215e7b6 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -412,21 +412,21 @@ VRT_DO_EXP(req, req->exp, keep, 0, )
 
 VRT_DO_EXP(obj, req->obj->exp, grace, 0,
    EXP_Rearm(req->obj);
-   vrt_wsp_exp(req, req->obj->xid, &req->obj->exp);)
+   vrt_wsp_exp(req, req->obj->vxid, &req->obj->exp);)
 VRT_DO_EXP(obj, req->obj->exp, ttl,
    (req->t_req - req->obj->exp.entered),
    EXP_Rearm(req->obj);
-   vrt_wsp_exp(req, req->obj->xid, &req->obj->exp);)
+   vrt_wsp_exp(req, req->obj->vxid, &req->obj->exp);)
 VRT_DO_EXP(obj, req->obj->exp, keep, 0,
    EXP_Rearm(req->obj);
-   vrt_wsp_exp(req, req->obj->xid, &req->obj->exp);)
+   vrt_wsp_exp(req, req->obj->vxid, &req->obj->exp);)
 
 VRT_DO_EXP(beresp, req->busyobj->exp, grace, 0,
-   vrt_wsp_exp(req, req->xid, &req->busyobj->exp);)
+   vrt_wsp_exp(req, req->vxid, &req->busyobj->exp);)
 VRT_DO_EXP(beresp, req->busyobj->exp, ttl, 0,
-   vrt_wsp_exp(req, req->xid, &req->busyobj->exp);)
+   vrt_wsp_exp(req, req->vxid, &req->busyobj->exp);)
 VRT_DO_EXP(beresp, req->busyobj->exp, keep, 0,
-   vrt_wsp_exp(req, req->xid, &req->busyobj->exp);)
+   vrt_wsp_exp(req, req->vxid, &req->busyobj->exp);)
 
 /*--------------------------------------------------------------------
  * req.xid
@@ -439,9 +439,9 @@ VRT_r_req_xid(const struct req *req)
 	int size;
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
-	size = snprintf(NULL, 0, "%u", req->xid) + 1;
+	size = snprintf(NULL, 0, "%u", req->vxid) + 1;
 	AN(p = WS_Alloc(req->http->ws, size));
-	assert(snprintf(p, size, "%u", req->xid) < size);
+	assert(snprintf(p, size, "%u", req->vxid) < size);
 	return (p);
 }
 
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 53846a0..910808f 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -54,7 +54,7 @@ default_oc_getxid(struct dstat *ds, struct objcore *oc)
 	struct object *o;
 
 	o = oc_getobj(ds, oc);
-	return (o->xid);
+	return (o->vxid);
 }
 
 static struct object * __match_proto__(getobj_f)
diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c
index 09b2497..ff53af8 100644
--- a/bin/varnishd/storage/storage_persistent_silo.c
+++ b/bin/varnishd/storage/storage_persistent_silo.c
@@ -389,7 +389,7 @@ smp_oc_getxid(struct dstat *ds, struct objcore *oc)
 	 */
 	ASSERT_PTR_IN_SILO(sg->sc, o);
 	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
-	return (o->xid);
+	return (o->vxid);
 }
 
 /*---------------------------------------------------------------------
diff --git a/bin/varnishtest/tests/b00003.vtc b/bin/varnishtest/tests/b00003.vtc
index 8c2bf00..177643c 100644
--- a/bin/varnishtest/tests/b00003.vtc
+++ b/bin/varnishtest/tests/b00003.vtc
@@ -18,7 +18,7 @@ client c2 {
 	txreq -url "/"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "1002 1001"
+	expect resp.http.X-Varnish == "1004 1001"
 } -run
 
 # Give varnish a chance to update stats
diff --git a/bin/varnishtest/tests/b00010.vtc b/bin/varnishtest/tests/b00010.vtc
index b27dd42..cfa3266 100644
--- a/bin/varnishtest/tests/b00010.vtc
+++ b/bin/varnishtest/tests/b00010.vtc
@@ -14,5 +14,5 @@ client c1 {
 	txreq -url "/"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.x-varnish == "1002 1001"
+	expect resp.http.x-varnish == "1003 1001"
 } -run
diff --git a/bin/varnishtest/tests/b00012.vtc b/bin/varnishtest/tests/b00012.vtc
index 154f6c0..302767b 100644
--- a/bin/varnishtest/tests/b00012.vtc
+++ b/bin/varnishtest/tests/b00012.vtc
@@ -20,11 +20,11 @@ client c1 {
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 6
-	expect resp.http.x-varnish == "1002"
+	expect resp.http.x-varnish == "1003"
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 6
-	expect resp.http.x-varnish == "1003 1002"
+	expect resp.http.x-varnish == "1005 1003"
 } -run
 
 varnish v1 -expect sess_pipeline == 2
diff --git a/bin/varnishtest/tests/b00013.vtc b/bin/varnishtest/tests/b00013.vtc
index b8e25e6..f0be1d9 100644
--- a/bin/varnishtest/tests/b00013.vtc
+++ b/bin/varnishtest/tests/b00013.vtc
@@ -21,12 +21,12 @@ client c1 {
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 6
-	expect resp.http.x-varnish == "1002"
+	expect resp.http.x-varnish == "1003"
 	send "HTTP/1.1\n\n"
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 6
-	expect resp.http.x-varnish == "1003 1002"
+	expect resp.http.x-varnish == "1005 1003"
 } -run
 
 varnish v1 -expect sess_readahead == 2
diff --git a/bin/varnishtest/tests/b00015.vtc b/bin/varnishtest/tests/b00015.vtc
index 6e9d693..2e94add 100644
--- a/bin/varnishtest/tests/b00015.vtc
+++ b/bin/varnishtest/tests/b00015.vtc
@@ -19,7 +19,7 @@ client c1 {
 	txreq -url "/"
 	rxresp
 	expect resp.status == 503
-	expect resp.http.X-varnish == "1002"
+	expect resp.http.X-varnish == "1005"
 } -run
 
 # Then check that an cacheable error from the backend is 
@@ -35,14 +35,14 @@ client c1 {
 	txreq -url "/"
 	rxresp
 	expect resp.status == 302
-	expect resp.http.X-varnish == "1003"
+	expect resp.http.X-varnish == "1009"
 } -run
 
 client c1 {
 	txreq -url "/"
 	rxresp
 	expect resp.status == 302
-	expect resp.http.X-varnish == "1004 1003"
+	expect resp.http.X-varnish == "1012 1009"
 } -run
 
 # Then check that a non-cacheable error from the backend can be
@@ -64,12 +64,12 @@ client c1 {
 	txreq -url "/2"
 	rxresp
 	expect resp.status == 502
-	expect resp.http.X-varnish == "1005"
+	expect resp.http.X-varnish == "1014"
 } -run
 
 client c1 {
 	txreq -url "/2"
 	rxresp
 	expect resp.status == 502
-	expect resp.http.X-varnish == "1006 1005"
+	expect resp.http.X-varnish == "1017 1014"
 } -run
diff --git a/bin/varnishtest/tests/c00004.vtc b/bin/varnishtest/tests/c00004.vtc
index 6b47ad5..cd79441 100644
--- a/bin/varnishtest/tests/c00004.vtc
+++ b/bin/varnishtest/tests/c00004.vtc
@@ -26,25 +26,25 @@ client c1 {
 	txreq -hdr "Foobar: 2"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "1002"
+	expect resp.http.X-Varnish == "1003"
 	expect resp.http.snafu == "2"
 
 	txreq -hdr "Foobar: 3"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "1003"
+	expect resp.http.X-Varnish == "1005"
 	expect resp.http.snafu == "3"
 
 	txreq 
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "1004"
+	expect resp.http.X-Varnish == "1007"
 	expect resp.http.snafu == "4"
 
 	txreq -hdr "Foobar:  1 "
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "1005 1001"
+	expect resp.http.X-Varnish == "1009 1001"
 	expect resp.http.snafu == "1"
 
 } -run
diff --git a/bin/varnishtest/tests/c00010.vtc b/bin/varnishtest/tests/c00010.vtc
index 6f0aca3..1b6a5ec 100644
--- a/bin/varnishtest/tests/c00010.vtc
+++ b/bin/varnishtest/tests/c00010.vtc
@@ -25,7 +25,7 @@ client c1 {
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 7
-	expect resp.http.x-varnish == "1002"
+	expect resp.http.x-varnish == "1003"
 } 
 
 client c1 -run
diff --git a/bin/varnishtest/tests/c00011.vtc b/bin/varnishtest/tests/c00011.vtc
index 6bea217..952966b 100644
--- a/bin/varnishtest/tests/c00011.vtc
+++ b/bin/varnishtest/tests/c00011.vtc
@@ -25,7 +25,7 @@ client c1 {
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 7
-	expect resp.http.x-varnish == "1002"
+	expect resp.http.x-varnish == "1003"
 } 
 
 client c1 -run
diff --git a/bin/varnishtest/tests/c00012.vtc b/bin/varnishtest/tests/c00012.vtc
index b578625..79185e1 100644
--- a/bin/varnishtest/tests/c00012.vtc
+++ b/bin/varnishtest/tests/c00012.vtc
@@ -25,7 +25,7 @@ client c1 {
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 7
-	expect resp.http.x-varnish == "1002"
+	expect resp.http.x-varnish == "1004"
 } 
 
 client c1 -run
diff --git a/bin/varnishtest/tests/c00013.vtc b/bin/varnishtest/tests/c00013.vtc
index 885be31..fee1271 100644
--- a/bin/varnishtest/tests/c00013.vtc
+++ b/bin/varnishtest/tests/c00013.vtc
@@ -20,14 +20,16 @@ client c1 {
 	expect resp.http.x-varnish == "1001"
 } -start
 
+sema r1 sync 2
+
 client c2 {
-	sema r1 sync 2
 	txreq -url "/foo" -hdr "client: c2"
+	delay .1
 	sema r1 sync 2
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 12
-	expect resp.http.x-varnish == "1002 1001"
+	expect resp.http.x-varnish == "1004 1001"
 } -run
 
 client c1 -wait
diff --git a/bin/varnishtest/tests/c00014.vtc b/bin/varnishtest/tests/c00014.vtc
index 545c469..7e5dab1 100644
--- a/bin/varnishtest/tests/c00014.vtc
+++ b/bin/varnishtest/tests/c00014.vtc
@@ -32,7 +32,7 @@ client c2 {
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 6
-	expect resp.http.x-varnish == "1002"
+	expect resp.http.x-varnish == "1004"
 } -run
 
 client c1 -wait
diff --git a/bin/varnishtest/tests/c00015.vtc b/bin/varnishtest/tests/c00015.vtc
index c323b9c..8490bf3 100644
--- a/bin/varnishtest/tests/c00015.vtc
+++ b/bin/varnishtest/tests/c00015.vtc
@@ -36,7 +36,7 @@ client c2 {
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 7
-	expect resp.http.x-varnish == "1002"
+	expect resp.http.x-varnish == "1004"
 } -run
 
 varnish v1 -cli "vcl.use vcl1"
@@ -46,7 +46,7 @@ client c3 {
 	rxresp
 	expect resp.status == 200
 	expect resp.bodylen == 6
-	expect resp.http.x-varnish == "1003 1001"
+	expect resp.http.x-varnish == "1007 1001"
 } -run
 
 varnish v1 -cli "vcl.show vcl2"
diff --git a/bin/varnishtest/tests/c00020.vtc b/bin/varnishtest/tests/c00020.vtc
index 7fc707c..8e14f12 100644
--- a/bin/varnishtest/tests/c00020.vtc
+++ b/bin/varnishtest/tests/c00020.vtc
@@ -19,7 +19,7 @@ client c2 {
         txreq -url "/"
         rxresp
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1002 1001"
+        expect resp.http.X-Varnish == "1004 1001"
 } -run
 
 server s1 {
@@ -35,19 +35,19 @@ client c2 {
         txreq -url "/foo"
         rxresp
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1003"
+        expect resp.http.X-Varnish == "1006"
         txreq -url "/"
         rxresp
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1004 1001"
+        expect resp.http.X-Varnish == "1008 1001"
         txreq -url "/bar"
         rxresp
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1005"
+        expect resp.http.X-Varnish == "1009"
         txreq -url "/foo"
         rxresp
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1006 1003"
+        expect resp.http.X-Varnish == "1011 1006"
 } -run
 
 varnish v1 -expect sess_conn == 3
diff --git a/bin/varnishtest/tests/c00023.vtc b/bin/varnishtest/tests/c00023.vtc
index 8c65eaa..a29908d 100644
--- a/bin/varnishtest/tests/c00023.vtc
+++ b/bin/varnishtest/tests/c00023.vtc
@@ -44,49 +44,49 @@ client c1 {
         rxresp
         expect resp.bodylen == 2
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1002"
+        expect resp.http.X-Varnish == "1003"
 
         txreq -url "/3"
         rxresp
         expect resp.bodylen == 3
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1003"
+        expect resp.http.X-Varnish == "1005"
 
         txreq -url "/4"
         rxresp
         expect resp.bodylen == 4
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1004"
+        expect resp.http.X-Varnish == "1007"
 
         txreq -url "/5"
         rxresp
         expect resp.bodylen == 5
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1005"
+        expect resp.http.X-Varnish == "1009"
 
         txreq -url "/6"
         rxresp
         expect resp.bodylen == 6
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1006"
+        expect resp.http.X-Varnish == "1011"
 
         txreq -url "/7"
         rxresp
         expect resp.bodylen == 7
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1007"
+        expect resp.http.X-Varnish == "1013"
 
         txreq -url "/8"
         rxresp
         expect resp.bodylen == 8
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1008"
+        expect resp.http.X-Varnish == "1015"
 
         txreq -url "/9"
         rxresp
         expect resp.bodylen == 9
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1009"
+        expect resp.http.X-Varnish == "1017"
 } -run
 
 
@@ -95,55 +95,55 @@ client c1 {
         rxresp
         expect resp.status == 200
         expect resp.bodylen == 1
-        expect resp.http.X-Varnish == "1010 1001"
+        expect resp.http.X-Varnish == "1020 1001"
 
         txreq -url "/2"
         rxresp
         expect resp.bodylen == 2
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1011 1002"
+        expect resp.http.X-Varnish == "1021 1003"
 
         txreq -url "/3"
         rxresp
         expect resp.bodylen == 3
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1012 1003"
+        expect resp.http.X-Varnish == "1022 1005"
 
         txreq -url "/4"
         rxresp
         expect resp.bodylen == 4
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1013 1004"
+        expect resp.http.X-Varnish == "1023 1007"
 
         txreq -url "/5"
         rxresp
         expect resp.bodylen == 5
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1014 1005"
+        expect resp.http.X-Varnish == "1024 1009"
 
         txreq -url "/6"
         rxresp
         expect resp.bodylen == 6
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1015 1006"
+        expect resp.http.X-Varnish == "1025 1011"
 
         txreq -url "/7"
         rxresp
         expect resp.bodylen == 7
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1016 1007"
+        expect resp.http.X-Varnish == "1026 1013"
 
         txreq -url "/8"
         rxresp
         expect resp.bodylen == 8
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1017 1008"
+        expect resp.http.X-Varnish == "1027 1015"
 
         txreq -url "/9"
         rxresp
         expect resp.bodylen == 9
         expect resp.status == 200
-        expect resp.http.X-Varnish == "1018 1009"
+        expect resp.http.X-Varnish == "1028 1017"
 } -run
 
 varnish v1 -cliok "hcb.dump"
diff --git a/bin/varnishtest/tests/p00004.vtc b/bin/varnishtest/tests/p00004.vtc
index e9b08f5..dab8ea4 100644
--- a/bin/varnishtest/tests/p00004.vtc
+++ b/bin/varnishtest/tests/p00004.vtc
@@ -29,7 +29,7 @@ client c1 {
 	txreq -url "/bar"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "1002"
+	expect resp.http.X-Varnish == "1004"
 	expect resp.http.bar == "bar"
 } -run
 
@@ -37,7 +37,7 @@ varnish v1 -expect n_object == 2
 
 varnish v1 -stop
 varnish v1 -start 
-varnish v1 -cliok "debug.xid 2000"
+varnish v1 -cliok "debug.xid 1999"
 
 varnish v1 -expect n_vampireobject == 2
 varnish v1 -expect n_object == 0
@@ -57,7 +57,7 @@ client c1 {
 	txreq -url "/bar"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "2002 1002"
+	expect resp.http.X-Varnish == "2003 1004"
 	expect resp.http.bar == "bar"
 } -run
 
diff --git a/bin/varnishtest/tests/p00006.vtc b/bin/varnishtest/tests/p00006.vtc
index d30c6cb..3334f36 100644
--- a/bin/varnishtest/tests/p00006.vtc
+++ b/bin/varnishtest/tests/p00006.vtc
@@ -25,7 +25,7 @@ client c1 {
 	txreq -url "/foo" -hdr "foo: 2" -hdr "bar: 1"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "1002"
+	expect resp.http.X-Varnish == "1003"
 	expect resp.http.foo == "foo2"
 
 } -run
@@ -35,6 +35,7 @@ server s1 -wait
 
 varnish v1 -stop
 varnish v1 -start
+varnish v1 -cliok "debug.xid 1999"
 
 varnish v1 -expect n_vampireobject == 2
 
@@ -42,13 +43,13 @@ client c1 {
 	txreq -url "/foo" -hdr "foo: 1" -hdr "bar: 2"
 	rxresp
 	expect resp.status == 200
-	#expect resp.http.X-Varnish == "1001"
+	expect resp.http.X-Varnish == "2001 1001"
 	expect resp.http.foo == "foo1"
 
 	txreq -url "/foo" -hdr "foo: 2" -hdr "bar: 1"
 	rxresp
 	expect resp.status == 200
-	#expect resp.http.X-Varnish == "1002"
+	expect resp.http.X-Varnish == "2002 1003"
 	expect resp.http.foo == "foo2"
 
 } -run
diff --git a/bin/varnishtest/tests/r00102.vtc b/bin/varnishtest/tests/r00102.vtc
index 6d2d8aa..d2a3c13 100644
--- a/bin/varnishtest/tests/r00102.vtc
+++ b/bin/varnishtest/tests/r00102.vtc
@@ -28,7 +28,7 @@ client c1 {
 		-body "123456789\n"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "1002 1001"
+	expect resp.http.X-Varnish == "1003 1001"
 }
 
 client c1 -run
diff --git a/bin/varnishtest/tests/r00262.vtc b/bin/varnishtest/tests/r00262.vtc
index b3c1cf9..1deb9ea 100644
--- a/bin/varnishtest/tests/r00262.vtc
+++ b/bin/varnishtest/tests/r00262.vtc
@@ -19,7 +19,7 @@ client c1 {
 	send "GET / HTTP/1.1\r\n\r\n"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.X-Varnish == "1002 1001"
+	expect resp.http.X-Varnish == "1003 1001"
 }
 
 client c1 -run
diff --git a/bin/varnishtest/tests/r00466.vtc b/bin/varnishtest/tests/r00466.vtc
index 8d753ba..3d64b22 100644
--- a/bin/varnishtest/tests/r00466.vtc
+++ b/bin/varnishtest/tests/r00466.vtc
@@ -34,5 +34,5 @@ client c1 {
 	txreq -url "/bar" -hdr "Range: 200-300"
 	rxresp
 	expect resp.status == 206
-	expect resp.http.X-Varnish == "1002"
+	expect resp.http.X-Varnish == "1003"
 } -run
diff --git a/bin/varnishtest/tests/s00000.vtc b/bin/varnishtest/tests/s00000.vtc
index bde8934..b5090ff 100644
--- a/bin/varnishtest/tests/s00000.vtc
+++ b/bin/varnishtest/tests/s00000.vtc
@@ -26,6 +26,6 @@ client c2 {
 	txreq -url "/"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.x-varnish == "1002"
+	expect resp.http.x-varnish == "1004"
 	expect resp.bodylen == 6
 } -run
diff --git a/bin/varnishtest/tests/s00001.vtc b/bin/varnishtest/tests/s00001.vtc
index 68fd520..44ea211 100644
--- a/bin/varnishtest/tests/s00001.vtc
+++ b/bin/varnishtest/tests/s00001.vtc
@@ -27,6 +27,6 @@ client c2 {
 	txreq -url "/"
 	rxresp
 	expect resp.status == 200
-	expect resp.http.x-varnish == "1002"
+	expect resp.http.x-varnish == "1004"
 	expect resp.bodylen == 6
 } -run
diff --git a/bin/varnishtest/tests/s00002.vtc b/bin/varnishtest/tests/s00002.vtc
index 3cb56cf..31fb400 100644
--- a/bin/varnishtest/tests/s00002.vtc
+++ b/bin/varnishtest/tests/s00002.vtc
@@ -69,5 +69,5 @@ client c2 {
 	rxresp
 	expect resp.http.foo == "bar"
 	expect resp.status == 200
-	expect resp.http.x-varnish == "1002 1001"
+	expect resp.http.x-varnish == "1004 1001"
 } -run
diff --git a/bin/varnishtest/tests/v00011.vtc b/bin/varnishtest/tests/v00011.vtc
index 6cce4de..43ea8c2 100644
--- a/bin/varnishtest/tests/v00011.vtc
+++ b/bin/varnishtest/tests/v00011.vtc
@@ -27,13 +27,13 @@ client c1 {
 client c1 {
 	txreq -req "PURGE"
 	rxresp
-	expect resp.http.X-Varnish == "1002"
+	expect resp.http.X-Varnish == "1004"
 	expect resp.status == 209
 } -run
 
 client c1 {
 	txreq
 	rxresp
-	expect resp.http.X-Varnish == "1003"
+	expect resp.http.X-Varnish == "1007"
 
 } -run
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index e493ae7..0ddf1d0 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -483,7 +483,7 @@ varnish_start(struct varnish *v)
 		vtc_log(v->vl, 0, "CLI start command failed: %u %s", u, resp);
 	wait_running(v);
 	free(resp);
-	u = varnish_ask_cli(v, "debug.xid 1000", &resp);
+	u = varnish_ask_cli(v, "debug.xid 999", &resp);
 	if (vtc_error)
 		return;
 	if (u != CLIS_OK)



More information about the varnish-commit mailing list