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
4830d6b9
Commit
4830d6b9
authored
Oct 03, 2013
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make transaction limit and timeout into cmd line options
parent
5e251abf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
6 deletions
+50
-6
varnishlog_options.h
bin/varnishlog/varnishlog_options.h
+2
-0
vapi_options.h
include/vapi/vapi_options.h
+18
-0
vsl.c
lib/libvarnishapi/vsl.c
+2
-0
vsl_api.h
lib/libvarnishapi/vsl_api.h
+2
-0
vsl_arg.c
lib/libvarnishapi/vsl_arg.c
+24
-0
vsl_dispatch.c
lib/libvarnishapi/vsl_dispatch.c
+2
-6
No files found.
bin/varnishlog/varnishlog_options.h
View file @
4830d6b9
...
...
@@ -38,11 +38,13 @@ VUT_OPT_D
VSL_OPT_g
VSL_OPT_i
VSL_OPT_I
VSL_OPT_L
VSM_OPT_n
VSM_OPT_N
VUT_OPT_P
VUT_OPT_q
VSL_OPT_r
VSL_OPT_T
VSL_OPT_u
VSL_OPT_v
VSL_OPT_w
...
...
include/vapi/vapi_options.h
View file @
4830d6b9
...
...
@@ -95,11 +95,29 @@
VSL_iI_PS \
)
#define VSL_OPT_L \
VOPT("L:", "[-L limit]", "Incomplete transaction limit", \
"Sets the upper limit of incomplete transactions kept" \
" before the oldest transaction is force completed. A" \
" warning record is synthesized when this happens. This" \
" setting keeps an upper bound on the memory usage of" \
" running queries. Defaults to 1000 transactions." \
)
#define VSL_OPT_r \
VOPT("r:", "[-r filename]", "Binary file input", \
"Read log in binary file format from this file." \
)
#define VSL_OPT_T \
VOPT("T:", "[-T seconds]", "Transaction end timeout", \
"Sets the transaction timeout in seconds. This defines the" \
" maximum number of seconds elapsed between a Begin tag" \
" and the End tag. If the timeout expires, a warning" \
" record is synthesized and the transaction is force" \
" completed. Defaults to 120 seconds." \
)
#define VSL_OPT_u \
VOPT("u", "[-u]", "Binary file output unbuffered", \
"Unbuffered binary file output mode." \
...
...
lib/libvarnishapi/vsl.c
View file @
4830d6b9
...
...
@@ -91,6 +91,8 @@ VSL_New(void)
if
(
vsl
==
NULL
)
return
(
NULL
);
vsl
->
L_opt
=
1000
;
vsl
->
T_opt
=
120
.;
vsl
->
vbm_select
=
vbit_init
(
SLT__MAX
);
vsl
->
vbm_supress
=
vbit_init
(
SLT__MAX
);
VTAILQ_INIT
(
&
vsl
->
vslf_select
);
...
...
lib/libvarnishapi/vsl_api.h
View file @
4830d6b9
...
...
@@ -90,6 +90,8 @@ struct VSL_data {
int
b_opt
;
int
c_opt
;
int
L_opt
;
double
T_opt
;
int
v_opt
;
};
...
...
lib/libvarnishapi/vsl_arg.c
View file @
4830d6b9
...
...
@@ -41,6 +41,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include "miniobj.h"
#include "vas.h"
...
...
@@ -312,6 +313,9 @@ int
VSL_Arg
(
struct
VSL_data
*
vsl
,
int
opt
,
const
char
*
arg
)
{
int
i
;
char
*
p
;
double
d
;
long
l
;
CHECK_OBJ_NOTNULL
(
vsl
,
VSL_MAGIC
);
/* If first option is 'i', set all bits for supression */
...
...
@@ -324,6 +328,26 @@ VSL_Arg(struct VSL_data *vsl, int opt, const char *arg)
case
'c'
:
vsl
->
c_opt
=
1
;
return
(
1
);
case
'i'
:
case
'x'
:
return
(
vsl_ix_arg
(
vsl
,
opt
,
arg
));
case
'I'
:
case
'X'
:
return
(
vsl_IX_arg
(
vsl
,
opt
,
arg
));
case
'L'
:
l
=
strtol
(
arg
,
&
p
,
0
);
while
(
isspace
(
*
p
))
p
++
;
if
(
*
p
!=
'\0'
)
return
(
vsl_diag
(
vsl
,
"-L: Syntax error"
));
if
(
l
<
0
||
l
>
INT_MAX
)
return
(
vsl_diag
(
vsl
,
"-L: Range error"
));
vsl
->
L_opt
=
(
int
)
l
;
return
(
1
);
case
'T'
:
d
=
strtod
(
arg
,
&
p
);
while
(
isspace
(
*
p
))
p
++
;
if
(
*
p
!=
'\0'
)
return
(
vsl_diag
(
vsl
,
"-P: Syntax error"
));
if
(
d
<
0
.)
return
(
vsl_diag
(
vsl
,
"-L: Range error"
));
vsl
->
T_opt
=
d
;
return
(
1
);
case
'v'
:
vsl
->
v_opt
=
1
;
return
(
1
);
default:
return
(
0
);
...
...
lib/libvarnishapi/vsl_dispatch.c
View file @
4830d6b9
...
...
@@ -1009,9 +1009,7 @@ VSLQ_Dispatch(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv)
now
=
VTIM_mono
();
while
((
vtx
=
VTAILQ_FIRST
(
&
vslq
->
incomplete
))
&&
now
-
vtx
->
t_start
>
120
.)
{
/* XXX: Make timeout configurable through options and
provide a sane default */
now
-
vtx
->
t_start
>
vslq
->
vsl
->
T_opt
)
{
AZ
(
vtx
->
flags
&
VTX_F_COMPLETE
);
vtx
=
vtx_force
(
vslq
,
vtx
,
"incomplete - timeout"
);
if
(
vtx
)
{
...
...
@@ -1026,9 +1024,7 @@ VSLQ_Dispatch(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv)
if
(
i
)
return
(
i
);
while
(
vslq
->
n_incomplete
>
1000
)
{
/* XXX: Make limit configurable through options and
provide a sane default */
while
(
vslq
->
n_incomplete
>
vslq
->
vsl
->
L_opt
)
{
vtx
=
VTAILQ_FIRST
(
&
vslq
->
incomplete
);
AN
(
vtx
);
AZ
(
vtx
->
flags
&
VTX_F_COMPLETE
);
...
...
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