Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-vslp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-vslp
Commits
f637f06a
Commit
f637f06a
authored
Sep 12, 2016
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
varnish now has event workspace, use it. Fail gracefully for out-of-workspace
parent
3b72a3bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
37 deletions
+17
-37
shard_cfg.c
src/shard_cfg.c
+17
-37
No files found.
src/shard_cfg.c
View file @
f637f06a
...
@@ -61,7 +61,6 @@ struct shard_change {
...
@@ -61,7 +61,6 @@ struct shard_change {
#define SHARD_CHANGE_MAGIC 0xdff5c9a6
#define SHARD_CHANGE_MAGIC 0xdff5c9a6
const
struct
sharddir
*
shardd
;
const
struct
sharddir
*
shardd
;
void
*
space
;
void
*
space
;
struct
ws
*
ws
;
VSTAILQ_HEAD
(,
shard_change_task
)
tasks
;
VSTAILQ_HEAD
(,
shard_change_task
)
tasks
;
};
};
...
@@ -82,15 +81,6 @@ struct backend_reconfig {
...
@@ -82,15 +81,6 @@ struct backend_reconfig {
* for now, we allow to only reconfigure one shard director at a time.
* for now, we allow to only reconfigure one shard director at a time.
*/
*/
static
void
shard_change_free_ws
(
void
*
priv
)
{
struct
shard_change
*
f
;
CAST_OBJ_NOTNULL
(
f
,
priv
,
SHARD_CHANGE_MAGIC
);
AN
(
f
->
space
);
free
(
f
->
space
);
}
static
struct
shard_change
*
static
struct
shard_change
*
shard_change_get
(
VRT_CTX
,
struct
vmod_priv
*
priv
,
shard_change_get
(
VRT_CTX
,
struct
vmod_priv
*
priv
,
const
struct
sharddir
*
const
shardd
)
const
struct
sharddir
*
const
shardd
)
...
@@ -111,28 +101,14 @@ shard_change_get(VRT_CTX, struct vmod_priv *priv,
...
@@ -111,28 +101,14 @@ shard_change_get(VRT_CTX, struct vmod_priv *priv,
return
(
change
);
return
(
change
);
}
}
if
(
ctx
->
ws
)
{
change
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
change
));
change
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
change
));
if
(
change
==
NULL
)
{
AN
(
change
);
shard_err0
(
ctx
,
shardd
,
"could not get workspace"
);
INIT_OBJ
(
change
,
SHARD_CHANGE_MAGIC
);
return
NULL
;
change
->
space
=
NULL
;
change
->
ws
=
ctx
->
ws
;
}
else
{
// XXX should be default in core #2063
struct
ws
*
ws
;
char
*
space
=
malloc
(
cache_param
->
workspace_client
);
AN
(
space
);
ws
=
(
void
*
)
space
;
WS_Init
(
ws
,
"shd"
,
space
+
sizeof
(
*
ws
),
cache_param
->
workspace_client
-
sizeof
(
*
ws
));
change
=
WS_Alloc
(
ws
,
sizeof
(
*
change
));
AN
(
change
);
INIT_OBJ
(
change
,
SHARD_CHANGE_MAGIC
);
change
->
space
=
space
;
change
->
ws
=
ws
;
priv
->
free
=
shard_change_free_ws
;
}
}
INIT_OBJ
(
change
,
SHARD_CHANGE_MAGIC
);
change
->
space
=
NULL
;
change
->
shardd
=
shardd
;
change
->
shardd
=
shardd
;
VSTAILQ_INIT
(
&
change
->
tasks
);
VSTAILQ_INIT
(
&
change
->
tasks
);
priv
->
priv
=
change
;
priv
->
priv
=
change
;
...
@@ -150,15 +126,19 @@ shard_change_finish(struct shard_change *change)
...
@@ -150,15 +126,19 @@ shard_change_finish(struct shard_change *change)
}
}
static
void
static
void
shard_change_task_add
(
struct
shard_change
*
change
,
shard_change_task_add
(
VRT_CTX
,
struct
shard_change
*
change
,
enum
shard_change_task_e
task_e
,
void
*
priv
)
enum
shard_change_task_e
task_e
,
void
*
priv
)
{
{
struct
shard_change_task
*
task
;
struct
shard_change_task
*
task
;
CHECK_OBJ_NOTNULL
(
change
,
SHARD_CHANGE_MAGIC
);
CHECK_OBJ_NOTNULL
(
change
,
SHARD_CHANGE_MAGIC
);
task
=
WS_Alloc
(
change
->
ws
,
sizeof
(
*
task
));
task
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
task
));
AN
(
task
);
if
(
task
==
NULL
)
{
shard_err0
(
ctx
,
change
->
shardd
,
"could not get workspace for task"
);
return
;
}
INIT_OBJ
(
task
,
SHARD_CHANGE_TASK_MAGIC
);
INIT_OBJ
(
task
,
SHARD_CHANGE_TASK_MAGIC
);
task
->
task
=
task_e
;
task
->
task
=
task_e
;
task
->
priv
=
priv
;
task
->
priv
=
priv
;
...
@@ -181,7 +161,7 @@ shard_change_task_backend(VRT_CTX,
...
@@ -181,7 +161,7 @@ shard_change_task_backend(VRT_CTX,
if
(
change
==
NULL
)
if
(
change
==
NULL
)
return
0
;
return
0
;
b
=
WS_Alloc
(
c
hange
->
ws
,
sizeof
(
*
b
));
b
=
WS_Alloc
(
c
tx
->
ws
,
sizeof
(
*
b
));
if
(
b
==
NULL
)
{
if
(
b
==
NULL
)
{
shard_err
(
ctx
,
shardd
,
".%s_backend() WS_Alloc() failed"
,
shard_err
(
ctx
,
shardd
,
".%s_backend() WS_Alloc() failed"
,
task_e
==
ADD_BE
?
"add"
:
"remove"
);
task_e
==
ADD_BE
?
"add"
:
"remove"
);
...
@@ -192,7 +172,7 @@ shard_change_task_backend(VRT_CTX,
...
@@ -192,7 +172,7 @@ shard_change_task_backend(VRT_CTX,
b
->
ident
=
ident
!=
NULL
&&
*
ident
!=
'\0'
?
ident
:
NULL
;
b
->
ident
=
ident
!=
NULL
&&
*
ident
!=
'\0'
?
ident
:
NULL
;
b
->
rampup
=
rampup
;
b
->
rampup
=
rampup
;
shard_change_task_add
(
change
,
task_e
,
b
);
shard_change_task_add
(
c
tx
,
c
hange
,
task_e
,
b
);
return
1
;
return
1
;
}
}
...
@@ -229,7 +209,7 @@ shardcfg_clear(VRT_CTX, struct vmod_priv *priv, struct sharddir *shardd)
...
@@ -229,7 +209,7 @@ shardcfg_clear(VRT_CTX, struct vmod_priv *priv, struct sharddir *shardd)
if
(
change
==
NULL
)
if
(
change
==
NULL
)
return
0
;
return
0
;
shard_change_task_add
(
change
,
CLEAR
,
NULL
);
shard_change_task_add
(
c
tx
,
c
hange
,
CLEAR
,
NULL
);
return
1
;
return
1
;
}
}
...
...
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