24
24
#include "dsdb/samdb/samdb.h"
25
25
#include "auth/auth.h"
26
26
#include "smbd/service.h"
27
#include "lib/messaging/irpc.h"
28
27
#include "dsdb/repl/drepl_service.h"
29
#include "lib/ldb/include/ldb_errors.h"
28
#include <ldb_errors.h>
30
29
#include "../lib/util/dlinklist.h"
31
30
#include "librpc/gen_ndr/ndr_misc.h"
32
31
#include "librpc/gen_ndr/ndr_drsuapi.h"
81
80
W_ERROR_HAVE_NO_MEMORY(new_te);
83
82
tmp_mem = talloc_new(service);
84
DEBUG(2,("dreplsrv_periodic_schedule(%u) %sscheduled for: %s\n",
83
DEBUG(4,("dreplsrv_periodic_schedule(%u) %sscheduled for: %s\n",
86
85
(service->periodic.te?"re":""),
87
86
nt_time_string(tmp_mem, timeval_to_nttime(&next_time))));
98
97
TALLOC_CTX *mem_ctx;
100
DEBUG(2,("dreplsrv_periodic_run(): schedule pull replication\n"));
99
DEBUG(4,("dreplsrv_periodic_run(): schedule pull replication\n"));
102
* KCC or some administrative tool
103
* might have changed Topology graph
104
* i.e. repsFrom/repsTo
106
dreplsrv_refresh_partitions(service);
102
108
mem_ctx = talloc_new(service);
103
109
dreplsrv_schedule_pull_replication(service, mem_ctx);
104
110
talloc_free(mem_ctx);
106
DEBUG(2,("dreplsrv_periodic_run(): run pending_ops memory=%u\n",
112
DEBUG(4,("dreplsrv_periodic_run(): run pending_ops memory=%u\n",
107
113
(unsigned)talloc_total_blocks(service)));
109
/* the KCC might have changed repsFrom */
110
dreplsrv_refresh_partitions(service);
115
dreplsrv_ridalloc_check_rid_pool(service);
112
117
dreplsrv_run_pending_ops(service);
113
dreplsrv_notify_run_ops(service);
121
run the next pending op, either a notify or a pull
123
void dreplsrv_run_pending_ops(struct dreplsrv_service *s)
125
if (!s->ops.notifies && !s->ops.pending) {
128
if (!s->ops.notifies ||
130
s->ops.notifies->schedule_time > s->ops.pending->schedule_time)) {
131
dreplsrv_run_pull_ops(s);
133
dreplsrv_notify_run_ops(s);