]> git.sur5r.net Git - openldap/commitdiff
ITS#7052 ignore Adds with too old entryCSN
authorHoward Chu <hyc@openldap.org>
Fri, 3 Feb 2012 19:16:10 +0000 (11:16 -0800)
committerHoward Chu <hyc@openldap.org>
Fri, 3 Feb 2012 19:16:10 +0000 (11:16 -0800)
servers/slapd/syncrepl.c

index 48b315ebb8d780c5720b72c9a07bc07f1e52f60d..39382881a1f2109a1edf60e4ae4e1b6a989576ca 100644 (file)
@@ -2820,6 +2820,23 @@ syncrepl_entry(
                                 */
                                op->o_csn = a->a_vals[0];
                                freecsn = 0;
+                               /* There was no cookie CSN attached to this op,
+                                * make sure it's new enough
+                                */
+                               if ( !syncCSN ) {
+                                       int i, sid = slap_parse_csn_sid( &a->a_vals[0] );
+                                       for ( i = 0; i<si->si_cookieState->cs_num; i++ ) {
+                                               if ( sid < si->si_cookieState->cs_sids[i] )
+                                                       break;
+                                               if ( sid == si->si_cookieState->cs_sids[i] ) {
+                                                       if ( ber_bvcmp( &a->a_vals[0], &si->si_cookieState->cs_vals[i] ) <= 0 ) {
+                                                               Debug( LDAP_DEBUG_SYNC, "do_syncrep2: %s entryCSN too old, ignoring %s (%s)\n",
+                                                               si->si_ridtxt, a->a_vals[0].bv_val, entry->e_name.bv_val );
+                                                               goto done;
+                                                       }
+                                               }
+                                       }
+                               }
                        }
                }
 retry_add:;