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
Show 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)
...
@@ -387,28 +387,27 @@ mgt_vcl_setstate(struct cli *cli, struct vclprog *vp, const char *vs)
}
}
if
(
vs
==
VCL_STATE_AUTO
)
{
if
(
vs
==
VCL_STATE_AUTO
)
{
now
=
VTIM_mono
();
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
&&
if
(
vp
->
go_cold
>
0
&&
vp
->
state
==
VCL_STATE_AUTO
&&
vp
->
go_cold
+
mgt_param
.
vcl_cooldown
<
now
)
vp
->
go_cold
+
mgt_param
.
vcl_cooldown
<
now
)
vs
=
VCL_STATE_COLD
;
vs
=
VCL_STATE_COLD
;
}
}
assert
(
vs
!=
VCL_STATE_AUTO
);
assert
(
vs
!=
VCL_STATE_AUTO
);
warm
=
vs
==
VCL_STATE_WARM
?
1
:
0
;
warm
=
(
vs
==
VCL_STATE_WARM
?
1
:
0
)
;
if
(
vp
->
warm
==
warm
)
if
(
vp
->
warm
==
warm
)
return
(
0
);
return
(
0
);
if
(
!
MCH_Running
())
{
vp
->
warm
=
warm
;
vp
->
warm
=
warm
;
if
(
vp
->
warm
==
0
)
if
(
vp
->
warm
==
0
)
vp
->
go_cold
=
0
;
vp
->
go_cold
=
0
;
if
(
!
MCH_Running
())
return
(
0
);
return
(
0
);
}
i
=
mgt_cli_askchild
(
&
status
,
&
p
,
"vcl.state %s %d%s
\n
"
,
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
)
{
if
(
i
&&
cli
!=
NULL
)
{
VCLI_SetResult
(
cli
,
status
);
VCLI_SetResult
(
cli
,
status
);
VCLI_Out
(
cli
,
"%s"
,
p
);
VCLI_Out
(
cli
,
"%s"
,
p
);
...
@@ -416,8 +415,15 @@ mgt_vcl_setstate(struct cli *cli, struct vclprog *vp, const char *vs)
...
@@ -416,8 +415,15 @@ mgt_vcl_setstate(struct cli *cli, struct vclprog *vp, const char *vs)
MGT_Complain
(
C_ERR
,
MGT_Complain
(
C_ERR
,
"Please file ticket: VCL poker problem: "
"Please file ticket: VCL poker problem: "
"'vcl.state %s %d%s' -> %03d '%s'"
,
"'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
);
free
(
p
);
return
(
i
);
return
(
i
);
}
}
...
...
bin/varnishtest/tests/v00044.vtc
View file @
1ed2adc1
...
@@ -90,4 +90,5 @@ varnish v1 -clierr 300 "vcl.state vcl1 warm"
...
@@ -90,4 +90,5 @@ varnish v1 -clierr 300 "vcl.state vcl1 warm"
# A warm-up failure can also fail a child start
# A warm-up failure can also fail a child start
varnish v1 -cliok stop
varnish v1 -cliok stop
varnish v1 -cliok "vcl.state vcl1 warm"
varnish v1 -clierr 300 start
varnish v1 -clierr 300 start
bin/varnishtest/vtc_varnish.c
View file @
1ed2adc1
...
@@ -82,6 +82,7 @@ struct varnish {
...
@@ -82,6 +82,7 @@ struct varnish {
unsigned
vsl_tag_count
[
256
];
unsigned
vsl_tag_count
[
256
];
volatile
int
vsl_rec
;
volatile
int
vsl_rec
;
volatile
int
vsl_idle
;
};
};
#define NONSENSE "%XJEIFLH|)Xspa8P"
#define NONSENSE "%XJEIFLH|)Xspa8P"
...
@@ -182,6 +183,16 @@ wait_running(const struct varnish *v)
...
@@ -182,6 +183,16 @@ wait_running(const struct varnish *v)
* Varnishlog gatherer thread
* 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
*
static
void
*
varnishlog_thread
(
void
*
priv
)
varnishlog_thread
(
void
*
priv
)
{
{
...
@@ -209,11 +220,15 @@ varnishlog_thread(void *priv)
...
@@ -209,11 +220,15 @@ varnishlog_thread(void *priv)
if
(
c
==
NULL
)
{
if
(
c
==
NULL
)
{
VTIM_sleep
(
0
.
1
);
VTIM_sleep
(
0
.
1
);
if
(
VSM_Open
(
vsm
))
{
if
(
VSM_Open
(
vsm
))
{
vtc_log
(
v
->
vl
,
3
,
"vsm|%s"
,
VSM_Error
(
vsm
));
VSM_ResetError
(
vsm
);
VSM_ResetError
(
vsm
);
continue
;
continue
;
}
}
c
=
VSL_CursorVSM
(
vsl
,
vsm
,
opt
);
c
=
VSL_CursorVSM
(
vsl
,
vsm
,
opt
);
if
(
c
==
NULL
)
{
if
(
c
==
NULL
)
{
vtc_log
(
v
->
vl
,
3
,
"vsl|%s"
,
VSL_Error
(
vsl
));
VSL_ResetError
(
vsl
);
VSL_ResetError
(
vsl
);
continue
;
continue
;
}
}
...
@@ -245,6 +260,7 @@ varnishlog_thread(void *priv)
...
@@ -245,6 +260,7 @@ varnishlog_thread(void *priv)
}
}
if
(
i
==
0
)
{
if
(
i
==
0
)
{
/* Nothing to do but wait */
/* Nothing to do but wait */
v
->
vsl_idle
++
;
VTIM_sleep
(
0
.
1
);
VTIM_sleep
(
0
.
1
);
}
else
if
(
i
==
-
2
)
{
}
else
if
(
i
==
-
2
)
{
/* Abandoned - try reconnect */
/* Abandoned - try reconnect */
...
@@ -1050,6 +1066,10 @@ varnish_expect(const struct varnish *v, char * const *av)
...
@@ -1050,6 +1066,10 @@ varnish_expect(const struct varnish *v, char * const *av)
* style pattern (ie: fnmatch(3)) as used in shell filename expansion.
* style pattern (ie: fnmatch(3)) as used in shell filename expansion.
* To see all counters use pattern "*", to see all counters about
* To see all counters use pattern "*", to see all counters about
* requests use "*req*".
* requests use "*req*".
*
* \-vsl_catchup
* Wait until the logging thread has idled to make sure that all
* the generated log is flushed
*/
*/
void
void
...
@@ -1205,6 +1225,10 @@ cmd_varnish(CMD_ARGS)
...
@@ -1205,6 +1225,10 @@ cmd_varnish(CMD_ARGS)
varnish_wait
(
v
);
varnish_wait
(
v
);
continue
;
continue
;
}
}
if
(
!
strcmp
(
*
av
,
"-vsl_catchup"
))
{
vsl_catchup
(
v
);
continue
;
}
vtc_fatal
(
v
->
vl
,
"Unknown varnish argument: %s"
,
*
av
);
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