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
b81e2770
Commit
b81e2770
authored
Nov 24, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ditch the director cooling list and trust the refcounts.
(4th part of #3599)
parent
5ed9aece
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
66 deletions
+14
-66
cache_backend.c
bin/varnishd/cache/cache_backend.c
+12
-57
cache_backend.h
bin/varnishd/cache/cache_backend.h
+0
-4
cache_cli.c
bin/varnishd/cache/cache_cli.c
+0
-1
cache_req.c
bin/varnishd/cache/cache_req.c
+1
-1
cache_varnishd.h
bin/varnishd/cache/cache_varnishd.h
+0
-1
cache_vcl.h
bin/varnishd/cache/cache_vcl.h
+0
-1
cache_vrt_vcl.c
bin/varnishd/cache/cache_vrt_vcl.c
+1
-1
No files found.
bin/varnishd/cache/cache_backend.c
View file @
b81e2770
...
...
@@ -54,9 +54,6 @@
static
const
char
*
const
vbe_proto_ident
=
"HTTP Backend"
;
static
VTAILQ_HEAD
(,
backend
)
backends
=
VTAILQ_HEAD_INITIALIZER
(
backends
);
static
VTAILQ_HEAD
(,
backend
)
cool_backends
=
VTAILQ_HEAD_INITIALIZER
(
cool_backends
);
static
struct
lock
backends_mtx
;
/*--------------------------------------------------------------------*/
...
...
@@ -426,13 +423,9 @@ vbe_free(struct backend *be)
VSC_vbe_Destroy
(
&
be
->
vsc_seg
);
Lck_Lock
(
&
backends_mtx
);
if
(
be
->
cooled
>
0
)
VTAILQ_REMOVE
(
&
cool_backends
,
be
,
list
);
else
VTAILQ_REMOVE
(
&
backends
,
be
,
list
);
VSC_C_main
->
n_backend
--
;
VCP_Rel
(
&
be
->
conn_pool
);
Lck_Unlock
(
&
backends_mtx
);
VCP_Rel
(
&
be
->
conn_pool
);
#define DA(x) do { if (be->x != NULL) free(be->x); } while (0)
#define DN(x)
/**/
...
...
@@ -630,21 +623,19 @@ VRT_new_backend_clustered(VRT_CTX, struct vsmw_cluster *vc,
}
Lck_Lock
(
&
backends_mtx
);
VTAILQ_INSERT_TAIL
(
&
backends
,
be
,
list
);
VSC_C_main
->
n_backend
++
;
Lck_Unlock
(
&
backends_mtx
);
be
->
director
=
VRT_AddDirector
(
ctx
,
m
,
be
,
"%s"
,
vrt
->
vcl_name
);
if
(
be
->
director
!=
NULL
)
{
/* for cold VCL, update initial director state */
if
(
be
->
probe
!=
NULL
&&
!
vcl
->
temp
->
is_warm
)
VBP_Update_Backend
(
be
->
probe
);
return
(
be
->
director
);
if
(
be
->
director
==
NULL
)
{
vbe_free
(
be
);
return
(
NULL
);
}
vbe_free
(
be
);
return
(
NULL
);
/* for cold VCL, update initial director state */
if
(
be
->
probe
!=
NULL
)
VBP_Update_Backend
(
be
->
probe
);
return
(
be
->
director
);
}
VCL_BACKEND
...
...
@@ -664,47 +655,11 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
void
VRT_delete_backend
(
VRT_CTX
,
VCL_BACKEND
*
dp
)
{
VCL_BACKEND
d
;
struct
backend
*
be
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
TAKE_OBJ_NOTNULL
(
d
,
dp
,
DIRECTOR_MAGIC
);
CAST_OBJ_NOTNULL
(
be
,
d
->
priv
,
BACKEND_MAGIC
);
Lck_Lock
(
be
->
director
->
mtx
);
VRT_DisableDirector
(
be
->
director
);
Lck_Unlock
(
be
->
director
->
mtx
);
Lck_Lock
(
&
backends_mtx
);
AZ
(
be
->
cooled
);
be
->
cooled
=
VTIM_real
()
+
60
.;
VTAILQ_REMOVE
(
&
backends
,
be
,
list
);
VTAILQ_INSERT_TAIL
(
&
cool_backends
,
be
,
list
);
Lck_Unlock
(
&
backends_mtx
);
// NB. The backend is still usable for the ongoing transactions,
// this is why we don't bust the director's magic number.
}
/*---------------------------------------------------------------------*/
void
VBE_Poll
(
void
)
{
struct
backend
*
be
,
*
be2
;
vtim_real
now
=
VTIM_real
();
ASSERT_CLI
();
Lck_Lock
(
&
backends_mtx
);
VTAILQ_FOREACH_SAFE
(
be
,
&
cool_backends
,
list
,
be2
)
{
CHECK_OBJ_NOTNULL
(
be
,
BACKEND_MAGIC
);
if
(
be
->
cooled
>
now
)
break
;
if
(
be
->
n_conn
>
0
)
continue
;
Lck_Unlock
(
&
backends_mtx
);
VRT_DelDirector
(
&
be
->
director
);
Lck_Lock
(
&
backends_mtx
);
}
Lck_Unlock
(
&
backends_mtx
);
(
void
)
ctx
;
CHECK_OBJ_NOTNULL
(
*
dp
,
DIRECTOR_MAGIC
);
VRT_DisableDirector
(
*
dp
);
VRT_Assign_Backend
(
dp
,
NULL
);
}
/*---------------------------------------------------------------------*/
...
...
bin/varnishd/cache/cache_backend.h
View file @
b81e2770
...
...
@@ -54,8 +54,6 @@ struct backend {
unsigned
n_conn
;
VTAILQ_ENTRY
(
backend
)
list
;
struct
vrt_endpoint
*
endpoint
;
VRT_BACKEND_FIELDS
()
...
...
@@ -71,8 +69,6 @@ struct backend {
struct
conn_pool
*
conn_pool
;
VCL_BACKEND
director
;
vtim_real
cooled
;
};
/*---------------------------------------------------------------------
...
...
bin/varnishd/cache/cache_cli.c
View file @
b81e2770
...
...
@@ -77,7 +77,6 @@ cli_cb_before(const struct cli *cli)
ASSERT_CLI
();
VSL
(
SLT_CLI
,
0
,
"Rd %s"
,
VSB_data
(
cli
->
cmd
));
VCL_Poll
();
VBE_Poll
();
Lck_Lock
(
&
cli_mtx
);
}
...
...
bin/varnishd/cache/cache_req.c
View file @
b81e2770
...
...
@@ -256,7 +256,7 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
if
(
IS_TOPREQ
(
req
))
AZ
(
req
->
top
->
vcl0
);
req
->
director_hint
=
NULL
;
AZ
(
req
->
director_hint
)
;
req
->
restarts
=
0
;
if
(
req
->
vcl
!=
NULL
)
...
...
bin/varnishd/cache/cache_varnishd.h
View file @
b81e2770
...
...
@@ -162,7 +162,6 @@ void VCA_Shutdown(void);
/* cache_backend_cfg.c */
void
VBE_InitCfg
(
void
);
void
VBE_Poll
(
void
);
void
VBP_Init
(
void
);
...
...
bin/varnishd/cache/cache_vcl.h
View file @
b81e2770
...
...
@@ -71,7 +71,6 @@ extern struct lock vcl_mtx;
extern
struct
vcl
*
vcl_active
;
/* protected by vcl_mtx */
struct
vcl
*
vcl_find
(
const
char
*
);
void
VCL_Update
(
struct
vcl
**
,
struct
vcl
*
);
void
vcldir_free
(
struct
vcldir
*
);
struct
vcltemp
{
const
char
*
const
name
;
...
...
bin/varnishd/cache/cache_vrt_vcl.c
View file @
b81e2770
...
...
@@ -140,7 +140,7 @@ VCL_Rel(struct vcl **vcc)
/*--------------------------------------------------------------------*/
void
static
void
vcldir_free
(
struct
vcldir
*
vdir
)
{
...
...
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