From b00518cf7a9d82e92309c66462f7049e185342c5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 12 Sep 2009 12:07:06 +1000 Subject: s4-repl: don't be too eager to allocate new sequence numbers we only need to allocate a new sequence number when replPropertyMetaData is changing or being created on an object --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 621f83073f..2a16c2bb82 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -964,11 +964,6 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar) } } - ret = ldb_sequence_number(ldb, LDB_SEQ_NEXT, &seq_num); - if (ret != LDB_SUCCESS) { - return replmd_replicated_request_error(ar, ret); - } - /* find existing meta data */ omd_value = ldb_msg_find_ldb_val(ar->search_msg, "replPropertyMetaData"); if (omd_value) { @@ -1003,8 +998,6 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar) for (i=0; i < rmd->ctr.ctr1.count; i++) { bool found = false; - rmd->ctr.ctr1.array[i].local_usn = seq_num; - for (j=0; j < ni; j++) { int cmp; @@ -1079,6 +1072,15 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar) ldb_debug(ldb, LDB_DEBUG_TRACE, "replmd_replicated_apply_merge[%u]: replace %u attributes\n", ar->index_current, msg->num_elements); + ret = ldb_sequence_number(ldb, LDB_SEQ_NEXT, &seq_num); + if (ret != LDB_SUCCESS) { + return replmd_replicated_request_error(ar, ret); + } + + for (i=0; i