[SCM] Samba Shared Repository - branch master updated
Amitay Isaacs
amitay at samba.org
Tue Apr 7 03:05:05 UTC 2020
The branch, master has been updated
via f8f3d7954da ctdb-vacuum: Reschedule vacuum event if VacuumInterval has increased
via 5d03a3c86eb ctdb-vacuum: Store value of VacuumInterval in ctdb_vacuum_handle
via 7ad7c0b9324 ctdb-vacuum: Use vacuum_handle local variables
from c4be195da28 testprogs: Add 'net ads join createupn' test also verifying the keytab
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f8f3d7954da679c225f5f5a1f1baff0b06c88341
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Apr 2 14:42:21 2020 +1100
ctdb-vacuum: Reschedule vacuum event if VacuumInterval has increased
The vacuuming integration tests set VacuumInterval to a very high
number to avoid vacuuming collisions. This is done after the cluster
is healthy, so Samba will have already been started and vacuuming will
already be scheduled *at the default interval* for databases attached
by Samba. This means that vacuuming controls used by vacuuming tests
can still collide with the scheduled vacuuming events.
Add some logic to reschedule a vacuuming event that has fired but
where VacuumInterval has increased since it was originally scheduled.
The increase in VacuumInterval is used as the time offset for
rescheduling the event.
Although this changes production behaviour for the convenience of
testing, the new behaviour is completely reasonable and obeys the
principle of least surprise.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Tue Apr 7 03:04:57 UTC 2020 on sn-devel-184
commit 5d03a3c86ebe52832584737deb5e9dff7ccb5916
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Mar 27 14:38:09 2020 +1100
ctdb-vacuum: Store value of VacuumInterval in ctdb_vacuum_handle
No behaviour change. This is final staging to make the next change
completely obvious.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 7ad7c0b9324c30b32e972df4cbff229e380d71f1
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Apr 2 14:18:33 2020 +1100
ctdb-vacuum: Use vacuum_handle local variables
No behaviour change. This just makes future changes clearer by
avoiding reformatting (or introducing local variables).
Clean up error handling while touching a relevant line.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
-----------------------------------------------------------------------
Summary of changes:
ctdb/server/ctdb_vacuum.c | 59 ++++++++++++++++++++++++++++++++++++-----------
1 file changed, 46 insertions(+), 13 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c
index 5351a3c5175..74d7215bbe8 100644
--- a/ctdb/server/ctdb_vacuum.c
+++ b/ctdb/server/ctdb_vacuum.c
@@ -62,6 +62,7 @@ struct ctdb_vacuum_child_context {
struct ctdb_vacuum_handle {
struct ctdb_db_context *ctdb_db;
uint32_t fast_path_count;
+ uint32_t vacuum_interval;
};
@@ -1314,7 +1315,8 @@ static uint32_t get_vacuum_interval(struct ctdb_db_context *ctdb_db)
static int vacuum_child_destructor(struct ctdb_vacuum_child_context *child_ctx)
{
double l = timeval_elapsed(&child_ctx->start_time);
- struct ctdb_db_context *ctdb_db = child_ctx->vacuum_handle->ctdb_db;
+ struct ctdb_vacuum_handle *vacuum_handle = child_ctx->vacuum_handle;
+ struct ctdb_db_context *ctdb_db = vacuum_handle->ctdb_db;
struct ctdb_context *ctdb = ctdb_db->ctdb;
CTDB_UPDATE_DB_LATENCY(ctdb_db, "vacuum", vacuum.latency, l);
@@ -1324,18 +1326,20 @@ static int vacuum_child_destructor(struct ctdb_vacuum_child_context *child_ctx)
ctdb_kill(ctdb, child_ctx->child_pid, SIGKILL);
} else {
/* Bump the number of successful fast-path runs. */
- child_ctx->vacuum_handle->fast_path_count++;
+ vacuum_handle->fast_path_count++;
}
ctdb->vacuumer = NULL;
if (child_ctx->scheduled) {
+ vacuum_handle->vacuum_interval = get_vacuum_interval(ctdb_db);
+
tevent_add_timer(
ctdb->ev,
- child_ctx->vacuum_handle,
- timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
+ vacuum_handle,
+ timeval_current_ofs(vacuum_handle->vacuum_interval, 0),
ctdb_vacuum_event,
- child_ctx->vacuum_handle);
+ vacuum_handle);
}
return 0;
@@ -1515,9 +1519,28 @@ static void ctdb_vacuum_event(struct tevent_context *ev,
struct ctdb_context *ctdb = ctdb_db->ctdb;
struct ctdb_vacuum_child_context *child_ctx = NULL;
uint32_t fast_path_max = ctdb->tunable.vacuum_fast_path_count;
+ uint32_t vacuum_interval = get_vacuum_interval(ctdb_db);
bool full_vacuum_run = false;
int ret;
+ if (vacuum_interval > vacuum_handle->vacuum_interval) {
+ uint32_t d = vacuum_interval - vacuum_handle->vacuum_interval;
+
+ DBG_INFO("Vacuum interval increased from "
+ "%"PRIu32" to %"PRIu32", rescheduling\n",
+ vacuum_handle->vacuum_interval,
+ vacuum_interval);
+ vacuum_handle->vacuum_interval = vacuum_interval;
+ tevent_add_timer(ctdb->ev,
+ vacuum_handle,
+ timeval_current_ofs(d, 0),
+ ctdb_vacuum_event,
+ vacuum_handle);
+ return;
+ }
+
+ vacuum_handle->vacuum_interval = vacuum_interval;
+
if (vacuum_handle->fast_path_count >= fast_path_max) {
if (fast_path_max > 0) {
full_vacuum_run = true;
@@ -1550,7 +1573,7 @@ static void ctdb_vacuum_event(struct tevent_context *ev,
tevent_add_timer(ctdb->ev,
vacuum_handle,
timeval_current_ofs(
- get_vacuum_interval(ctdb_db), 0),
+ vacuum_handle->vacuum_interval, 0),
ctdb_vacuum_event,
vacuum_handle);
}
@@ -1660,6 +1683,8 @@ void ctdb_stop_vacuuming(struct ctdb_context *ctdb)
*/
int ctdb_vacuum_init(struct ctdb_db_context *ctdb_db)
{
+ struct ctdb_vacuum_handle *vacuum_handle;
+
if (! ctdb_db_volatile(ctdb_db)) {
DEBUG(DEBUG_ERR,
("Vacuuming is disabled for non-volatile database %s\n",
@@ -1667,15 +1692,23 @@ int ctdb_vacuum_init(struct ctdb_db_context *ctdb_db)
return 0;
}
- ctdb_db->vacuum_handle = talloc(ctdb_db, struct ctdb_vacuum_handle);
- CTDB_NO_MEMORY(ctdb_db->ctdb, ctdb_db->vacuum_handle);
+ vacuum_handle = talloc(ctdb_db, struct ctdb_vacuum_handle);
+ if (vacuum_handle == NULL) {
+ DBG_ERR("Memory allocation error\n");
+ return -1;
+ }
+
+ vacuum_handle->ctdb_db = ctdb_db;
+ vacuum_handle->fast_path_count = 0;
+ vacuum_handle->vacuum_interval = get_vacuum_interval(ctdb_db);
- ctdb_db->vacuum_handle->ctdb_db = ctdb_db;
- ctdb_db->vacuum_handle->fast_path_count = 0;
+ ctdb_db->vacuum_handle = vacuum_handle;
- tevent_add_timer(ctdb_db->ctdb->ev, ctdb_db->vacuum_handle,
- timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
- ctdb_vacuum_event, ctdb_db->vacuum_handle);
+ tevent_add_timer(ctdb_db->ctdb->ev,
+ vacuum_handle,
+ timeval_current_ofs(vacuum_handle->vacuum_interval, 0),
+ ctdb_vacuum_event,
+ vacuum_handle);
return 0;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list