From 19e515aac7a6e5ce85cfd6905a1cc773277047a9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 6 Jan 2010 14:54:12 +1100 Subject: s4-repl: added request for RID allocation in drepl task The drepl task now checks to see if our rIDAllocationPool is exhausted, and if it is then we queue a extended operation DsGetNCChanges call to ask the RID Manager to give us a new allocation pool. Pair-Programmed-With: Andrew Bartlett --- source4/dsdb/repl/drepl_out_pull.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source4/dsdb/repl/drepl_out_pull.c') diff --git a/source4/dsdb/repl/drepl_out_pull.c b/source4/dsdb/repl/drepl_out_pull.c index 2793eec8b4..ceec61848d 100644 --- a/source4/dsdb/repl/drepl_out_pull.c +++ b/source4/dsdb/repl/drepl_out_pull.c @@ -33,21 +33,21 @@ #include "librpc/gen_ndr/ndr_drsblobs.h" #include "libcli/composite/composite.h" -static WERROR dreplsrv_schedule_partition_pull_source(struct dreplsrv_service *s, - struct dreplsrv_partition *p, - struct dreplsrv_partition_source_dsa *source, - TALLOC_CTX *mem_ctx) +WERROR dreplsrv_schedule_partition_pull_source(struct dreplsrv_service *s, + struct dreplsrv_partition_source_dsa *source, + enum drsuapi_DsExtendedOperation extended_op) { struct dreplsrv_out_operation *op; - op = talloc_zero(mem_ctx, struct dreplsrv_out_operation); + op = talloc_zero(s, struct dreplsrv_out_operation); W_ERROR_HAVE_NO_MEMORY(op); op->service = s; op->source_dsa = source; + op->extended_op = extended_op; DLIST_ADD_END(s->ops.pending, op, struct dreplsrv_out_operation *); - talloc_steal(s, op); + return WERR_OK; } @@ -59,7 +59,7 @@ static WERROR dreplsrv_schedule_partition_pull(struct dreplsrv_service *s, struct dreplsrv_partition_source_dsa *cur; for (cur = p->sources; cur; cur = cur->next) { - status = dreplsrv_schedule_partition_pull_source(s, p, cur, mem_ctx); + status = dreplsrv_schedule_partition_pull_source(s, cur, DRSUAPI_EXOP_NONE); W_ERROR_NOT_OK_RETURN(status); } -- cgit From cc7967b1c0555ba7641fb0248077295521f74943 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 6 Jan 2010 17:16:58 +1100 Subject: s4-repl: allow for callbacks when a repl operation completes Pair-Programmed-With: Andrew Bartlett --- source4/dsdb/repl/drepl_out_pull.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source4/dsdb/repl/drepl_out_pull.c') diff --git a/source4/dsdb/repl/drepl_out_pull.c b/source4/dsdb/repl/drepl_out_pull.c index ceec61848d..8a33006d06 100644 --- a/source4/dsdb/repl/drepl_out_pull.c +++ b/source4/dsdb/repl/drepl_out_pull.c @@ -35,7 +35,9 @@ WERROR dreplsrv_schedule_partition_pull_source(struct dreplsrv_service *s, struct dreplsrv_partition_source_dsa *source, - enum drsuapi_DsExtendedOperation extended_op) + enum drsuapi_DsExtendedOperation extended_op, + uint64_t fsmo_info, + dreplsrv_fsmo_callback_t callback) { struct dreplsrv_out_operation *op; @@ -45,6 +47,8 @@ WERROR dreplsrv_schedule_partition_pull_source(struct dreplsrv_service *s, op->service = s; op->source_dsa = source; op->extended_op = extended_op; + op->fsmo_info = fsmo_info; + op->callback = callback; DLIST_ADD_END(s->ops.pending, op, struct dreplsrv_out_operation *); @@ -59,7 +63,7 @@ static WERROR dreplsrv_schedule_partition_pull(struct dreplsrv_service *s, struct dreplsrv_partition_source_dsa *cur; for (cur = p->sources; cur; cur = cur->next) { - status = dreplsrv_schedule_partition_pull_source(s, cur, DRSUAPI_EXOP_NONE); + status = dreplsrv_schedule_partition_pull_source(s, cur, DRSUAPI_EXOP_NONE, 0, NULL); W_ERROR_NOT_OK_RETURN(status); } @@ -122,6 +126,9 @@ static void dreplsrv_pending_op_callback(struct dreplsrv_out_operation *op) rf->consecutive_sync_failures)); done: + if (op->callback) { + op->callback(s, rf->result_last_attempt); + } talloc_free(op); s->ops.current = NULL; dreplsrv_run_pending_ops(s); -- cgit From 501dd4a3b51635fd215d6e397b64f264911c7250 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 30 Dec 2009 17:11:51 +0100 Subject: s4:dsdb/repl: convert dreplsrv_op_pull_source_send/recv to tevent_req metze Signed-off-by: Andrew Tridgell --- source4/dsdb/repl/drepl_out_pull.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'source4/dsdb/repl/drepl_out_pull.c') diff --git a/source4/dsdb/repl/drepl_out_pull.c b/source4/dsdb/repl/drepl_out_pull.c index 8a33006d06..c2ea7e6974 100644 --- a/source4/dsdb/repl/drepl_out_pull.c +++ b/source4/dsdb/repl/drepl_out_pull.c @@ -99,8 +99,10 @@ WERROR dreplsrv_schedule_partition_pull_by_guid(struct dreplsrv_service *s, TALL return WERR_NOT_FOUND; } -static void dreplsrv_pending_op_callback(struct dreplsrv_out_operation *op) +static void dreplsrv_pending_op_callback(struct tevent_req *subreq) { + struct dreplsrv_out_operation *op = tevent_req_callback_data(subreq, + struct dreplsrv_out_operation); struct repsFromTo1 *rf = op->source_dsa->repsFrom1; struct dreplsrv_service *s = op->service; time_t t; @@ -109,7 +111,8 @@ static void dreplsrv_pending_op_callback(struct dreplsrv_out_operation *op) t = time(NULL); unix_to_nt_time(&now, t); - rf->result_last_attempt = dreplsrv_op_pull_source_recv(op->creq); + rf->result_last_attempt = dreplsrv_op_pull_source_recv(subreq); + TALLOC_FREE(subreq); if (W_ERROR_IS_OK(rf->result_last_attempt)) { rf->consecutive_sync_failures = 0; rf->last_success = now; @@ -135,18 +138,12 @@ done: dreplsrv_notify_run_ops(s); } -static void dreplsrv_pending_op_callback_creq(struct composite_context *creq) -{ - struct dreplsrv_out_operation *op = talloc_get_type(creq->async.private_data, - struct dreplsrv_out_operation); - dreplsrv_pending_op_callback(op); -} - void dreplsrv_run_pending_ops(struct dreplsrv_service *s) { struct dreplsrv_out_operation *op; time_t t; NTTIME now; + struct tevent_req *subreq; if (s->ops.current || s->ops.n_current) { /* if there's still one running, we're done */ @@ -167,12 +164,18 @@ void dreplsrv_run_pending_ops(struct dreplsrv_service *s) op->source_dsa->repsFrom1->last_attempt = now; - op->creq = dreplsrv_op_pull_source_send(op); - if (!op->creq) { - dreplsrv_pending_op_callback(op); + subreq = dreplsrv_op_pull_source_send(op, s->task->event_ctx, op); + if (!subreq) { + struct repsFromTo1 *rf = op->source_dsa->repsFrom1; + + rf->result_last_attempt = WERR_NOMEM; + rf->consecutive_sync_failures++; + + DEBUG(1,("dreplsrv_op_pull_source(%s/%s) failures[%u]\n", + win_errstr(rf->result_last_attempt), + nt_errstr(werror_to_ntstatus(rf->result_last_attempt)), + rf->consecutive_sync_failures)); return; } - - op->creq->async.fn = dreplsrv_pending_op_callback_creq; - op->creq->async.private_data = op; + tevent_req_set_callback(subreq, dreplsrv_pending_op_callback, op); } -- cgit From b37bec8e06a42dcc003681b9a57eaac2b1abf4fd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 9 Jan 2010 20:42:23 +1100 Subject: s4-drs: give DN of failed replication partition --- source4/dsdb/repl/drepl_out_pull.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/dsdb/repl/drepl_out_pull.c') diff --git a/source4/dsdb/repl/drepl_out_pull.c b/source4/dsdb/repl/drepl_out_pull.c index c2ea7e6974..101214609a 100644 --- a/source4/dsdb/repl/drepl_out_pull.c +++ b/source4/dsdb/repl/drepl_out_pull.c @@ -123,10 +123,11 @@ static void dreplsrv_pending_op_callback(struct tevent_req *subreq) rf->consecutive_sync_failures++; - DEBUG(1,("dreplsrv_op_pull_source(%s/%s) failures[%u]\n", - win_errstr(rf->result_last_attempt), - nt_errstr(werror_to_ntstatus(rf->result_last_attempt)), - rf->consecutive_sync_failures)); + DEBUG(1,("dreplsrv_op_pull_source(%s/%s) for %s failures[%u]\n", + win_errstr(rf->result_last_attempt), + win_errstr(rf->result_last_attempt), + ldb_dn_get_linearized(op->source_dsa->partition->dn), + rf->consecutive_sync_failures)); done: if (op->callback) { -- cgit