Blame SOURCES/0050-Bug-1321124-use-a-consumer-maxcsn-only-as-anchor-if-.patch

7c7f29
From 34ef42f8f839a7c7f40366ae2516aa2692582672 Mon Sep 17 00:00:00 2001
7c7f29
From: Thierry Bordaz <tbordaz@redhat.com>
7c7f29
Date: Thu, 8 Sep 2016 11:38:15 +0200
7c7f29
Subject: [PATCH] Bug 1321124 - use a consumer maxcsn only as anchor if
7c7f29
 supplier is more advanced
7c7f29
7c7f29
(cherry picked from commit f4301f6be6bbff3c7bb0180a38f6dfd7e31b8558)
7c7f29
---
7c7f29
 ldap/servers/plugins/replication/cl5_clcache.c | 20 +++++++++-----------
7c7f29
 1 file changed, 9 insertions(+), 11 deletions(-)
7c7f29
7c7f29
diff --git a/ldap/servers/plugins/replication/cl5_clcache.c b/ldap/servers/plugins/replication/cl5_clcache.c
7c7f29
index 74f0fec..ca8b841 100644
7c7f29
--- a/ldap/servers/plugins/replication/cl5_clcache.c
7c7f29
+++ b/ldap/servers/plugins/replication/cl5_clcache.c
7c7f29
@@ -717,24 +717,22 @@ clcache_adjust_anchorcsn ( CLC_Buffer *buf, int *flag )
7c7f29
 								curr, conmaxcsn);
7c7f29
 			}
7c7f29
 
7c7f29
-			if (csn_compare (cscb->local_maxcsn, cscb->prev_local_maxcsn) == 0 ||
7c7f29
-			    csn_compare (cscb->prev_local_maxcsn, buf->buf_current_csn) > 0 ) {
7c7f29
-				if (csn_compare (cscb->local_maxcsn, cscb->consumer_maxcsn) > 0 ) {
7c7f29
+			if (csn_compare(cscb->local_maxcsn, cscb->consumer_maxcsn) > 0) {
7c7f29
+				/* We have something to send for this RID */
7c7f29
+
7c7f29
+				if (csn_compare(cscb->local_maxcsn, cscb->prev_local_maxcsn) == 0 ||
7c7f29
+					csn_compare(cscb->prev_local_maxcsn, buf->buf_current_csn) > 0) {
7c7f29
+					/* No new changes or it remains, in the buffer, updates to send  */
7c7f29
 					rid_anchor = buf->buf_current_csn;
7c7f29
-				}
7c7f29
-			} else {
7c7f29
-				/* prev local max csn < csnBuffer AND different from local maxcsn */
7c7f29
-				if (cscb->prev_local_maxcsn == NULL) {
7c7f29
+				} else {
7c7f29
+					/* prev local max csn < csnBuffer AND different from local maxcsn */
7c7f29
 					if (cscb->consumer_maxcsn == NULL) {
7c7f29
 						/* the consumer hasn't seen changes for this RID */
7c7f29
 						rid_anchor = cscb->local_mincsn;
7c7f29
 						rid_flag = DB_SET;
7c7f29
-					} else if ( csn_compare (cscb->local_maxcsn, cscb->consumer_maxcsn) > 0 ) {
7c7f29
+					} else {
7c7f29
 						rid_anchor = cscb->consumer_maxcsn;
7c7f29
 					}
7c7f29
-				} else {
7c7f29
-					/* csnPrevMaxSup > 0 */
7c7f29
-					rid_anchor = cscb->consumer_maxcsn;
7c7f29
 				}
7c7f29
 			}
7c7f29
 
7c7f29
-- 
7c7f29
2.4.11
7c7f29