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
1ed2adc1
Commit
1ed2adc1
authored
Mar 23, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:varnishcache/varnish-cache
parents
30786d67
110d0732
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
10 deletions
+41
-10
mgt_vcl.c
bin/varnishd/mgt/mgt_vcl.c
+16
-10
v00044.vtc
bin/varnishtest/tests/v00044.vtc
+1
-0
vtc_varnish.c
bin/varnishtest/vtc_varnish.c
+24
-0
No files found.
bin/varnishd/mgt/mgt_vcl.c
View file @
1ed2adc1
...
...
@@ -387,28 +387,27 @@ mgt_vcl_setstate(struct cli *cli, struct vclprog *vp, const char *vs)
}
if
(
vs
==
VCL_STATE_AUTO
)
{
now
=
VTIM_mono
();
vs
=
vp
->
warm
?
VCL_STATE_WARM
:
VCL_STATE_COLD
;
vs
=
(
vp
->
warm
?
VCL_STATE_WARM
:
VCL_STATE_COLD
)
;
if
(
vp
->
go_cold
>
0
&&
vp
->
state
==
VCL_STATE_AUTO
&&
vp
->
go_cold
+
mgt_param
.
vcl_cooldown
<
now
)
vs
=
VCL_STATE_COLD
;
}
assert
(
vs
!=
VCL_STATE_AUTO
);
warm
=
vs
==
VCL_STATE_WARM
?
1
:
0
;
warm
=
(
vs
==
VCL_STATE_WARM
?
1
:
0
)
;
if
(
vp
->
warm
==
warm
)
return
(
0
);
vp
->
warm
=
warm
;
if
(
vp
->
warm
==
0
)
vp
->
go_cold
=
0
;
if
(
!
MCH_Running
())
if
(
!
MCH_Running
())
{
vp
->
warm
=
warm
;
if
(
vp
->
warm
==
0
)
vp
->
go_cold
=
0
;
return
(
0
);
}
i
=
mgt_cli_askchild
(
&
status
,
&
p
,
"vcl.state %s %d%s
\n
"
,
vp
->
name
,
vp
->
warm
,
vp
->
state
);
vp
->
name
,
warm
,
vp
->
state
);
if
(
i
&&
cli
!=
NULL
)
{
VCLI_SetResult
(
cli
,
status
);
VCLI_Out
(
cli
,
"%s"
,
p
);
...
...
@@ -416,8 +415,15 @@ mgt_vcl_setstate(struct cli *cli, struct vclprog *vp, const char *vs)
MGT_Complain
(
C_ERR
,
"Please file ticket: VCL poker problem: "
"'vcl.state %s %d%s' -> %03d '%s'"
,
vp
->
name
,
vp
->
warm
,
vp
->
state
,
i
,
p
);
vp
->
name
,
warm
,
vp
->
state
,
i
,
p
);
}
else
{
/* Success, update mgt's VCL state to reflect child's
state */
vp
->
warm
=
warm
;
if
(
vp
->
warm
==
0
)
vp
->
go_cold
=
0
;
}
free
(
p
);
return
(
i
);
}
...
...
bin/varnishtest/tests/v00044.vtc
View file @
1ed2adc1
...
...
@@ -90,4 +90,5 @@ varnish v1 -clierr 300 "vcl.state vcl1 warm"
# A warm-up failure can also fail a child start
varnish v1 -cliok stop
varnish v1 -cliok "vcl.state vcl1 warm"
varnish v1 -clierr 300 start
bin/varnishtest/vtc_varnish.c
View file @
1ed2adc1
...
...
@@ -82,6 +82,7 @@ struct varnish {
unsigned
vsl_tag_count
[
256
];
volatile
int
vsl_rec
;
volatile
int
vsl_idle
;
};
#define NONSENSE "%XJEIFLH|)Xspa8P"
...
...
@@ -182,6 +183,16 @@ wait_running(const struct varnish *v)
* Varnishlog gatherer thread
*/
static
void
vsl_catchup
(
const
struct
varnish
*
v
)
{
int
vsl_idle
;
vsl_idle
=
v
->
vsl_idle
;
while
(
vsl_idle
==
v
->
vsl_idle
)
VTIM_sleep
(
0
.
1
);
}
static
void
*
varnishlog_thread
(
void
*
priv
)
{
...
...
@@ -209,11 +220,15 @@ varnishlog_thread(void *priv)
if
(
c
==
NULL
)
{
VTIM_sleep
(
0
.
1
);
if
(
VSM_Open
(
vsm
))
{
vtc_log
(
v
->
vl
,
3
,
"vsm|%s"
,
VSM_Error
(
vsm
));
VSM_ResetError
(
vsm
);
continue
;
}
c
=
VSL_CursorVSM
(
vsl
,
vsm
,
opt
);
if
(
c
==
NULL
)
{
vtc_log
(
v
->
vl
,
3
,
"vsl|%s"
,
VSL_Error
(
vsl
));
VSL_ResetError
(
vsl
);
continue
;
}
...
...
@@ -245,6 +260,7 @@ varnishlog_thread(void *priv)
}
if
(
i
==
0
)
{
/* Nothing to do but wait */
v
->
vsl_idle
++
;
VTIM_sleep
(
0
.
1
);
}
else
if
(
i
==
-
2
)
{
/* Abandoned - try reconnect */
...
...
@@ -1050,6 +1066,10 @@ varnish_expect(const struct varnish *v, char * const *av)
* style pattern (ie: fnmatch(3)) as used in shell filename expansion.
* To see all counters use pattern "*", to see all counters about
* requests use "*req*".
*
* \-vsl_catchup
* Wait until the logging thread has idled to make sure that all
* the generated log is flushed
*/
void
...
...
@@ -1205,6 +1225,10 @@ cmd_varnish(CMD_ARGS)
varnish_wait
(
v
);
continue
;
}
if
(
!
strcmp
(
*
av
,
"-vsl_catchup"
))
{
vsl_catchup
(
v
);
continue
;
}
vtc_fatal
(
v
->
vl
,
"Unknown varnish argument: %s"
,
*
av
);
}
}
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