Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
54908ac1
Commit
54908ac1
authored
May 08, 2019
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Duh! Last committed from wrong directory.
parent
1d0298e1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
43 deletions
+61
-43
r02471.vtc
bin/varnishtest/tests/r02471.vtc
+2
-2
v00045.vtc
bin/varnishtest/tests/v00045.vtc
+1
-1
vrt.h
include/vrt.h
+9
-8
vmod.vcc
lib/libvmod_debug/vmod.vcc
+5
-4
vmod_debug.c
lib/libvmod_debug/vmod_debug.c
+44
-28
No files found.
bin/varnishtest/tests/r02471.vtc
View file @
54908ac1
...
...
@@ -10,9 +10,9 @@ varnish v1 -vcl+backend {
sub vcl_recv {
if (req.url == "/hold") {
debug.
hold_vcl_busy
();
debug.
vcl_prevent_cold
();
} else if (req.url == "/release") {
debug.
release_vcl_busy
();
debug.
vcl_allow_cold
();
}
return (synth(200));
}
...
...
bin/varnishtest/tests/v00045.vtc
View file @
54908ac1
...
...
@@ -6,7 +6,7 @@ server s1 -start
varnish v1 -vcl+backend {
import debug;
sub vcl_init {
debug.vcl_
release
_delay(3s);
debug.vcl_
discard
_delay(3s);
}
} -start
...
...
include/vrt.h
View file @
54908ac1
...
...
@@ -52,10 +52,11 @@
* binary/load-time compatible, increment MAJOR version
*
* unreleased (planned for 2019-09-15)
* VRT_VCL_{Busy|Unbusy} changed to VRT_VCL_{Prevent|Allow}_Cold
* VRT_re[fl]_vcl changed to VRT_VCL_{Prevent|Allow}_Discard
* VRT_Vmod_{Init|Unload} moved to vcc_interface.h
* VRT_count moved to vcc_interface.h
* VRT_VCL_
Busy() and VRT_VCL_Unbusy
() added.
* VRT_VCL_
Prevent_Cold() and VRT_VCL_Allow_Cold
() added.
* VRT_vcl_get moved to vcc_interface.h
* VRT_vcl_rel emoved to vcc_interface.h
* VRT_vcl_select emoved to vcc_interface.h
...
...
@@ -523,10 +524,6 @@ struct vmod_priv {
vmod_priv_free_f
*
free
;
};
struct
vclref
;
struct
vclref
*
VRT_VCL_Prevent_Discard
(
VRT_CTX
,
const
char
*
);
void
VRT_VCL_Allow_Discard
(
struct
vclref
**
);
void
VRT_priv_fini
(
const
struct
vmod_priv
*
p
);
struct
vmod_priv
*
VRT_priv_task
(
VRT_CTX
,
const
void
*
vmod_id
);
struct
vmod_priv
*
VRT_priv_top
(
VRT_CTX
,
const
void
*
vmod_id
);
...
...
@@ -563,8 +560,12 @@ void VRT_VSC_Reveal(const struct vsc_seg *);
size_t
VRT_VSC_Overhead
(
size_t
);
/*
* API to
prevent VCL from going cold
* API to
restrict the VCL in various ways
*/
void
VRT_VCL_Busy
(
VRT_CTX
);
void
VRT_VCL_Unbusy
(
VRT_CTX
);
struct
vclref
;
struct
vclref
*
VRT_VCL_Prevent_Cold
(
VRT_CTX
,
const
char
*
);
void
VRT_VCL_Allow_Cold
(
struct
vclref
**
);
struct
vclref
*
VRT_VCL_Prevent_Discard
(
VRT_CTX
,
const
char
*
);
void
VRT_VCL_Allow_Discard
(
struct
vclref
**
);
lib/libvmod_debug/vmod.vcc
View file @
54908ac1
...
...
@@ -160,9 +160,10 @@ $Method VOID .refresh(STRING path)
Dynamically refresh & (always!) replace the backend by a new UDS backend.
$Function VOID vcl_
release_delay(
DURATION)
$Function VOID vcl_
discard_delay(PRIV_VCL,
DURATION)
Hold a reference to the VCL when it goes cold for the given delay.
Hold a reference to the VCL when it goes cold preventing
discard for the given delay.
$Function BOOL match_acl(ACL acl, IP ip)
...
...
@@ -244,11 +245,11 @@ should now only be used for diagnostic purposes.
0B is returned if no sensible value can be determined.
$Function VOID
hold_vcl_busy(
)
$Function VOID
vcl_prevent_cold(PRIV_VCL
)
Prevent VCL from going cold
$Function VOID
release_vcl_busy(
)
$Function VOID
vcl_allow_cold(PRIV_VCL
)
Allow VCL to go cold
...
...
lib/libvmod_debug/vmod_debug.c
View file @
54908ac1
...
...
@@ -47,10 +47,11 @@ struct priv_vcl {
#define PRIV_VCL_MAGIC 0x8E62FA9D
char
*
foo
;
uintptr_t
obj_cb
;
struct
vclref
*
vclref
;
struct
vclref
*
vclref_discard
;
struct
vclref
*
vclref_cold
;
VCL_DURATION
vcl_discard_delay
;
};
static
VCL_DURATION
vcl_release_delay
=
0
.
0
;
static
pthread_mutex_t
vsc_mtx
=
PTHREAD_MUTEX_INITIALIZER
;
static
struct
vsc_seg
*
vsc_seg
=
NULL
;
...
...
@@ -340,7 +341,8 @@ priv_vcl_free(void *priv)
ObjUnsubscribeEvents
(
&
priv_vcl
->
obj_cb
);
VSL
(
SLT_Debug
,
0
,
"Unsubscribed from Object Events"
);
}
AZ
(
priv_vcl
->
vclref
);
AZ
(
priv_vcl
->
vclref_discard
);
AZ
(
priv_vcl
->
vclref_cold
);
FREE_OBJ
(
priv_vcl
);
AZ
(
priv_vcl
);
}
...
...
@@ -376,6 +378,32 @@ event_load(VRT_CTX, struct vmod_priv *priv)
return
(
0
);
}
VCL_VOID
xyzzy_vcl_prevent_cold
(
VRT_CTX
,
struct
vmod_priv
*
priv
)
{
struct
priv_vcl
*
priv_vcl
;
char
buf
[
32
];
CAST_OBJ_NOTNULL
(
priv_vcl
,
priv
->
priv
,
PRIV_VCL_MAGIC
);
AZ
(
priv_vcl
->
vclref_cold
);
bprintf
(
buf
,
"vmod-debug ref on %s"
,
VCL_Name
(
ctx
->
vcl
));
priv_vcl
->
vclref_cold
=
VRT_VCL_Prevent_Cold
(
ctx
,
buf
);
}
VCL_VOID
xyzzy_vcl_allow_cold
(
VRT_CTX
,
struct
vmod_priv
*
priv
)
{
struct
priv_vcl
*
priv_vcl
;
(
void
)
ctx
;
CAST_OBJ_NOTNULL
(
priv_vcl
,
priv
->
priv
,
PRIV_VCL_MAGIC
);
AN
(
priv_vcl
->
vclref_cold
);
VRT_VCL_Allow_Cold
(
&
priv_vcl
->
vclref_cold
);
}
static
int
event_warm
(
VRT_CTX
,
const
struct
vmod_priv
*
priv
)
{
...
...
@@ -391,10 +419,10 @@ event_warm(VRT_CTX, const struct vmod_priv *priv)
}
CAST_OBJ_NOTNULL
(
priv_vcl
,
priv
->
priv
,
PRIV_VCL_MAGIC
);
AZ
(
priv_vcl
->
vclref
);
AZ
(
priv_vcl
->
vclref
_discard
);
bprintf
(
buf
,
"vmod-debug ref on %s"
,
VCL_Name
(
ctx
->
vcl
));
priv_vcl
->
vclref
=
VRT_VCL_Prevent_Discard
(
ctx
,
buf
);
priv_vcl
->
vclref
_discard
=
VRT_VCL_Prevent_Discard
(
ctx
,
buf
);
return
(
0
);
}
...
...
@@ -404,10 +432,10 @@ cooldown_thread(void *priv)
struct
priv_vcl
*
priv_vcl
;
CAST_OBJ_NOTNULL
(
priv_vcl
,
priv
,
PRIV_VCL_MAGIC
);
AN
(
priv_vcl
->
vclref
);
AN
(
priv_vcl
->
vclref
_discard
);
VTIM_sleep
(
vcl_release
_delay
);
VRT_VCL_Allow_Discard
(
&
priv_vcl
->
vclref
);
VTIM_sleep
(
priv_vcl
->
vcl_discard
_delay
);
VRT_VCL_Allow_Discard
(
&
priv_vcl
->
vclref
_discard
);
return
(
NULL
);
}
...
...
@@ -418,12 +446,12 @@ event_cold(VRT_CTX, const struct vmod_priv *priv)
struct
priv_vcl
*
priv_vcl
;
CAST_OBJ_NOTNULL
(
priv_vcl
,
priv
->
priv
,
PRIV_VCL_MAGIC
);
AN
(
priv_vcl
->
vclref
);
AN
(
priv_vcl
->
vclref
_discard
);
VSL
(
SLT_Debug
,
0
,
"%s: VCL_EVENT_COLD"
,
VCL_Name
(
ctx
->
vcl
));
if
(
vcl_release
_delay
==
0
.
0
)
{
VRT_VCL_Allow_Discard
(
&
priv_vcl
->
vclref
);
if
(
priv_vcl
->
vcl_discard
_delay
==
0
.
0
)
{
VRT_VCL_Allow_Discard
(
&
priv_vcl
->
vclref
_discard
);
return
(
0
);
}
...
...
@@ -469,13 +497,15 @@ xyzzy_event_function(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
}
}
VCL_VOID
v_matchproto_
(
td_debug_vcl_
release
_delay
)
xyzzy_vcl_
release_delay
(
VRT_CTX
,
VCL_DURATION
delay
)
VCL_VOID
v_matchproto_
(
td_debug_vcl_
discard
_delay
)
xyzzy_vcl_
discard_delay
(
VRT_CTX
,
struct
vmod_priv
*
priv
,
VCL_DURATION
delay
)
{
struct
priv_vcl
*
priv_vcl
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CAST_OBJ_NOTNULL
(
priv_vcl
,
priv
->
priv
,
PRIV_VCL_MAGIC
);
assert
(
delay
>
0
.
0
);
vcl_release
_delay
=
delay
;
priv_vcl
->
vcl_discard
_delay
=
delay
;
}
VCL_BOOL
v_matchproto_
(
td_debug_match_acl
)
...
...
@@ -782,20 +812,6 @@ xyzzy_stk(VRT_CTX)
return
(
0
);
}
VCL_VOID
xyzzy_hold_vcl_busy
(
VRT_CTX
)
{
VRT_VCL_Busy
(
ctx
);
}
VCL_VOID
xyzzy_release_vcl_busy
(
VRT_CTX
)
{
VRT_VCL_Unbusy
(
ctx
);
}
VCL_VOID
xyzzy_sndbuf
(
VRT_CTX
,
VCL_BYTES
arg
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment