summaryrefslogtreecommitdiff
path: root/source4/dsdb/repl/drepl_periodic.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-17 23:12:10 +1100
committerAndrew Tridgell <tridge@samba.org>2010-11-17 23:55:39 +1100
commit73016ad40523d4d41114c7b4d6bb2a46815bb597 (patch)
tree2e4e10cac687b70667530e84efc21d68119db747 /source4/dsdb/repl/drepl_periodic.c
parente17ea9f3f5019cd95ace6920ba73129cda0adf55 (diff)
downloadsamba-73016ad40523d4d41114c7b4d6bb2a46815bb597.tar.gz
samba-73016ad40523d4d41114c7b4d6bb2a46815bb597.tar.bz2
samba-73016ad40523d4d41114c7b4d6bb2a46815bb597.zip
s4-repl: ensure we don't starve pending replication ops
when there was a continuous sequence of notify ops, we could leave the replication ops starving. This ensures we run whichever was queued first
Diffstat (limited to 'source4/dsdb/repl/drepl_periodic.c')
-rw-r--r--source4/dsdb/repl/drepl_periodic.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source4/dsdb/repl/drepl_periodic.c b/source4/dsdb/repl/drepl_periodic.c
index 60f3581f5f..fe0fb6dd1c 100644
--- a/source4/dsdb/repl/drepl_periodic.c
+++ b/source4/dsdb/repl/drepl_periodic.c
@@ -116,5 +116,21 @@ static void dreplsrv_periodic_run(struct dreplsrv_service *service)
dreplsrv_ridalloc_check_rid_pool(service);
dreplsrv_run_pending_ops(service);
- dreplsrv_notify_run_ops(service);
+}
+
+/*
+ run the next pending op, either a notify or a pull
+ */
+void dreplsrv_run_pending_ops(struct dreplsrv_service *s)
+{
+ if (!s->ops.notifies && !s->ops.pending) {
+ return;
+ }
+ if (!s->ops.notifies ||
+ (s->ops.pending &&
+ s->ops.notifies->schedule_time > s->ops.pending->schedule_time)) {
+ dreplsrv_run_pull_ops(s);
+ } else {
+ dreplsrv_notify_run_ops(s);
+ }
}