]> git.sur5r.net Git - openldap/commitdiff
ITS#6152 restart consistency checker when going back online
authorHoward Chu <hyc@openldap.org>
Mon, 17 Aug 2009 13:24:33 +0000 (13:24 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 17 Aug 2009 13:24:33 +0000 (13:24 +0000)
reset refcnt when refreshing a query

servers/slapd/overlays/pcache.c

index 7f4d861fc6c6c9fb1017236436fa4070d1e2045d..70d2b97a1489db302a94f05f6c477e8093beea2f 100644 (file)
@@ -2809,6 +2809,10 @@ refresh_query( Operation *op, SlapReply *rs, CachedQuery *query,
        dnlist *dn;
        int i, rc;
 
+       ldap_pvt_thread_mutex_lock( &query->answerable_cnt_mutex );
+       query->refcnt = 0;
+       ldap_pvt_thread_mutex_unlock( &query->answerable_cnt_mutex );
+
        cb.sc_response = refresh_merge;
        cb.sc_private = &ri;
 
@@ -3263,6 +3267,15 @@ pc_cf_gen( ConfigArgs *c )
                        break;
                case PC_OFFLINE:
                        cm->cc_paused &= ~PCACHE_CC_OFFLINE;
+                       /* If there were cached queries when we went offline,
+                        * restart the checker now.
+                        */
+                       if ( cm->num_cached_queries ) {
+                               ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+                               cm->cc_paused = 0;
+                               ldap_pvt_runqueue_resched( &slapd_rq, cm->cc_arg, 0 );
+                               ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
+                       }
                        rc = 0;
                        break;
                }