]> git.sur5r.net Git - openldap/commitdiff
ITS#7427 fix for spurious old entries
authorHoward Chu <hyc@openldap.org>
Thu, 1 Nov 2012 15:36:28 +0000 (08:36 -0700)
committerHoward Chu <hyc@openldap.org>
Thu, 1 Nov 2012 15:36:28 +0000 (08:36 -0700)
servers/slapd/syncrepl.c

index 7c07b90873d859fdf57189edc8bb92c9c9dd4448..dec190da0fb9daa63a7495711586a7aad468169c 100644 (file)
@@ -112,6 +112,7 @@ typedef struct syncinfo_s {
        int                     si_logstate;
        int                     si_got;
        int                     si_strict_refresh;      /* stop listening during fallback refresh */
+       int                     si_too_old;
        ber_int_t       si_msgid;
        Avlnode                 *si_presentlist;
        LDAP                    *si_ld;
@@ -935,8 +936,10 @@ do_syncrep2(
                                                                                si->si_ridtxt, syncCookie.ctxcsn->bv_val, bdn.bv_val );
                                                                        ldap_controls_free( rctrls );
                                                                        rc = 0;
+                                                                       si->si_too_old = 1;
                                                                        goto done;
                                                                }
+                                                               si->si_too_old = 0;
                                                                break;
                                                        }
                                                }
@@ -976,6 +979,13 @@ do_syncrep2(
                                                }
                                                assert( punlock < 0 );
                                                punlock = i;
+                                       } else if (si->si_too_old) {
+                                               bdn.bv_val[bdn.bv_len] = '\0';
+                                               Debug( LDAP_DEBUG_SYNC, "do_syncrep2: %s CSN too old, ignoring (%s)\n",
+                                                       si->si_ridtxt, bdn.bv_val, 0 );
+                                               ldap_controls_free( rctrls );
+                                               rc = 0;
+                                               goto done;
                                        }
                                        op->o_controls[slap_cids.sc_LDAPsync] = &syncCookie;
                                }
@@ -1426,6 +1436,8 @@ do_syncrepl(
                        ldap_pvt_thread_yield();
        }
 
+       si->si_too_old = 0;
+
        if ( si->si_ctype < 1 ) {
                goto deleted;
        }