summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-12 12:07:06 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-12 12:07:06 +1000
commitb00518cf7a9d82e92309c66462f7049e185342c5 (patch)
treee51c9e81d99d88288b44b35f49e2c77c44ae3f31
parent733fa19bc160b3aecfa15e0475042388e853969d (diff)
downloadsamba-b00518cf7a9d82e92309c66462f7049e185342c5.tar.gz
samba-b00518cf7a9d82e92309c66462f7049e185342c5.tar.bz2
samba-b00518cf7a9d82e92309c66462f7049e185342c5.zip
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
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c16
1 files 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<ni; i++) {
+ nmd.ctr.ctr1.array[i].local_usn = seq_num;
+ }
+
/*
* when we know that we'll modify the record, add the whenChanged, uSNChanged
* and replPopertyMetaData attributes