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
4c4d6f65
Commit
4c4d6f65
authored
Jul 02, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that all sessions, requests and busyobj's have a
unique transaction id 'vxid'
parent
27d63c26
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
11 deletions
+18
-11
cache.h
bin/varnishd/cache/cache.h
+5
-4
cache_acceptor.c
bin/varnishd/cache/cache_acceptor.c
+0
-2
cache_busyobj.c
bin/varnishd/cache/cache_busyobj.c
+1
-0
cache_center.c
bin/varnishd/cache/cache_center.c
+1
-0
cache_main.c
bin/varnishd/cache/cache_main.c
+4
-2
cache_pool.c
bin/varnishd/cache/cache_pool.c
+0
-3
cache_session.c
bin/varnishd/cache/cache_session.c
+7
-0
No files found.
bin/varnishd/cache/cache.h
View file @
4c4d6f65
...
...
@@ -259,7 +259,7 @@ struct vsl_log {
/*--------------------------------------------------------------------*/
struct
vxid
{
struct
vxid
_pool
{
uint32_t
next
;
uint32_t
count
;
};
...
...
@@ -275,7 +275,6 @@ struct wrk_accept {
socklen_t
acceptaddrlen
;
int
acceptsock
;
struct
listen_sock
*
acceptlsock
;
uint32_t
vxid
;
};
/* Worker pool stuff -------------------------------------------------*/
...
...
@@ -319,6 +318,7 @@ struct worker {
struct
ws
aws
[
1
];
struct
vxid_pool
vxid_pool
;
/* Temporary accounting */
struct
acct
acct_tmp
;
...
...
@@ -472,6 +472,7 @@ struct busyobj {
* is recycled.
*/
unsigned
refcount
;
uint32_t
vxid
;
uint8_t
*
vary
;
unsigned
is_gzip
;
...
...
@@ -560,6 +561,7 @@ struct req {
unsigned
magic
;
#define REQ_MAGIC 0x2751aaa1
uint32_t
vxid
;
unsigned
xid
;
int
restarts
;
int
esi_level
;
...
...
@@ -655,7 +657,6 @@ struct sess {
int
fd
;
unsigned
vsl_id
;
uint32_t
vxid
;
uint32_t
vseq
;
/* Cross references ------------------------------------------*/
...
...
@@ -857,7 +858,7 @@ int HTC_Complete(struct http_conn *htc);
#undef HTTPH
/* cache_main.c */
uint32_t
VXID_Get
(
struct
vxid
*
v
);
uint32_t
VXID_Get
(
struct
vxid
_pool
*
v
);
extern
volatile
struct
params
*
cache_param
;
void
THR_SetName
(
const
char
*
name
);
const
char
*
THR_GetName
(
void
);
...
...
bin/varnishd/cache/cache_acceptor.c
View file @
4c4d6f65
...
...
@@ -248,8 +248,6 @@ VCA_SetupSess(struct worker *wrk, struct sess *sp)
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CAST_OBJ_NOTNULL
(
wa
,
(
void
*
)
wrk
->
aws
->
f
,
WRK_ACCEPT_MAGIC
);
sp
->
vxid
=
wa
->
vxid
;
sp
->
vseq
=
0
;
sp
->
fd
=
wa
->
acceptsock
;
sp
->
vsl_id
=
wa
->
acceptsock
|
VSL_CLIENTMARKER
;
wa
->
acceptsock
=
-
1
;
...
...
bin/varnishd/cache/cache_busyobj.c
View file @
4c4d6f65
...
...
@@ -108,6 +108,7 @@ VBO_GetBusyObj(struct worker *wrk)
AZ
(
bo
->
refcount
);
bo
->
refcount
=
1
;
bo
->
vxid
=
VXID_Get
(
&
wrk
->
vxid_pool
);
p
=
(
void
*
)(
bo
+
1
);
p
=
(
void
*
)
PRNDUP
(
p
);
...
...
bin/varnishd/cache/cache_center.c
View file @
4c4d6f65
...
...
@@ -277,6 +277,7 @@ cnt_sess_done(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
);
i
=
HTC_Reinit
(
req
->
htc
);
if
(
i
==
1
)
{
...
...
bin/varnishd/cache/cache_main.c
View file @
4c4d6f65
...
...
@@ -85,13 +85,15 @@ THR_GetName(void)
}
/*--------------------------------------------------------------------
* VXID's are unique transaction numbers allocated with a minimum of
* locking overhead via pools in the worker threads.
*/
static
uint32_t
vxid_base
;
static
struct
lock
vxid_lock
;
static
void
vxid_More
(
struct
vxid
*
v
)
vxid_More
(
struct
vxid
_pool
*
v
)
{
Lck_Lock
(
&
vxid_lock
);
...
...
@@ -102,7 +104,7 @@ vxid_More(struct vxid *v)
}
uint32_t
VXID_Get
(
struct
vxid
*
v
)
VXID_Get
(
struct
vxid
_pool
*
v
)
{
if
(
v
->
count
==
0
)
vxid_More
(
v
);
...
...
bin/varnishd/cache/cache_pool.c
View file @
4c4d6f65
...
...
@@ -62,8 +62,6 @@ struct pool {
pthread_cond_t
herder_cond
;
pthread_t
herder_thr
;
struct
vxid
vxid
;
struct
lock
mtx
;
struct
taskhead
idle_queue
;
struct
taskhead
front_queue
;
...
...
@@ -148,7 +146,6 @@ pool_accept(struct worker *wrk, void *arg)
}
Lck_Lock
(
&
pp
->
mtx
);
wa
->
vxid
=
VXID_Get
(
&
pp
->
vxid
);
wrk2
=
pool_getidleworker
(
pp
);
if
(
wrk2
==
NULL
)
{
/* No idle threads, do it ourselves */
...
...
bin/varnishd/cache/cache_session.c
View file @
4c4d6f65
...
...
@@ -207,12 +207,15 @@ SES_pool_accept_task(struct worker *wrk, void *arg)
sp
->
t_open
=
VTIM_real
();
sp
->
t_rx
=
sp
->
t_open
;
sp
->
t_idle
=
sp
->
t_open
;
sp
->
vxid
=
VXID_Get
(
&
wrk
->
vxid_pool
);
lsockname
=
VCA_SetupSess
(
wrk
,
sp
);
req
=
ses_GetReq
(
sp
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
req
->
vxid
=
VXID_Get
(
&
wrk
->
vxid_pool
);
ses_vsl_socket
(
req
,
lsockname
);
wrk
->
acct_tmp
.
sess
++
;
...
...
@@ -262,12 +265,16 @@ SES_Handle(struct sess *sp, double now)
struct
req
*
req
;
struct
sesspool
*
pp
;
/* NB: This only works with single-threaded waiters */
static
struct
vxid_pool
vxid_pool
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
pp
=
sp
->
sesspool
;
CHECK_OBJ_NOTNULL
(
pp
,
SESSPOOL_MAGIC
);
AN
(
pp
->
pool
);
req
=
ses_GetReq
(
sp
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
req
->
vxid
=
VXID_Get
(
&
vxid_pool
);
sp
->
task
.
func
=
ses_pool_task
;
sp
->
task
.
priv
=
req
;
sp
->
sess_step
=
S_STP_NEWREQ
;
...
...
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