Diff for /servers/slapd/overlays/syncprov.c between versions 1.316 and 1.317

version 1.316, 2010/11/15 14:42:06 version 1.317, 2010/11/21 14:31:38
Line 1 Line 1
 /* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.315 2010/07/28 00:21:27 hyc Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.316 2010/11/15 14:42:06 rein Exp $ */
 /* syncprov.c - syncrepl provider */  /* syncprov.c - syncrepl provider */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.  /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *   *
Line 133  typedef struct syncprov_info_t { Line 133  typedef struct syncprov_info_t {
         int             si_numops;      /* number of ops since last checkpoint */          int             si_numops;      /* number of ops since last checkpoint */
         int             si_nopres;      /* Skip present phase */          int             si_nopres;      /* Skip present phase */
         int             si_usehint;     /* use reload hint */          int             si_usehint;     /* use reload hint */
           int             si_active;      /* True if there are active mods */
         time_t  si_chklast;     /* time of last checkpoint */          time_t  si_chklast;     /* time of last checkpoint */
         Avlnode *si_mods;       /* entries being modified */          Avlnode *si_mods;       /* entries being modified */
         sessionlog      *si_logs;          sessionlog      *si_logs;
Line 1377  syncprov_op_cleanup( Operation *op, Slap Line 1378  syncprov_op_cleanup( Operation *op, Slap
         syncmatches *sm, *snext;          syncmatches *sm, *snext;
         modtarget *mt, mtdummy;          modtarget *mt, mtdummy;
   
           ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
           if ( si->si_active )
                   si->si_active--;
           ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
   
         for (sm = opc->smatches; sm; sm=snext) {          for (sm = opc->smatches; sm; sm=snext) {
                 snext = sm->sm_next;                  snext = sm->sm_next;
                 syncprov_free_syncop( sm->sm_op );                  syncprov_free_syncop( sm->sm_op );
Line 1977  syncprov_op_mod( Operation *op, SlapRepl Line 1983  syncprov_op_mod( Operation *op, SlapRepl
   
         ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );          ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
         have_psearches = ( si->si_ops != NULL );          have_psearches = ( si->si_ops != NULL );
           si->si_active++;
         ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );          ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
   
         cbsize = sizeof(slap_callback) + sizeof(opcookie) +          cbsize = sizeof(slap_callback) + sizeof(opcookie) +
Line 2411  syncprov_op_search( Operation *op, SlapR Line 2418  syncprov_op_search( Operation *op, SlapR
                 sop->s_inuse = 1;                  sop->s_inuse = 1;
   
                 ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );                  ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
                   while ( si->si_active ) {
                           /* Wait for active mods to finish before proceeding, as they
                            * may already have inspected the si_ops list looking for
                            * consumers to replicate the change to.  Using the log
                            * doesn't help, as we may finish playing it before the
                            * active mods gets added to it.
                            */
                           ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
                           if ( slapd_shutdown )
                                   return SLAPD_ABANDON;
                           if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool ))
                                   ldap_pvt_thread_yield();
                           ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
                   }
                 sop->s_next = si->si_ops;                  sop->s_next = si->si_ops;
                 si->si_ops = sop;                  si->si_ops = sop;
                 ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );                  ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );

Removed from v.1.316  
changed lines
  Added in v.1.317


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org