summaryrefslogtreecommitdiff
path: root/source4/dsdb/repl/drepl_service.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-09 18:04:07 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-09 18:04:07 +1000
commit8640293fabb0fd0fe92b814411577dcdb449100d (patch)
treee9c67e1a8c115525e8dd351d3ee61386d42c3111 /source4/dsdb/repl/drepl_service.c
parent939b936d1af9a5221922864ad579bf50157b957b (diff)
downloadsamba-8640293fabb0fd0fe92b814411577dcdb449100d.tar.gz
samba-8640293fabb0fd0fe92b814411577dcdb449100d.tar.bz2
samba-8640293fabb0fd0fe92b814411577dcdb449100d.zip
s4/repl: implement DsReplicaSync
This patch implements DsReplicaSync by passing the call via irpc to the repl server task. The repl server then triggers an immediate replication of the specified partition. This means we no longer need to set a small value for dreplsrv:periodic_interval to force frequent DRS replication. We can now wait for the DC to send us a ReplicaSync msg for any partition that changes, and we immediately sync that partition.
Diffstat (limited to 'source4/dsdb/repl/drepl_service.c')
-rw-r--r--source4/dsdb/repl/drepl_service.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c
index 27572af3df..eb49da3d41 100644
--- a/source4/dsdb/repl/drepl_service.c
+++ b/source4/dsdb/repl/drepl_service.c
@@ -106,6 +106,30 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct lo
}
/*
+ DsReplicaSync messages from the DRSUAPI server are forwarded here
+ */
+static NTSTATUS drepl_replica_sync(struct irpc_message *msg,
+ struct drsuapi_DsReplicaSync *r)
+{
+ struct dreplsrv_service *service = talloc_get_type(msg->private_data,
+ struct dreplsrv_service);
+ WERROR werr;
+ struct GUID *guid = &r->in.req.req1.naming_context->guid;
+
+ werr = dreplsrv_schedule_partition_pull_by_guid(service, msg, guid);
+ if (W_ERROR_IS_OK(werr)) {
+ DEBUG(3,("drepl_replica_sync: forcing sync of partition %s\n",
+ GUID_string(msg, guid)));
+ dreplsrv_run_pending_ops(service);
+ } else {
+ DEBUG(3,("drepl_replica_sync: failed setup of sync of partition %s - %s\n",
+ GUID_string(msg, guid), win_errstr(werr)));
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ return NT_STATUS_OK;
+}
+
+/*
startup the dsdb replicator service task
*/
static void dreplsrv_task_init(struct task_server *task)
@@ -173,6 +197,8 @@ static void dreplsrv_task_init(struct task_server *task)
}
irpc_add_name(task->msg_ctx, "dreplsrv");
+
+ IRPC_REGISTER(task->msg_ctx, drsuapi, DRSUAPI_DSREPLICASYNC, drepl_replica_sync, service);
}
/*