From 33f894664005544b80a6640c34dbf133edbe363d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 12 Jan 2007 17:19:48 +0000 Subject: r20713: sort the cursors in replUpToDateVector by source_dsa_invocation_id, w2k3 seems to do the same. It's later useful, when we would have a large array be could use a binary search metze (This used to be commit cd654f20e16c32f82ceb2b66453ce8d1be7020dd) --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source4') diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 18713d7e19..ca0291affd 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -641,6 +641,12 @@ static int replmd_replicated_uptodate_modify_callback(struct ldb_context *ldb, #endif } +static int replmd_drsuapi_DsReplicaCursor2_compare(const struct drsuapi_DsReplicaCursor2 *c1, + const struct drsuapi_DsReplicaCursor2 *c2) +{ + return GUID_compare(&c1->source_dsa_invocation_id, &c2->source_dsa_invocation_id); +} + static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *ar) { NTSTATUS nt_status; @@ -822,6 +828,13 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a */ nuv.ctr.ctr2.count = ni; + /* + * sort the cursors + */ + qsort(nuv.ctr.ctr2.cursors, nuv.ctr.ctr2.count, + sizeof(struct drsuapi_DsReplicaCursor2), + (comparison_fn_t)replmd_drsuapi_DsReplicaCursor2_compare); + /* * create the change ldb_message */ -- cgit