summaryrefslogtreecommitdiff
path: root/ctdb/server
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-10-15 16:36:44 +1100
committerAmitay Isaacs <amitay@samba.org>2019-10-24 04:06:43 +0000
commitd462d64cdf001fd5d1cbf2a109df62e087ad0c49 (patch)
tree257fd01c1d8d5432dcf2b3048c4265c1523ef1e9 /ctdb/server
parent13cedaf0195c6bda3a3820aedb1ee65f36dfc23e (diff)
downloadsamba-d462d64cdf001fd5d1cbf2a109df62e087ad0c49.tar.gz
ctdb-vacuum: Only schedule next vacuum event if vacuuuming is scheduled
At the moment vacuuming is always scheduled. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/server')
-rw-r--r--ctdb/server/ctdb_vacuum.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c
index b21e0954cd4..8df362be233 100644
--- a/ctdb/server/ctdb_vacuum.c
+++ b/ctdb/server/ctdb_vacuum.c
@@ -54,6 +54,7 @@ struct ctdb_vacuum_child_context {
pid_t child_pid;
enum vacuum_child_status status;
struct timeval start_time;
+ bool scheduled;
};
struct ctdb_vacuum_handle {
@@ -1326,9 +1327,14 @@ static int vacuum_child_destructor(struct ctdb_vacuum_child_context *child_ctx)
ctdb->vacuumer = NULL;
- tevent_add_timer(ctdb->ev, child_ctx->vacuum_handle,
- timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
- ctdb_vacuum_event, child_ctx->vacuum_handle);
+ if (child_ctx->scheduled) {
+ tevent_add_timer(
+ ctdb->ev,
+ child_ctx->vacuum_handle,
+ timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
+ ctdb_vacuum_event,
+ child_ctx->vacuum_handle);
+ }
return 0;
}
@@ -1380,6 +1386,7 @@ static void vacuum_child_handler(struct tevent_context *ev,
*/
static int vacuum_db_child(TALLOC_CTX *mem_ctx,
struct ctdb_db_context *ctdb_db,
+ bool scheduled,
bool full_vacuum_run,
struct ctdb_vacuum_child_context **out)
{
@@ -1455,6 +1462,7 @@ static int vacuum_db_child(TALLOC_CTX *mem_ctx,
close(child_ctx->fd[1]);
child_ctx->status = VACUUM_RUNNING;
+ child_ctx->scheduled = scheduled;
child_ctx->start_time = timeval_current();
ctdb->vacuumer = child_ctx;
@@ -1517,6 +1525,7 @@ static void ctdb_vacuum_event(struct tevent_context *ev,
ret = vacuum_db_child(vacuum_handle,
ctdb_db,
+ true,
full_vacuum_run,
&child_ctx);