dsdb: Clarify how the DSDB_REPL_FLAG_PRIORITISE_INCOMING flag works
authorAndrew Bartlett <abartlet@samba.org>
Fri, 21 Mar 2014 03:56:19 +0000 (16:56 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 26 Mar 2014 23:36:31 +0000 (00:36 +0100)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Change-Id: Ib9f2f4ba417dbf0ee24b6e7db02d78a9bfe8850c
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index 05ef176ba498f86f6795e2ec2fc724a9c129d420..6abd27ef08b6e3841e6553592362f29a923ad8de 100644 (file)
@@ -4396,11 +4396,19 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
                        }
 
                        if (ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING) {
                        }
 
                        if (ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING) {
-                               /* if we compare equal then do an
-                                  update. This is used when a client
-                                  asks for a FULL_SYNC, and can be
-                                  used to recover a corrupt
-                                  replica */
+                               /*
+                                * if we compare equal then do an
+                                * update. This is used when a client
+                                * asks for a FULL_SYNC, and can be
+                                * used to recover a corrupt
+                                * replica.
+                                *
+                                * This call is a bit tricky, what we
+                                * are doing it turning the 'is_newer'
+                                * call into a 'not is older' by
+                                * swapping i and j, and negating the
+                                * outcome.
+                               */
                                cmp = !replmd_replPropertyMetaData1_is_newer(&rmd->ctr.ctr1.array[i],
                                                                             &nmd.ctr.ctr1.array[j]);
                        } else {
                                cmp = !replmd_replPropertyMetaData1_is_newer(&rmd->ctr.ctr1.array[i],
                                                                             &nmd.ctr.ctr1.array[j]);
                        } else {