mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-30 11:39:34 -05:00
Fix prev commit, don't generate a new ctxcsn if we're a consumer with
an empty DB
This commit is contained in:
parent
42aca03eea
commit
55b29bedf8
1 changed files with 20 additions and 9 deletions
|
|
@ -2061,11 +2061,16 @@ syncprov_op_search( Operation *op, SlapReply *rs )
|
|||
|
||||
/* snapshot the ctxcsn */
|
||||
ldap_pvt_thread_mutex_lock( &si->si_csn_mutex );
|
||||
ber_bvarray_dup_x( &ctxcsn, si->si_ctxcsn, op->o_tmpmemctx );
|
||||
numcsns = si->si_numcsns;
|
||||
sids = op->o_tmpalloc( numcsns * sizeof(int), op->o_tmpmemctx );
|
||||
for ( i=0; i<numcsns; i++ )
|
||||
sids[i] = si->si_sids[i];
|
||||
if ( numcsns ) {
|
||||
ber_bvarray_dup_x( &ctxcsn, si->si_ctxcsn, op->o_tmpmemctx );
|
||||
sids = op->o_tmpalloc( numcsns * sizeof(int), op->o_tmpmemctx );
|
||||
for ( i=0; i<numcsns; i++ )
|
||||
sids[i] = si->si_sids[i];
|
||||
} else {
|
||||
ctxcsn = NULL;
|
||||
sids = NULL;
|
||||
}
|
||||
ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex );
|
||||
|
||||
/* If we have a cookie, handle the PRESENT lookups */
|
||||
|
|
@ -2073,6 +2078,12 @@ syncprov_op_search( Operation *op, SlapReply *rs )
|
|||
sessionlog *sl;
|
||||
int i, j;
|
||||
|
||||
/* If we don't have any CSN of our own yet, pretend nothing
|
||||
* has changed.
|
||||
*/
|
||||
if ( !numcsns )
|
||||
goto no_change;
|
||||
|
||||
/* If there are SIDs we don't recognize in the cookie, drop them */
|
||||
for (i=0; i<srs->sr_state.numcsns; ) {
|
||||
for (j=0; j<numcsns; j++) {
|
||||
|
|
@ -2116,7 +2127,7 @@ syncprov_op_search( Operation *op, SlapReply *rs )
|
|||
break;
|
||||
}
|
||||
if ( !changed ) {
|
||||
nochange = 1;
|
||||
no_change: nochange = 1;
|
||||
if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) {
|
||||
LDAPControl *ctrls[2];
|
||||
|
||||
|
|
@ -2534,10 +2545,10 @@ syncprov_db_open(
|
|||
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
|
||||
struct berval csn;
|
||||
|
||||
if ( SLAP_SYNC_SHADOW( op->o_bd ) && SLAP_SINGLE_SHADOW( op->o_bd )) {
|
||||
/* If we're also a consumer, and we're not multimaster,
|
||||
* then don't generate anything, wait for our provider to send it
|
||||
* to us.
|
||||
if ( SLAP_SYNC_SHADOW( op->o_bd )) {
|
||||
/* If we're also a consumer, then don't generate anything.
|
||||
* Wait for our provider to send it to us, or for a local
|
||||
* modify if we have multimaster.
|
||||
*/
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue