Commit 925d3f05 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Change CLI cmd debug.xid to set the next XID to be used, rather than "one less...

Change CLI cmd debug.xid to set the next XID to be used, rather than "one less than the next XID to be used"
parent d287d2da
......@@ -179,7 +179,7 @@ THR_Init(void)
* zero vxid, in order to reserve that for "unassociated" VSL records.
*/
static uint64_t vxid_base;
static uint64_t vxid_base = 1;
static uint32_t vxid_chunk = 32768;
static struct lock vxid_lock;
......@@ -193,18 +193,20 @@ VXID_Get(const struct worker *wrk, uint32_t mask)
CHECK_OBJ_NOTNULL(wrk->wpriv, WORKER_PRIV_MAGIC);
v = wrk->wpriv->vxid_pool;
AZ(mask & VSL_IDENTMASK);
do {
if (v->count == 0) {
Lck_Lock(&vxid_lock);
v->next = vxid_base;
v->count = vxid_chunk;
vxid_base = (vxid_base + v->count) & VSL_IDENTMASK;
Lck_Unlock(&vxid_lock);
}
v->count--;
v->next++;
} while (v->next == 0);
while (v->count == 0 || v->next >= VSL_CLIENTMARKER) {
Lck_Lock(&vxid_lock);
v->next = vxid_base;
v->count = vxid_chunk;
vxid_base += v->count;
if (vxid_base >= VSL_CLIENTMARKER)
vxid_base = 1;
Lck_Unlock(&vxid_lock);
}
v->count--;
assert(v->next > 0);
assert(v->next < VSL_CLIENTMARKER);
retval.vxid = v->next | mask;
v->next++;
return (retval);
}
......
......@@ -43,7 +43,7 @@ varnish v1 -cliok "debug.persistent s0 sync"
varnish v1 -stop
varnish v1 -start
varnish v1 -cliok "debug.xid 1999"
varnish v1 -cliok "debug.xid 2000"
client c1 {
txreq -url "/"
......
......@@ -39,7 +39,7 @@ varnish v1 -expect n_object == 2
varnish v1 -stop
varnish v1 -start
varnish v1 -cliok "debug.xid 1999"
varnish v1 -cliok "debug.xid 2000"
varnish v1 -expect n_vampireobject == 2
varnish v1 -expect n_object == 0
......
......@@ -38,7 +38,7 @@ server s1 -wait
varnish v1 -stop
varnish v1 -start
varnish v1 -cliok "debug.xid 1999"
varnish v1 -cliok "debug.xid 2000"
varnish v1 -expect n_vampireobject == 2
......
......@@ -36,7 +36,7 @@ varnish v1 -cliok "param.set debug +syncvsl"
varnish v1 -cliok "debug.xid 1073741823"
logexpect l1 -v v1 -g request -T 2 {
expect 0 1 Begin "req 0"
expect 0 1 Begin "req 107374182"
expect * = ReqStart
expect 0 = ReqMethod GET
expect 0 = ReqURL /
......@@ -80,7 +80,7 @@ varnish v1 -cliok "param.set debug +syncvsl"
varnish v1 -cliok "debug.xid 1073741823"
logexpect l1 -v v1 -g request {
expect 0 1 Begin "req 0"
expect 0 1 Begin "req 1073741823"
expect * = ReqStart
expect 0 = ReqMethod GET
expect 0 = ReqURL /
......
......@@ -620,7 +620,7 @@ varnish_start(struct varnish *v)
wait_running(v);
free(resp);
resp = NULL;
u = varnish_ask_cli(v, "debug.xid 999", &resp);
u = varnish_ask_cli(v, "debug.xid 1000", &resp);
if (vtc_error)
return;
if (u != CLIS_OK)
......
......@@ -35,6 +35,9 @@ release process.
Varnish Cache NEXT (2023-03-15)
===============================
* The ``debug.xid`` CLI command now sets the next XID to be used,
rather than "one less than the next XID to be used"
================================
Varnish Cache 7.2.0 (2022-09-15)
================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment