mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
ITS#6710: Force clients to refresh if context is dirty.
This commit is contained in:
parent
877fc0ab37
commit
990d8f562f
@ -134,6 +134,8 @@ typedef struct syncprov_info_t {
|
|||||||
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 */
|
int si_active; /* True if there are active mods */
|
||||||
|
int si_dirty; /* True if the context is dirty, i.e changes
|
||||||
|
* have been made without updating the csn. */
|
||||||
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;
|
||||||
@ -1813,6 +1815,8 @@ syncprov_op_response( Operation *op, SlapReply *rs )
|
|||||||
csn_changed = 1;
|
csn_changed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( csn_changed )
|
||||||
|
si->si_dirty = 0;
|
||||||
ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock );
|
ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock );
|
||||||
|
|
||||||
if ( csn_changed ) {
|
if ( csn_changed ) {
|
||||||
@ -1856,6 +1860,7 @@ syncprov_op_response( Operation *op, SlapReply *rs )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
si->si_dirty = !csn_changed;
|
||||||
ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock );
|
ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock );
|
||||||
|
|
||||||
if ( do_check ) {
|
if ( do_check ) {
|
||||||
@ -2374,6 +2379,7 @@ syncprov_op_search( Operation *op, SlapReply *rs )
|
|||||||
BerVarray ctxcsn;
|
BerVarray ctxcsn;
|
||||||
int i, *sids, numcsns;
|
int i, *sids, numcsns;
|
||||||
struct berval mincsn;
|
struct berval mincsn;
|
||||||
|
int dirty = 0;
|
||||||
|
|
||||||
if ( !(op->o_sync_mode & SLAP_SYNC_REFRESH) ) return SLAP_CB_CONTINUE;
|
if ( !(op->o_sync_mode & SLAP_SYNC_REFRESH) ) return SLAP_CB_CONTINUE;
|
||||||
|
|
||||||
@ -2449,6 +2455,7 @@ syncprov_op_search( Operation *op, SlapReply *rs )
|
|||||||
ctxcsn = NULL;
|
ctxcsn = NULL;
|
||||||
sids = NULL;
|
sids = NULL;
|
||||||
}
|
}
|
||||||
|
dirty = si->si_dirty;
|
||||||
ldap_pvt_thread_rdwr_runlock( &si->si_csn_rwlock );
|
ldap_pvt_thread_rdwr_runlock( &si->si_csn_rwlock );
|
||||||
|
|
||||||
/* If we have a cookie, handle the PRESENT lookups */
|
/* If we have a cookie, handle the PRESENT lookups */
|
||||||
@ -2528,7 +2535,7 @@ bailout:
|
|||||||
if ( changed )
|
if ( changed )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( !changed ) {
|
if ( !changed && !dirty ) {
|
||||||
do_present = 0;
|
do_present = 0;
|
||||||
no_change: if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) {
|
no_change: if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) {
|
||||||
LDAPControl *ctrls[2];
|
LDAPControl *ctrls[2];
|
||||||
@ -2612,7 +2619,7 @@ shortcut:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If something changed, find the changes */
|
/* If something changed, find the changes */
|
||||||
if ( gotstate && changed ) {
|
if ( gotstate && ( changed || dirty ) ) {
|
||||||
Filter *fand, *fava;
|
Filter *fand, *fava;
|
||||||
|
|
||||||
fand = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
|
fand = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
|
||||||
@ -2657,7 +2664,7 @@ shortcut:
|
|||||||
* the refresh phase, just invoke the response callback to transition
|
* the refresh phase, just invoke the response callback to transition
|
||||||
* us into persist phase
|
* us into persist phase
|
||||||
*/
|
*/
|
||||||
if ( !changed ) {
|
if ( !changed && !dirty ) {
|
||||||
rs->sr_err = LDAP_SUCCESS;
|
rs->sr_err = LDAP_SUCCESS;
|
||||||
rs->sr_nentries = 0;
|
rs->sr_nentries = 0;
|
||||||
send_ldap_result( op, rs );
|
send_ldap_result( op, rs );
|
||||||
|
Loading…
Reference in New Issue
Block a user